Skip to content

Commit 0619f05

Browse files
Better test for String.toCharArray
We now have in the test both assertions that should pass and assertions that should fail. This is to make sure our tests do not pass just because CBMC would be biased in one direction.
1 parent c745aa7 commit 0619f05

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
CORE
22
test_char_array.class
33
--refine-strings
4-
^EXIT=0$
4+
^EXIT=10$
55
^SIGNAL=0$
6-
^VERIFICATION SUCCESSFUL$
6+
.*assertion.* test_char_array.java line 9 .* SUCCESS$
7+
.*assertion.* test_char_array.java line 10 .* SUCCESS$
8+
.*assertion.* test_char_array.java line 11 .* SUCCESS$
9+
.*assertion.* test_char_array.java line 13 .* FAILURE$
10+
.*assertion.* test_char_array.java line 15 .* FAILURE$
11+
.*assertion.* test_char_array.java line 17 .* FAILURE$
12+
^VERIFICATION FAILED$
713
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
public class test_char_array
22
{
3-
public static void main(/*String[] argv*/)
3+
public static void main(int i)
44
{
55
String s = "abc";
66
char [] str = s.toCharArray();
@@ -9,5 +9,11 @@ public static void main(/*String[] argv*/)
99
assert(str.length == 3);
1010
assert(a == 'a');
1111
assert(c == 'c');
12+
if(i==0)
13+
assert(str.length != 3);
14+
if(i==2)
15+
assert(a != 'a');
16+
if(i==3)
17+
assert(c != 'c');
1218
}
1319
}

0 commit comments

Comments
 (0)