summaryrefslogtreecommitdiff
path: root/Test/test2/IfThenElse1.bpl
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/test2/IfThenElse1.bpl
parent36bda629c0083590c5e4d17f06e769f822617033 (diff)
Implement if-then-else expression.
Diffstat (limited to 'Test/test2/IfThenElse1.bpl')
-rw-r--r--Test/test2/IfThenElse1.bpl34
1 files changed, 34 insertions, 0 deletions
diff --git a/Test/test2/IfThenElse1.bpl b/Test/test2/IfThenElse1.bpl
new file mode 100644
index 00000000..8a867f50
--- /dev/null
+++ b/Test/test2/IfThenElse1.bpl
@@ -0,0 +1,34 @@
+type t1;
+
+procedure ok()
+{
+ var b:bool, x:int, y:int;
+
+ assert x == if b then x else x;
+ assert x == if true then x else y;
+}
+
+procedure ok2()
+{
+ var x:int, y:int;
+ var a:t1, b:t1, c:t1;
+
+ c := if x > y then a else b;
+ assert c == a || c == b;
+ assume x > y;
+ assert c == a;
+}
+
+procedure fail1()
+{
+ var b:bool, x:int, y:int;
+
+ assert x == if b then x else y;
+}
+
+procedure fail2()
+{
+ var b:bool, x:int, y:int;
+
+ assert x == if false then x else y;
+}