Skip to content

Commit c207106

Browse files
Test with array of strings
This checks that jbmc correctly analyze functions that take arrays of strings as inputs. With the changes assigning strings directly at malloc site, this example can be analyzed by jbmc approximately 15 times faster.
1 parent 60183a3 commit c207106

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
925 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
public class Test {
2+
3+
public static String check(String[] array) {
4+
// Filter
5+
if(array == null)
6+
return "null array";
7+
if(array.length < 2)
8+
return "too short";
9+
if(array[0] == null)
10+
return "null string";
11+
12+
// Arrange
13+
String s0 = array[0];
14+
String s1 = array[1];
15+
16+
// Act
17+
boolean b = s0.equals(s1);
18+
19+
// Assert
20+
assert(s0 != null);
21+
assert(!b);
22+
23+
// Return
24+
return s0 + s1;
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Test.class
3+
--refine-strings --function Test.check --string-max-input-length 1000
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion\.1\].* line 20.* SUCCESS$
7+
^\[.*assertion\.2\].* line 21.* FAILURE$
8+
--

0 commit comments

Comments
 (0)