Skip to content

Commit 9b2c33e

Browse files
authored
Test for Silicon issue #894 (#839)
1 parent c757390 commit 9b2c33e

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// Any copyright is dedicated to the Public Domain.
2+
// http://creativecommons.org/publicdomain/zero/1.0/
3+
4+
5+
field f: Int
6+
7+
@exhaleMode("mce")
8+
method foo(x: Ref, y: Ref)
9+
{
10+
inhale acc(x.f) && acc(y.f)
11+
12+
var myseq: Seq[Ref] := Seq(x, y)
13+
14+
assert forall r: Ref :: r in myseq ==> fn(r) > 2
15+
16+
//:: ExpectedOutput(assert.failed:assertion.false)
17+
assert false
18+
}
19+
20+
@exhaleMode("mce")
21+
function fn(x: Ref): Int
22+
requires acc(x.f, wildcard)
23+
{5}
24+
25+
@exhaleMode("mce")
26+
function foo1(x: Ref, y: Ref, z: Ref, b: Bool): Int
27+
requires b ? acc(x.f) : acc(y.f)
28+
requires b ? z == x : z == y
29+
requires bar(z) > 2
30+
{5}
31+
32+
@exhaleMode("mce")
33+
function foo2(x: Ref, y: Ref, z: Ref, b: Bool): Int
34+
requires acc(x.f) && acc(y.f)
35+
requires z == x || z == y
36+
requires bar(z) > 2
37+
{5}
38+
39+
@exhaleMode("mce")
40+
function foo3(x: Ref, y: Ref, z: Ref, b: Bool): Int
41+
requires acc(x.f, b ? write : none) && acc(y.f, b ? none : write)
42+
requires (z == x && b && z != y) || (z == y && !b && z != x)
43+
requires bar(z) > 2
44+
{5}
45+
46+
47+
@exhaleMode("mce")
48+
function bar(x: Ref): Int
49+
requires acc(x.f, wildcard)
50+
{
51+
5
52+
}
53+
54+
@exhaleMode("mce")
55+
method caller1(x: Ref, y: Ref)
56+
{
57+
inhale acc(x.f) && acc(y.f)
58+
var res: Int
59+
res := foo1(x, y, x, true)
60+
res := foo1(x, y, y, false)
61+
//:: ExpectedOutput(assert.failed:assertion.false)
62+
assert false
63+
}
64+
65+
@exhaleMode("mce")
66+
method caller2(x: Ref, y: Ref)
67+
{
68+
inhale acc(x.f) && acc(y.f)
69+
var res: Int
70+
res := foo2(x, y, x, true)
71+
res := foo2(x, y, y, false)
72+
//:: ExpectedOutput(assert.failed:assertion.false)
73+
assert false
74+
}
75+
76+
@exhaleMode("mce")
77+
method caller3(x: Ref, y: Ref)
78+
{
79+
inhale acc(x.f) && acc(y.f)
80+
var res: Int
81+
res := foo3(x, y, x, true)
82+
res := foo3(x, y, y, false)
83+
//:: ExpectedOutput(assert.failed:assertion.false)
84+
assert false
85+
}

0 commit comments

Comments
 (0)