summaryrefslogtreecommitdiff
path: root/Test/test1
diff options
context:
space:
mode:
authorGravatar MichalMoskal <unknown>2010-02-18 19:58:38 +0000
committerGravatar MichalMoskal <unknown>2010-02-18 19:58:38 +0000
commit2e03ed114503dfa16547c06766fa683c690f9052 (patch)
tree7151121512b0e5476caca502bd7e04d0d0701bd9 /Test/test1
parent36bda629c0083590c5e4d17f06e769f822617033 (diff)
Implement if-then-else expression.
Diffstat (limited to 'Test/test1')
-rw-r--r--Test/test1/Answer4
-rw-r--r--Test/test1/IfThenElse0.bpl8
-rw-r--r--Test/test1/runtest.bat1
3 files changed, 13 insertions, 0 deletions
diff --git a/Test/test1/Answer b/Test/test1/Answer
index b0f4aac3..10ad5494 100644
--- a/Test/test1/Answer
+++ b/Test/test1/Answer
@@ -135,3 +135,7 @@ FunBody.bpl(6,45): Error: function body with invalid type: bool (expected: int)
FunBody.bpl(8,61): Error: function body with invalid type: int (expected: alpha)
FunBody.bpl(10,58): Error: function body with invalid type: int (expected: alpha)
3 type checking errors detected in FunBody.bpl
+IfThenElse0.bpl(5,7): Error: the first argument to if-then-else should be bool, not int
+IfThenElse0.bpl(6,7): Error: branches of if-then-else have incompatible types bool and int
+IfThenElse0.bpl(7,2): Error: mismatched types in assignment command (cannot assign int to bool)
+3 type checking errors detected in IfThenElse0.bpl
diff --git a/Test/test1/IfThenElse0.bpl b/Test/test1/IfThenElse0.bpl
new file mode 100644
index 00000000..c26461b1
--- /dev/null
+++ b/Test/test1/IfThenElse0.bpl
@@ -0,0 +1,8 @@
+procedure foo()
+{
+ var b:bool, i:int;
+
+ b := if i then b else b;
+ b := if b then b else i;
+ b := if b then i else i;
+}
diff --git a/Test/test1/runtest.bat b/Test/test1/runtest.bat
index c6881263..dda3a0af 100644
--- a/Test/test1/runtest.bat
+++ b/Test/test1/runtest.bat
@@ -17,3 +17,4 @@ rem set BGEXE=mono ..\..\Binaries\Boogie.exe
%BGEXE% %* /noVerify Orderings.bpl
%BGEXE% %* /noVerify EmptyCallArgs.bpl
%BGEXE% %* /noVerify FunBody.bpl
+%BGEXE% %* /noVerify IfThenElse0.bpl