summaryrefslogtreecommitdiff
path: root/Test/test2/IfThenElse1.bpl
blob: 1f27a9a986216902de94431d9904dbf5b224fd49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: %boogie -noinfer "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
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;
}