summaryrefslogtreecommitdiff
path: root/Test/inline/test1.bpl
blob: db847b2554352ddb2a963288ffe599721122568b (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
37
38
39
40
41
42
43
44
45

procedure Main()
{

	var x:int;
	var y:int;

	x := 1;
	y := 0;

	call x := inc(x, 5);
	call y := incdec(x, 2);

	assert(x - 1 == y);	

}

procedure {:inline 1} incdec(x:int, y:int) returns (z:int)
	ensures z == x + 1 - y;
{
	z := x;
	z := x + 1;
	call z := dec(z, y);
	
	return;
	
}

procedure {:inline 1} inc(x:int, i:int) returns (y:int)
	ensures y == x + i;
{
	y := x;
	y := x + i;
	return;
	
}

procedure {:inline 1} dec(x:int, i:int) returns (y:int)
	ensures y == x - i;
{
	y := x;
	y := x - i;
	return;
	
}