diff options
author | Clément Pit--Claudel <clement.pitclaudel@live.com> | 2015-08-21 09:41:24 -0700 |
---|---|---|
committer | Clément Pit--Claudel <clement.pitclaudel@live.com> | 2015-08-21 09:41:24 -0700 |
commit | 2dc3028a9f82e5109f82e5d370ae579ae947eb25 (patch) | |
tree | 1a2c5812ac239d069206d598fc9b3f2bbff6044f /Test/triggers | |
parent | 8695668ca1121dde6a91f7a0c00ef0b065104c40 (diff) |
Add tests for display expressions used as triggers
Diffstat (limited to 'Test/triggers')
-rw-r--r-- | Test/triggers/set-construction-is-a-good-trigger.dfy | 12 | ||||
-rw-r--r-- | Test/triggers/set-construction-is-a-good-trigger.dfy.expect | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Test/triggers/set-construction-is-a-good-trigger.dfy b/Test/triggers/set-construction-is-a-good-trigger.dfy new file mode 100644 index 00000000..b3dee172 --- /dev/null +++ b/Test/triggers/set-construction-is-a-good-trigger.dfy @@ -0,0 +1,12 @@ +// RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" /autoTriggers:1 /printTooltips "%s" > "%t"
+// RUN: %diff "%s.expect" "%t"
+
+// This file ensures that display expressions can be picked as triggers. This is
+// useful for code that checks if a set, sequence, or multiset is a singleton.
+
+method M(s: seq<int>, st: set<int>, mst: multiset<int>)
+ requires exists y :: s == [y] // Seq#Build(Seq#Empty(): Seq Box, $Box(y#3))
+ requires exists y :: st == {y} // Set#UnionOne(Set#Empty(): Set Box, $Box(y#4))
+ requires exists y :: mst == multiset{y} // MultiSet#UnionOne(MultiSet#Empty(): MultiSet Box, $Box(y#5))
+{
+}
diff --git a/Test/triggers/set-construction-is-a-good-trigger.dfy.expect b/Test/triggers/set-construction-is-a-good-trigger.dfy.expect new file mode 100644 index 00000000..822b8498 --- /dev/null +++ b/Test/triggers/set-construction-is-a-good-trigger.dfy.expect @@ -0,0 +1,5 @@ +set-construction-is-a-good-trigger.dfy(8,11): Info: Selected triggers: {[y]}
+set-construction-is-a-good-trigger.dfy(9,11): Info: Selected triggers: {{y}}
+set-construction-is-a-good-trigger.dfy(10,11): Info: Selected triggers: {multiset{y}}
+
+Dafny program verifier finished with 2 verified, 0 errors
|