Skip to content

Commit 5a683e9

Browse files
Test for String.contains and very large strings
This tests string refinement is able to deal with very large strings in string_not_contains_constraintt objects.
1 parent d1227be commit 5a683e9

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
779 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public class Test {
2+
public static String check(String s) {
3+
// Filter
4+
if (s == null) {
5+
return "Null string";
6+
}
7+
if (s.length() < 16_000_000) {
8+
return "Too short";
9+
}
10+
11+
// Act
12+
boolean b1 = s.contains("foobar");
13+
14+
// Filter output
15+
if (b1) {
16+
return "Contained";
17+
}
18+
19+
// Assert
20+
assert(false);
21+
return "Unreachable";
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Test.class
2+
--refine-strings --function Test.check
3+
^EXIT=10$
4+
^SIGNAL=0$
5+
^VERIFICATION FAILED$
6+
file Test.java line 20 .*: FAILURE$
7+
--
8+
--
9+
--string-max-length is not used on purpose, because this tests the behaviour
10+
of string refinement on very large strings.

0 commit comments

Comments
 (0)