summaryrefslogtreecommitdiff
path: root/Test/dafny0/SmallTests.dfy
diff options
context:
space:
mode:
authorGravatar Rustan Leino <leino@microsoft.com>2011-05-27 14:15:51 -0700
committerGravatar Rustan Leino <leino@microsoft.com>2011-05-27 14:15:51 -0700
commitb1d98701623bf4cbeb741dbfc6cca892c7ed6459 (patch)
tree279deaef16b320f414c88e2f1aa1e01edd219a00 /Test/dafny0/SmallTests.dfy
parent1acd05253ea0fc614ac3e6a612be19a3f3bcf6a4 (diff)
parent803f42612314d2d27f20dfa476bf0ff8ed24d958 (diff)
Merge
Diffstat (limited to 'Test/dafny0/SmallTests.dfy')
-rw-r--r--Test/dafny0/SmallTests.dfy29
1 files changed, 14 insertions, 15 deletions
diff --git a/Test/dafny0/SmallTests.dfy b/Test/dafny0/SmallTests.dfy
index 7cbabcd7..ac7286e9 100644
--- a/Test/dafny0/SmallTests.dfy
+++ b/Test/dafny0/SmallTests.dfy
@@ -109,11 +109,11 @@ class Modifies {
method B(p: Modifies)
modifies this;
{
- call A(this);
+ A(this);
if (p == this) {
- call p.A(p);
+ p.A(p);
}
- call A(p); // error: may violate modifies clause
+ A(p); // error: may violate modifies clause
}
method C(b: bool)
@@ -126,9 +126,9 @@ class Modifies {
requires p != null;
{
if (y == 3) {
- call p.C(true); // error: may violate modifies clause
+ p.C(true); // error: may violate modifies clause
} else {
- call p.C(false); // error: may violation modifies clause (the check is done without regard
+ p.C(false); // error: may violation modifies clause (the check is done without regard
// for the postcondition, which also makes sense, since there may, in
// principle, be other fields of the object that are not constrained by the
// postcondition)
@@ -138,7 +138,7 @@ class Modifies {
method E()
modifies this;
{
- call A(null); // allowed
+ A(null); // allowed
}
method F(s: set<Modifies>)
@@ -164,7 +164,7 @@ class Modifies {
foreach (m in s) {
m.x := m.x + 1;
}
- call F(s);
+ F(s);
}
foreach (m in s) {
assert m.x < m.x + 10; // nothing wrong with asserting something
@@ -211,27 +211,26 @@ class AllocatedTests {
assert allocated(6);
assert allocated(6);
assert allocated(null);
- assert allocated(#Lindgren.HerrNilsson);
+ assert allocated(Lindgren.HerrNilsson);
match (d) {
case Pippi(n) => assert allocated(n);
case Longstocking(q, dd) => assert allocated(q); assert allocated(dd);
case HerrNilsson => assert old(allocated(d));
}
- var ls := #Lindgren.Longstocking([], d);
+ var ls := Lindgren.Longstocking([], d);
assert allocated(ls);
assert old(allocated(ls));
- assert old(allocated(#Lindgren.Longstocking([r], d)));
- assert old(allocated(#Lindgren.Longstocking([n], d))); // error, because n was not allocated initially
+ assert old(allocated(Lindgren.Longstocking([r], d)));
+ assert old(allocated(Lindgren.Longstocking([n], d))); // error, because n was not allocated initially
}
}
-datatype Lindgren {
- Pippi(Node);
- Longstocking(seq<object>, Lindgren);
+datatype Lindgren =
+ Pippi(Node) |
+ Longstocking(seq<object>, Lindgren) |
HerrNilsson;
-}
// --------------------------------------------------