summaryrefslogtreecommitdiff
path: root/Test/optimization/Optimization0.bpl
blob: 24424e53be7ad952da3d87dc509c99b47c86e108 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// RUN: %boogie /printModel:4 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

function may_fail(f: int) : bool;

procedure test0()
{
    var x: int;

    havoc x;
    assume 42 < x;
    assume {:minimize x} true;
    assert may_fail(x);
}

procedure test1()
{
    var x: int;

    x := 24;
    if (*) {
        x := 42;
    }
    assume {:minimize x} true;
    assert may_fail(x);
}

procedure test2()
{
    var x: int;

    x := 1;
    while (*) {
        x := x + 1;
    }
    assume {:minimize x} true;
    assert x < 10;
}

procedure test3()
{
    var x: int;

    havoc x;
    assume x < 42;
    assume {:maximize x} true;
    assert may_fail(x);
}

procedure test4()
{
    var x: int;

    x := 24;
    if (*) {
        x := 42;
    }
    assume {:maximize x} true;
    assert may_fail(x);
}

procedure test5()
{
    var x: int;

    x := 1;
    while (*) {
        x := x - 1;
    }
    assume {:maximize x} true;
    assert x < 1;
}

procedure test6()
{
    var x: int;

    x := 1;
    if (*) {
        x := 2;
    }
    assume {:maximize x} true;
    assert may_fail(x);
}