File tree Expand file tree Collapse file tree 6 files changed +66
-0
lines changed
regression/jbmc-strings/max-length Expand file tree Collapse file tree 6 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ public class Test {
2+
3+ static void checkMaxInputLength (String arg1 , String arg2 ) {
4+ // Filter
5+ if (arg1 == null || arg2 == null )
6+ return ;
7+
8+ // The validity of this depends on string-max-input-length
9+ assert arg1 .length () + arg2 .length () < 1_000_000 ;
10+ }
11+
12+ static void checkMaxLength (String arg1 , String arg2 ) {
13+ // Filter
14+ if (arg1 == null || arg2 == null )
15+ return ;
16+
17+ if (arg1 .length () + arg2 .length () < 4_001 )
18+ return ;
19+
20+ // Act
21+ String s = arg1 .concat (arg2 );
22+
23+ // When string-max-length is smaller than 4_000 this will
24+ // always be the case
25+ assert org .cprover .CProverString .charAt (s , 4_000 ) == '?' ;
26+ }
27+
28+ static void main (String argv []) {
29+ // Filter
30+ if (argv .length < 2 )
31+ return ;
32+
33+ // Act
34+ checkMaxInputLength (argv [0 ], argv [1 ]);
35+ checkMaxLength (argv [0 ], argv [1 ]);
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ Test.class
3+ --refine-strings --verbosity 10 --string-max-input-length 499999 --function Test.checkMaxInputLength
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ assertion.* line 9 function java::Test.checkMaxInputLength.* bytecode-index 16: SUCCESS
Original file line number Diff line number Diff line change 1+ CORE
2+ Test.class
3+ --refine-strings --verbosity 10 --string-max-input-length 500000 --function Test.checkMaxInputLength
4+ ^EXIT=10$
5+ ^SIGNAL=0$
6+ assertion.* line 9 function java::Test.checkMaxInputLength.* bytecode-index 16: FAILURE
Original file line number Diff line number Diff line change 1+ CORE
2+ Test.class
3+ --refine-strings --verbosity 10 --string-max-length 4001 --function Test.checkMaxLength
4+ ^EXIT=10$
5+ ^SIGNAL=0$
6+ assertion.* line 25 function java::Test.checkMaxLength.* bytecode-index 26: FAILURE
Original file line number Diff line number Diff line change 1+ CORE
2+ Test.class
3+ --refine-strings --verbosity 10 --string-max-length 4000 --function Test.checkMaxLength
4+ ^SIGNAL=0$
5+ --
6+ ^EXIT=0$
7+ assertion.* line 25 function java::Test.checkMaxLength.* bytecode-index 26: SUCCESS
8+ --
9+ The solver may give an ERROR because the value of string-max-length is too
10+ small to give an answer about the assertion.
11+ So we just check that the answer is not success.
You can’t perform that action at this time.
0 commit comments