Skip to content

Commit 8bd75c8

Browse files
committed
Additional unbounded-array test that should continue to pass
This test passes without nondet-propagation, and should continue to pass if/when it is merged.
1 parent f8318fb commit 8bd75c8

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed
Binary file not shown.
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
andNot_Pass.class
3+
--depth 1600 --java-unwind-enum-static --java-max-vla-length 48 --unwind 4 --max-nondet-string-length 100 --function andNot_Pass.main
4+
^\[java::andNot_Pass\.main:\(\[Ljava/lang/String;\)V.assertion\.3\] line 40 assertion at file andNot_Pass\.java line 40 function java::andNot_Pass.main:\(\[Ljava/lang/String;\)V bytecode-index 52: FAILURE$
5+
^\*\* 1 of \d+ failed
6+
VERIFICATION FAILED
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
class BitSet {
2+
boolean bits[];
3+
public BitSet()
4+
{
5+
int size = org.cprover.CProver.nondetInt();
6+
org.cprover.CProver.assume(size >= 0);
7+
bits = new boolean[size];
8+
}
9+
public void set(int i)
10+
{
11+
org.cprover.CProver.assume(i < bits.length);
12+
bits[i] = true;
13+
}
14+
public boolean get(int i)
15+
{
16+
if(i < bits.length)
17+
return bits[i];
18+
return false;
19+
}
20+
public void andNot(BitSet other)
21+
{
22+
for (int i = 0; i < bits.length; i++) {
23+
bits[i] = bits[i] && !other.get(i);
24+
}
25+
}
26+
}
27+
28+
public class andNot_Pass {
29+
public static void main(String args[]) {
30+
BitSet b1 = new BitSet();
31+
b1.set(1);
32+
b1.set(2);
33+
BitSet b2 = new BitSet();
34+
b2.set(0);
35+
b2.set(2);
36+
b1.andNot(b2);
37+
38+
assert(!b1.get(0));
39+
assert(b1.get(1));
40+
assert(b1.get(2)); // expected to fail
41+
}
42+
}

0 commit comments

Comments
 (0)