diff options
author | Rustan Leino <unknown> | 2015-06-15 15:20:38 -0700 |
---|---|---|
committer | Rustan Leino <unknown> | 2015-06-15 15:20:38 -0700 |
commit | 7f89a05ae627b7c5498b82deaea34cabc465aaa6 (patch) | |
tree | a4559459aca713884444dacf626e26e029d70723 /Test | |
parent | 8e6ed9af8dc779f4468d9ccc5ababcdd91f45672 (diff) |
Some more reads tests
Diffstat (limited to 'Test')
-rw-r--r-- | Test/dafny0/Reads.dfy | 14 | ||||
-rw-r--r-- | Test/dafny0/Reads.dfy.expect | 15 |
2 files changed, 28 insertions, 1 deletions
diff --git a/Test/dafny0/Reads.dfy b/Test/dafny0/Reads.dfy index 23064f54..f1c840c3 100644 --- a/Test/dafny0/Reads.dfy +++ b/Test/dafny0/Reads.dfy @@ -112,3 +112,17 @@ function ApplyToSet_AltSignature1<X>(S: set<X>, f: X -> X): set<X> function ApplyToSet_AltSignature2<X>(S: set<X>, f: X -> X): set<X> requires (forall x :: x in S ==> f.reads(x) == {}) ==> forall x :: x in S ==> f.requires(x) // (this precondition would not be good enough to check the body above) + +function FunctionInQuantifier0(): int + requires exists f: int -> int :: f(10) == 100 // error (x2): precondition violation and insufficient reads + +function FunctionInQuantifier1(): int + requires exists f: int -> int :: f.requires(10) && f(10) == 100 // error: insufficient reads + +function FunctionInQuantifier2(): int + requires exists f: int -> int :: f.reads(10) == {} && f.requires(10) && f(10) == 100 + ensures FunctionInQuantifier2() == 100 +{ + var f: int -> int :| f.reads(10) == {} && f.requires(10) && f(10) == 100; // error: insufficient reads for f.reads(10) + f(10) +} diff --git a/Test/dafny0/Reads.dfy.expect b/Test/dafny0/Reads.dfy.expect index 4dd1e947..79d290da 100644 --- a/Test/dafny0/Reads.dfy.expect +++ b/Test/dafny0/Reads.dfy.expect @@ -22,5 +22,18 @@ Execution trace: (0,0): anon0
(0,0): anon10_Then
(0,0): anon4
+Reads.dfy(117,36): Error: insufficient reads clause to invoke function
+Execution trace:
+ (0,0): anon0
+Reads.dfy(117,36): Error: possible violation of function precondition
+Execution trace:
+ (0,0): anon0
+Reads.dfy(120,38): Error: insufficient reads clause to invoke function
+Execution trace:
+ (0,0): anon0
+Reads.dfy(126,26): Error: insufficient reads clause to invoke function
+Execution trace:
+ (0,0): anon0
+ (0,0): anon8_Else
-Dafny program verifier finished with 15 verified, 6 errors
+Dafny program verifier finished with 15 verified, 10 errors
|