summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorGravatar qunyanm <unknown>2016-02-11 15:18:34 -0800
committerGravatar qunyanm <unknown>2016-02-11 15:18:34 -0800
commitabfe9c32f0b33274511014dd4f498702bbcf0d7e (patch)
tree40d61f26b8fea19213d4e528e68e2cae439e35d4 /Test
parent3edef4354012d635ac5d44b8a33078af7211d0d3 (diff)
Fix issue 133. The return type for some compare operators was wrongly typed
as int instead of bool.
Diffstat (limited to 'Test')
-rw-r--r--Test/dafny4/Bug133.dfy18
-rw-r--r--Test/dafny4/Bug133.dfy.expect2
2 files changed, 20 insertions, 0 deletions
diff --git a/Test/dafny4/Bug133.dfy b/Test/dafny4/Bug133.dfy
new file mode 100644
index 00000000..f7da133e
--- /dev/null
+++ b/Test/dafny4/Bug133.dfy
@@ -0,0 +1,18 @@
+// RUN: %dafny /noNLarith /compile:0 "%s" > "%t"
+// RUN: %diff "%s.expect" "%t"
+
+module Math__div_def_i {
+ function my_div_pos(x:int, d:int) : int
+ requires d > 0;
+ decreases if x < 0 then (d - x) else x;
+ {
+ if x < 0 then
+ -1 + my_div_pos(x+d, d)
+ else if x < d then
+ 0
+ else
+ 1 + my_div_pos(x-d, d)
+ }
+}
+
+
diff --git a/Test/dafny4/Bug133.dfy.expect b/Test/dafny4/Bug133.dfy.expect
new file mode 100644
index 00000000..c0c48e2b
--- /dev/null
+++ b/Test/dafny4/Bug133.dfy.expect
@@ -0,0 +1,2 @@
+
+Dafny program verifier finished with 1 verified, 0 errors