summaryrefslogtreecommitdiff
path: root/Test/triggers
diff options
context:
space:
mode:
Diffstat (limited to 'Test/triggers')
-rw-r--r--Test/triggers/set-construction-is-a-good-trigger.dfy12
-rw-r--r--Test/triggers/set-construction-is-a-good-trigger.dfy.expect5
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