summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorGravatar akashlal <unknown>2010-07-07 17:52:18 +0000
committerGravatar akashlal <unknown>2010-07-07 17:52:18 +0000
commit2235d3dc9e090a1d4b13d653138838624c70ba26 (patch)
treecd24b337a633b8d0a189c0de269bb7dadad0a083 /Test
parentc9149ae1142d787e736f3fc7eea616d6422d31fb (diff)
Boogie: Added stratified inlining. It is enabled using the flag /stratifiedInline:1.
Diffstat (limited to 'Test')
-rw-r--r--Test/alltests.txt1
-rw-r--r--Test/stratifiedinline/Answer64
-rw-r--r--Test/stratifiedinline/bar1.bpl26
-rw-r--r--Test/stratifiedinline/bar2.bpl24
-rw-r--r--Test/stratifiedinline/bar3.bpl41
-rw-r--r--Test/stratifiedinline/bar4.bpl38
-rw-r--r--Test/stratifiedinline/bar6.bpl36
-rw-r--r--Test/stratifiedinline/runtest.bat22
8 files changed, 252 insertions, 0 deletions
diff --git a/Test/alltests.txt b/Test/alltests.txt
index e5f91e61..b566d8af 100644
--- a/Test/alltests.txt
+++ b/Test/alltests.txt
@@ -25,3 +25,4 @@ VSI-Benchmarks Use Solutions to Verified Software Initiative verification c
vacid0 Use Dafny attempts to VACID Edition 0 benchmarks
livevars Use STORM benchmarks for testing correctness of live variable analysis
lazyinline Use Lazy inlining benchmarks
+stratifiedinline Use Stratified inlining benchmarks
diff --git a/Test/stratifiedinline/Answer b/Test/stratifiedinline/Answer
new file mode 100644
index 00000000..aa83b37c
--- /dev/null
+++ b/Test/stratifiedinline/Answer
@@ -0,0 +1,64 @@
+----- Running regression test bar1.bpl
+bar1.bpl(25,1): Error BP5003: A postcondition might not hold at this return statement.
+bar1.bpl(21,1): Related location: This is the postcondition that might not hold.
+Execution trace:
+ bar1.bpl(24,3): anon0
+ Inlined call to procedure foo begins
+ bar1.bpl(13,5): anon0
+ Inlined call to procedure bar begins
+ bar1.bpl(7,5): anon0
+ Inlined call to procedure bar ends
+ Inlined call to procedure bar begins
+ bar1.bpl(7,5): anon0
+ Inlined call to procedure bar ends
+ Inlined call to procedure foo ends
+
+Boogie program verifier finished with 0 verified, 1 error
+-----
+----- Running regression test bar2.bpl
+bar2.bpl(21,3): Error BP5001: This assertion might not hold.
+Execution trace:
+ bar2.bpl(19,3): anon0
+ Inlined call to procedure foo begins
+ bar2.bpl(5,3): anon0
+ bar2.bpl(6,7): anon3_Then
+ Inlined call to procedure foo ends
+ Inlined call to procedure foo begins
+ bar2.bpl(5,3): anon0
+ bar2.bpl(9,7): anon3_Else
+ Inlined call to procedure foo ends
+
+Boogie program verifier finished with 0 verified, 1 error
+-----
+----- Running regression test bar3.bpl
+bar3.bpl(41,1): Error BP5003: A postcondition might not hold at this return statement.
+bar3.bpl(34,1): Related location: This is the postcondition that might not hold.
+Execution trace:
+ bar3.bpl(38,3): anon0
+ Inlined call to procedure foo begins
+ bar3.bpl(18,3): anon0
+ bar3.bpl(19,7): anon3_Then
+ Inlined call to procedure bar begins
+ bar3.bpl(7,3): anon0
+ bar3.bpl(8,7): anon3_Then
+ Inlined call to procedure bar ends
+ Inlined call to procedure bar begins
+ bar3.bpl(7,3): anon0
+ bar3.bpl(8,7): anon3_Then
+ Inlined call to procedure bar ends
+ Inlined call to procedure foo ends
+ Inlined call to procedure bar begins
+ bar3.bpl(7,3): anon0
+ bar3.bpl(10,7): anon3_Else
+ Inlined call to procedure bar ends
+
+Boogie program verifier finished with 0 verified, 1 error
+-----
+----- Running regression test bar4.bpl
+
+Boogie program verifier finished with 1 verified, 0 errors
+-----
+----- Running regression test bar6.bpl
+
+Boogie program verifier finished with 1 verified, 0 errors
+-----
diff --git a/Test/stratifiedinline/bar1.bpl b/Test/stratifiedinline/bar1.bpl
new file mode 100644
index 00000000..845954d5
--- /dev/null
+++ b/Test/stratifiedinline/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/stratifiedinline/bar2.bpl b/Test/stratifiedinline/bar2.bpl
new file mode 100644
index 00000000..76991a8f
--- /dev/null
+++ b/Test/stratifiedinline/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/stratifiedinline/bar3.bpl b/Test/stratifiedinline/bar3.bpl
new file mode 100644
index 00000000..7bd91184
--- /dev/null
+++ b/Test/stratifiedinline/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/stratifiedinline/bar4.bpl b/Test/stratifiedinline/bar4.bpl
new file mode 100644
index 00000000..84640811
--- /dev/null
+++ b/Test/stratifiedinline/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/stratifiedinline/bar6.bpl b/Test/stratifiedinline/bar6.bpl
new file mode 100644
index 00000000..e133aef7
--- /dev/null
+++ b/Test/stratifiedinline/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/stratifiedinline/runtest.bat b/Test/stratifiedinline/runtest.bat
new file mode 100644
index 00000000..194570d0
--- /dev/null
+++ b/Test/stratifiedinline/runtest.bat
@@ -0,0 +1,22 @@
+@echo off
+setlocal
+
+set BGEXE=..\..\Binaries\Boogie.exe
+rem set BGEXE=mono ..\..\Binaries\Boogie.exe
+
+echo ----- Running regression test bar1.bpl
+%BGEXE% %* /noinfer /stratifiedInline:1 bar1.bpl
+echo -----
+echo ----- Running regression test bar2.bpl
+%BGEXE% %* /noinfer /stratifiedInline:1 bar2.bpl
+echo -----
+echo ----- Running regression test bar3.bpl
+%BGEXE% %* /noinfer /stratifiedInline:1 bar3.bpl
+echo -----
+echo ----- Running regression test bar4.bpl
+%BGEXE% %* /noinfer /stratifiedInline:1 bar4.bpl
+echo -----
+echo ----- Running regression test bar6.bpl
+%BGEXE% %* /noinfer /stratifiedInline:1 bar6.bpl
+echo -----
+