diff options
author | Nadia Polikarpova <nadia.polikarpova@gmail.com> | 2012-09-21 17:48:16 +0200 |
---|---|---|
committer | Nadia Polikarpova <nadia.polikarpova@gmail.com> | 2012-09-21 17:48:16 +0200 |
commit | 0f2e84ea7799c04f9b079398989fd503ae72aa52 (patch) | |
tree | b2b3722410cedcc676a02b6c490887f33e37e5d9 /Test/dafny0/Calculations.dfy | |
parent | 33d178877dbde9371dc77144f8c3881751ad8553 (diff) |
Bugfix in the translation of calc statements (oops), added more resolution and verification tests
Diffstat (limited to 'Test/dafny0/Calculations.dfy')
-rw-r--r-- | Test/dafny0/Calculations.dfy | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Test/dafny0/Calculations.dfy b/Test/dafny0/Calculations.dfy new file mode 100644 index 00000000..9e44f62e --- /dev/null +++ b/Test/dafny0/Calculations.dfy @@ -0,0 +1,37 @@ +method CalcTest0(s: seq<int>) { + calc { + s[0]; // error: ill-formed line + } + + calc { + 2; + { assert s[0] == 1; } // error: ill-formed hint + 1 + 1; + } + + if (|s| > 0) { + calc { + s[0]; // OK: well-formed in this context + { assert s[0] == s[0]; } + <= s[0]; + } + } +} + +method CalcTest1(x: int, y: int) { + calc { + x + y; + { assume x == 0; } + y; + } + assert x == 0; // OK: follows from x + y == y; +} + +method CalcTest2(x: int, y: int) { + calc { + x + y; + { assume x == 0; } + y + x; + } + assert x == 0; // error: even though assumed above, is not exported by the calculation +}
\ No newline at end of file |