summaryrefslogtreecommitdiff
path: root/Test/dafny4/Bug68.dfy
diff options
context:
space:
mode:
authorGravatar qunyanm <unknown>2015-04-17 13:17:41 -0700
committerGravatar qunyanm <unknown>2015-04-17 13:17:41 -0700
commite4419c2e8d5469787f997fbf0e74f9ef8383c140 (patch)
treeb18c24a280a4532e55f0f2bc426b045312c9eb14 /Test/dafny4/Bug68.dfy
parentcfb9f6a3c00d4943a3bc7248a873b643746e0d24 (diff)
HashCode for Set/MultiSet/Map should be independent of the order of the
elements.
Diffstat (limited to 'Test/dafny4/Bug68.dfy')
-rw-r--r--Test/dafny4/Bug68.dfy26
1 files changed, 26 insertions, 0 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