diff options
author | qunyanm <unknown> | 2015-04-17 13:17:41 -0700 |
---|---|---|
committer | qunyanm <unknown> | 2015-04-17 13:17:41 -0700 |
commit | e4419c2e8d5469787f997fbf0e74f9ef8383c140 (patch) | |
tree | b18c24a280a4532e55f0f2bc426b045312c9eb14 /Test | |
parent | cfb9f6a3c00d4943a3bc7248a873b643746e0d24 (diff) |
HashCode for Set/MultiSet/Map should be independent of the order of the
elements.
Diffstat (limited to 'Test')
-rw-r--r-- | Test/dafny4/Bug68.dfy | 26 | ||||
-rw-r--r-- | Test/dafny4/Bug68.dfy.expect | 5 |
2 files changed, 30 insertions, 1 deletions
diff --git a/Test/dafny4/Bug68.dfy b/Test/dafny4/Bug68.dfy index bfd8c4ad..601da0b2 100644 --- a/Test/dafny4/Bug68.dfy +++ b/Test/dafny4/Bug68.dfy @@ -8,6 +8,14 @@ method M1() print {10, 20} in m, "\n"; // prints False
}
+method M1'()
+{
+ var m := map [{10, 20} := 33];
+ assert {10, 20} == {20, 10};
+ assert {20, 10} in m; // succeeds
+ print {20, 10} in m, "\n"; // prints False
+}
+
method M2()
{
var m := map [(map [1 := 10, 2 := 20]) := 33];
@@ -15,6 +23,14 @@ method M2() print (map [1 := 10, 2 := 20]) in m, "\n"; // prints False
}
+method M2'()
+{
+ var m := map [(map [1 := 10, 2 := 20]) := 33];
+ assert (map [1 := 10, 2 := 20] == map [2 := 20, 1 := 10]);
+ assert (map [2 := 20, 1 := 10]) in m; // succeeds
+ print (map [2 := 20, 1 := 10]) in m, "\n"; // prints False
+}
+
method M3()
{
var m := map [(multiset{10, 20}) := 33];
@@ -22,6 +38,13 @@ method M3() print (multiset{10, 20}) in m, "\n"; // prints False
}
+method M3'()
+{
+ var m := map [(multiset{10, 20}) := 33];
+ assert multiset{10, 20} == multiset{20, 10};
+ assert (multiset{20, 10}) in m; // succeeds
+ print (multiset{20, 10}) in m, "\n"; // prints False
+}
method M4()
{
@@ -33,7 +56,10 @@ method M4() method Main()
{
M1();
+ M1'();
M2();
+ M2'();
M3();
+ M3'();
M4();
}
\ No newline at end of file diff --git a/Test/dafny4/Bug68.dfy.expect b/Test/dafny4/Bug68.dfy.expect index 22cf7e4d..98b1498e 100644 --- a/Test/dafny4/Bug68.dfy.expect +++ b/Test/dafny4/Bug68.dfy.expect @@ -1,5 +1,5 @@ -Dafny program verifier finished with 10 verified, 0 errors
+Dafny program verifier finished with 16 verified, 0 errors
Program compiled successfully
Running...
@@ -7,3 +7,6 @@ True True True True +True +True +True |