Skip to content

Commit e61cf4f

Browse files
author
svorenova
committed
Add a regression test for nondet-static
1 parent 372ebcc commit e61cf4f

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed
836 Bytes
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
public class My {
2+
public static int s_non_init;
3+
public static int s_init = 1;
4+
public static int s_static_init;
5+
static { s_static_init = 2; }
6+
7+
public int field;
8+
9+
public My(int i) {
10+
String s = "bla";
11+
field = i;
12+
13+
/* Pass normally but fail with nondet-static */
14+
assert(s_non_init == 0);
15+
assert(s_init == 1);
16+
assert(s_static_init == 2);
17+
18+
/* Should still pass */
19+
assert(s == "bla");
20+
}
21+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CORE
2+
My.class
3+
--function "My.<init>" --nondet-static
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
assertion at file My\.java line 14 function java::My\.\<init\>:\(I\)V.*FAILURE$
8+
assertion at file My\.java line 15 function java::My\.\<init\>:\(I\)V.*FAILURE$
9+
assertion at file My\.java line 16 function java::My\.\<init\>:\(I\)V.*FAILURE$
10+
assertion at file My\.java line 19 function java::My\.\<init\>:\(I\)V.*SUCCESS$
11+
--
12+
--
13+
This tests nondet-static option, namely that static (non-final) variables are
14+
non-det initialized regardless of whether they are given a (static) initializer
15+
or not but constants such as strings are not non-det initialized

0 commit comments

Comments
 (0)