File tree 4 files changed +60
-0
lines changed
regression/jbmc-strings/long_string
4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ import org .cprover .CProverString ;
2
+
3
+ public class Test {
4
+ public static void check (String s , String t ) {
5
+ // Filter
6
+ if (s == null || t == null )
7
+ return ;
8
+
9
+ // Act
10
+ String u = s .concat (t );
11
+
12
+ // Filter out
13
+ if (u .length () < 3_000_000 )
14
+ return ;
15
+ if (CProverString .charAt (u , 500_000 ) != 'a' )
16
+ return ;
17
+ if (CProverString .charAt (u , 2_000_000 ) != 'b' )
18
+ return ;
19
+
20
+ // Assert
21
+ assert (false );
22
+ }
23
+
24
+ public static void checkAbort (String s , String t ) {
25
+ // Filter
26
+ if (s == null || t == null )
27
+ return ;
28
+
29
+ // Act
30
+ String u = s .concat (t );
31
+
32
+ // Filter out
33
+ if (u .length () < 67_108_864 )
34
+ return ;
35
+ if (CProverString .charAt (u , 2_000_000 ) != 'b' )
36
+ return ;
37
+
38
+ // Assert
39
+ assert (false );
40
+ }
41
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --refine-strings --function Test.check --string-max-input-length 2000000
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ assertion at file Test.java line 21 .* FAILURE
7
+ --
8
+ --
9
+ This checks that the solver manage to violate assertions even when this requires
10
+ some very long strings, as long as they don't exceed the arbitrary limit that
11
+ is set by the solver (64M characters).
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --refine-strings --function Test.checkAbort
4
+ ^EXIT=6$
5
+ ^SIGNAL=0$
6
+ --
7
+ --
8
+ This tests should abort, because concretizing a string of the requiered length may take to much memory.
You can’t perform that action at this time.
0 commit comments