summaryrefslogtreecommitdiff
path: root/Test/civl/ghost.bpl
diff options
context:
space:
mode:
authorGravatar qadeer <qadeer@microsoft.com>2015-04-22 09:26:56 -0700
committerGravatar qadeer <qadeer@microsoft.com>2015-04-22 09:26:56 -0700
commit4c6dd519143fdbc8ecada56d58103d098c6bd18c (patch)
treeabdbf5f883d31236a221a5b95f5f0364e75caf36 /Test/civl/ghost.bpl
parent95a9ed0282811aa2bc3170f41b8b63508918b28e (diff)
renamed og to civl
Diffstat (limited to 'Test/civl/ghost.bpl')
-rw-r--r--Test/civl/ghost.bpl46
1 files changed, 46 insertions, 0 deletions
diff --git a/Test/civl/ghost.bpl b/Test/civl/ghost.bpl
new file mode 100644
index 00000000..74d16acf
--- /dev/null
+++ b/Test/civl/ghost.bpl
@@ -0,0 +1,46 @@
+// RUN: %boogie -noinfer -typeEncoding:m -useArrayTheory "%s" > "%t"
+// RUN: %diff "%s.expect" "%t"
+var {:layer 0} x: int;
+
+procedure {:yields} {:layer 0,1} Incr();
+ensures {:right} |{ A: x := x + 1; return true; }|;
+
+procedure ghost(y: int) returns (z: int)
+requires y == 1;
+ensures z == 2;
+{
+ z := y + 1;
+}
+
+procedure {:yields} {:layer 1,2} Incr2()
+ensures {:right} |{ A: x := x + 2; return true; }|;
+{
+ var {:ghost} a: int;
+ var {:ghost} b: int;
+
+ yield;
+ call a := ghost(1);
+ assert {:layer 1} a == 2;
+ par Incr() | Incr();
+ yield;
+}
+
+procedure ghost_0() returns (z: int)
+ensures z == x;
+{
+ z := x;
+}
+
+procedure {:yields} {:layer 1,2} Incr2_0()
+ensures {:right} |{ A: x := x + 2; return true; }|;
+{
+ var {:ghost} a: int;
+ var {:ghost} b: int;
+
+ yield;
+ call a := ghost_0();
+ par Incr() | Incr();
+ call b := ghost_0();
+ assert {:layer 1} b == a + 2;
+ yield;
+}