blob: b5068edddf72184aa92d47626618145ef51dd6e3 (
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
46
47
48
49
50
51
52
53
54
55
56
57
|
// RUN: %boogie -noinfer "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
var {:layer 0,1} g:int;
procedure {:yields} {:layer 1} PB()
{
yield;
call Incr();
yield;
}
procedure {:yields} {:layer 0,1} Incr();
ensures {:atomic}
|{A:
g := g + 1; return true;
}|;
procedure {:yields} {:layer 0,1} Set(v: int);
ensures {:atomic}
|{A:
g := v; return true;
}|;
procedure {:yields} {:layer 1} PC()
ensures {:layer 1} g == old(g);
{
yield;
assert {:layer 1} g == old(g);
}
procedure {:yields} {:layer 1} PE()
{
call PC();
}
procedure {:yields} {:layer 1} PD()
{
yield;
call Set(3);
call PC();
assert {:layer 1} g == 3;
}
procedure {:yields} {:layer 1} Main2()
{
yield;
while (*)
{
async call PB();
yield;
async call PE();
yield;
async call PD();
yield;
}
yield;
}
|