summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar qadeer <qadeer@microsoft.com>2011-06-24 06:54:06 -0700
committerGravatar qadeer <qadeer@microsoft.com>2011-06-24 06:54:06 -0700
commit6590c272066ee1c0aa45d735083847dc9c3e5d5f (patch)
tree3f26b2ee9caa9a84890d6342cdcae7c00b168d29
parentc57b12c920527690c1fd234e14ef7ca1c09e4185 (diff)
extra test files
-rw-r--r--Test/z3api/bar1.bpl26
-rw-r--r--Test/z3api/bar2.bpl24
-rw-r--r--Test/z3api/bar3.bpl41
-rw-r--r--Test/z3api/bar4.bpl38
-rw-r--r--Test/z3api/bar6.bpl36
-rw-r--r--Test/z3api/boog35.bpl17
6 files changed, 182 insertions, 0 deletions
diff --git a/Test/z3api/bar1.bpl b/Test/z3api/bar1.bpl
new file mode 100644
index 00000000..845954d5
--- /dev/null
+++ b/Test/z3api/bar1.bpl
@@ -0,0 +1,26 @@
+var x: int;
+var y: int;
+
+procedure {:inline 1} bar()
+modifies y;
+{
+ y := y + 1;
+}
+
+procedure {:inline 1} foo()
+modifies x, y;
+{
+ x := x + 1;
+ call bar();
+ call bar();
+ x := x + 1;
+}
+
+procedure main()
+requires x == y;
+ensures x != y;
+modifies x, y;
+{
+ call foo();
+}
+
diff --git a/Test/z3api/bar2.bpl b/Test/z3api/bar2.bpl
new file mode 100644
index 00000000..76991a8f
--- /dev/null
+++ b/Test/z3api/bar2.bpl
@@ -0,0 +1,24 @@
+
+procedure {:inline 1} foo() returns (x: bool)
+{
+ var b: bool;
+ if (b) {
+ x := false;
+ return;
+ } else {
+ x := true;
+ return;
+ }
+}
+
+procedure main()
+{
+ var b1: bool;
+ var b2: bool;
+
+ call b1 := foo();
+ call b2 := foo();
+ assert b1 == b2;
+}
+
+
diff --git a/Test/z3api/bar3.bpl b/Test/z3api/bar3.bpl
new file mode 100644
index 00000000..7bd91184
--- /dev/null
+++ b/Test/z3api/bar3.bpl
@@ -0,0 +1,41 @@
+var y: int;
+var x: int;
+
+procedure {:inline 1} bar(b: bool)
+modifies y;
+{
+ if (b) {
+ y := y + 1;
+ } else {
+ y := y - 1;
+ }
+}
+
+procedure {:inline 1} foo()
+modifies x, y;
+{
+ var b: bool;
+ if (b) {
+ x := x + 1;
+ call bar(true);
+ call bar(true);
+ x := x + 1;
+ } else {
+ x := x - 1;
+ call bar(false);
+ call bar(false);
+ x := x - 1;
+ }
+}
+
+
+procedure main()
+requires x == y;
+ensures x == y;
+modifies x, y;
+modifies y;
+{
+ call foo();
+ assert x == y;
+ call bar(false);
+}
diff --git a/Test/z3api/bar4.bpl b/Test/z3api/bar4.bpl
new file mode 100644
index 00000000..84640811
--- /dev/null
+++ b/Test/z3api/bar4.bpl
@@ -0,0 +1,38 @@
+var y: int;
+var x: int;
+
+procedure {:inline 1} bar() returns (b: bool)
+modifies y;
+{
+ if (b) {
+ y := y + 1;
+ } else {
+ y := y - 1;
+ }
+}
+
+procedure {:inline 1} foo()
+modifies x, y;
+{
+ var b: bool;
+
+ call b := bar();
+ if (b) {
+ x := x + 1;
+ } else {
+ x := x - 1;
+ }
+}
+
+
+procedure main() returns (b: bool)
+requires x == y;
+ensures !b ==> x == y+1;
+ensures b ==> x+1 == y;
+modifies x, y;
+modifies y;
+{
+ call foo();
+ assert x == y;
+ call b := bar();
+}
diff --git a/Test/z3api/bar6.bpl b/Test/z3api/bar6.bpl
new file mode 100644
index 00000000..e133aef7
--- /dev/null
+++ b/Test/z3api/bar6.bpl
@@ -0,0 +1,36 @@
+var M: [int]int;
+
+procedure {:inline 1} bar(y: int) returns (b: bool)
+modifies M;
+{
+ if (b) {
+ M[y] := M[y] + 1;
+ } else {
+ M[y] := M[y] - 1;
+ }
+}
+
+procedure {:inline 1} foo(x: int, y: int)
+modifies M;
+{
+ var b: bool;
+
+ call b := bar(y);
+ if (b) {
+ M[x] := M[x] + 1;
+ } else {
+ M[x] := M[x] - 1;
+ }
+}
+
+procedure main(x: int, y: int) returns (b: bool)
+requires x != y;
+requires M[x] == M[y];
+ensures !b ==> M[x] == M[y]+1;
+ensures b ==> M[x]+1 == M[y];
+modifies M;
+{
+ call foo(x, y);
+ assert M[x] == M[y];
+ call b := bar(y);
+}
diff --git a/Test/z3api/boog35.bpl b/Test/z3api/boog35.bpl
new file mode 100644
index 00000000..beae0c74
--- /dev/null
+++ b/Test/z3api/boog35.bpl
@@ -0,0 +1,17 @@
+procedure foo1(x: int, y: int)
+{
+ var a: [int][int]int;
+
+ a[x][y] := 42;
+
+ assert a[x][y] == 42;
+}
+
+procedure foo2(x: int, y: int)
+{
+ var a: [int][int]int;
+
+ a[x][y] := 42;
+
+ assert a[x][y] == 43;
+} \ No newline at end of file