summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
Diffstat (limited to 'Test')
-rw-r--r--Test/dafny0/Fuel.dfy4
-rw-r--r--Test/dafny0/Fuel.dfy.expect10
-rw-r--r--Test/dafny4/Bug93.dfy37
-rw-r--r--Test/dafny4/Bug93.dfy.expect8
4 files changed, 55 insertions, 4 deletions
diff --git a/Test/dafny0/Fuel.dfy b/Test/dafny0/Fuel.dfy
index abbc831e..6347e134 100644
--- a/Test/dafny0/Fuel.dfy
+++ b/Test/dafny0/Fuel.dfy
@@ -126,7 +126,7 @@ module TestModule4 {
requires y > 5;
requires z < 0;
{
- assert {:fuel pos,0,0} pos(z) == 0; // error: Should fail due to "opaque" fuel setting
+ assert {:fuel pos,0,0} pos(z) == 0; // error: fuel can't be decreased
assert pos(-1) == 0;
if (*) {
assert pos(y) == 3 + pos(y - 3); // error: Should fail without extra fuel setting
@@ -404,7 +404,7 @@ module TestModule9 {
requires y > 5;
requires z < 0;
{
- assert {:fuel abs,0,0} abs(z) == -1*z; // error: Cannot see the body of abs
+ assert {:fuel abs,0,0} abs(z) == -1*z; // error: fuel can't be decreased
assert abs(y) == y; // Normal success
assert abs(-1) == 1; // lit bypasses fuel, so this should succeed
}
diff --git a/Test/dafny0/Fuel.dfy.expect b/Test/dafny0/Fuel.dfy.expect
index 0c128941..275be237 100644
--- a/Test/dafny0/Fuel.dfy.expect
+++ b/Test/dafny0/Fuel.dfy.expect
@@ -1,3 +1,5 @@
+Fuel.dfy(129,8): Error: Fuel can only increase within a given scope.
+Fuel.dfy(407,8): Error: Fuel can only increase within a given scope.
Fuel.dfy(17,22): Error: assertion violation
Execution trace:
(0,0): anon0
@@ -25,14 +27,17 @@ Execution trace:
Fuel.dfy(129,38): Error: assertion violation
Execution trace:
(0,0): anon0
+ (0,0): anon7_Then
Fuel.dfy(132,26): Error: assertion violation
Execution trace:
(0,0): anon0
- (0,0): anon3_Then
+ Fuel.dfy(129,9): anon7_Else
+ (0,0): anon8_Then
Fuel.dfy(133,26): Error: assertion violation
Execution trace:
(0,0): anon0
- (0,0): anon3_Then
+ Fuel.dfy(129,9): anon7_Else
+ (0,0): anon8_Then
Fuel.dfy(157,22): Error: assertion violation
Execution trace:
(0,0): anon0
@@ -91,6 +96,7 @@ Execution trace:
Fuel.dfy(407,38): Error: assertion violation
Execution trace:
(0,0): anon0
+ (0,0): anon3_Then
Fuel.dfy(435,22): Error: assertion violation
Execution trace:
(0,0): anon0
diff --git a/Test/dafny4/Bug93.dfy b/Test/dafny4/Bug93.dfy
new file mode 100644
index 00000000..5a1dd27f
--- /dev/null
+++ b/Test/dafny4/Bug93.dfy
@@ -0,0 +1,37 @@
+// RUN: %dafny /compile:0 "%s" > "%t"
+// RUN: %diff "%s.expect" "%t"
+
+module Fuel {
+ function FunctionA(x:int) : int
+ {
+ x + 2
+ }
+
+ function FunctionB(y:int) : int
+ {
+ FunctionA(y - 2)
+ }
+
+ method {:fuel FunctionA,0,0} MethodX(z:int)
+ {
+ assert FunctionB(z) == z; // error: Cannot see the body of FunctionA
+ }
+}
+
+module Opaque {
+ function {:opaque} FunctionA(x:int) : int
+ {
+ x + 2
+ }
+
+ function FunctionB(y:int) : int
+ {
+ FunctionA(y - 2)
+ }
+
+ method MethodX(z:int)
+ {
+ assert FunctionB(z) == z;
+ }
+}
+
diff --git a/Test/dafny4/Bug93.dfy.expect b/Test/dafny4/Bug93.dfy.expect
new file mode 100644
index 00000000..d0baf877
--- /dev/null
+++ b/Test/dafny4/Bug93.dfy.expect
@@ -0,0 +1,8 @@
+Bug93.dfy(17,28): Error: assertion violation
+Execution trace:
+ (0,0): anon0
+Bug93.dfy(34,28): Error: assertion violation
+Execution trace:
+ (0,0): anon0
+
+Dafny program verifier finished with 7 verified, 2 errors