File tree 29 files changed +611
-1
lines changed
jbmc/regression/jbmc-strings
StringBuilderAppendConstantEvaluation1
StringBuilderAppendConstantEvaluation2
StringBuilderDefaultConstructorConstantEvaluation
StringConcatenationConstantEvaluation1
StringConcatenationConstantEvaluation2
StringConcatenationConstantEvaluation3
StringDefaultConstructorConstantEvaluation
29 files changed +611
-1
lines changed Original file line number Diff line number Diff line change
1
+ public class Main {
2
+ public void test () {
3
+ StringBuilder sb = new StringBuilder ("abc" );
4
+ sb .append ("xyz" );
5
+ String s = sb .toString ();
6
+ assert s .length () == 6 ;
7
+ assert s .startsWith ("abcxyz" );
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test --property "java::Main.test:()V.assertion.1" --property "java::Main.test:()V.assertion.2"
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ public class Main {
2
+ public void test1 () {
3
+ StringBuilder sb1 = new StringBuilder ("abc" );
4
+ String s2 = "" ;
5
+ sb1 .append (s2 );
6
+ assert sb1 .length () == 3 ;
7
+ assert sb1 .toString ().startsWith ("abc" );
8
+ }
9
+
10
+ public void test2 () {
11
+ StringBuilder sb1 = new StringBuilder ();
12
+ String s2 = "abc" ;
13
+ sb1 .append (s2 );
14
+ assert sb1 .length () == 3 ;
15
+ assert sb1 .toString ().startsWith ("abc" );
16
+ }
17
+
18
+ public void test3 () {
19
+ StringBuilder sb1 = new StringBuilder ();
20
+ String s2 = "" ;
21
+ sb1 .append (s2 );
22
+ assert sb1 .length () == 0 ;
23
+ assert sb1 .toString ().startsWith ("" );
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test1 --property "java::Main.test1:()V.assertion.1" --property "java::Main.test1:()V.assertion.2"
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test2 --property "java::Main.test2:()V.assertion.1" --property "java::Main.test2:()V.assertion.2"
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test3 --property "java::Main.test3:()V.assertion.1" --property "java::Main.test3:()V.assertion.2"
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ public class Main {
2
+ public void test () {
3
+ StringBuilder sb = new StringBuilder ();
4
+ String s = sb .toString ();
5
+ assert s .isEmpty ();
6
+ assert s .length () == 0 ;
7
+ }
8
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ public class Main {
2
+ public void test () {
3
+ String s1 = "abc" ;
4
+ String s2 = "xyz" ;
5
+ String s3 = s1 + s2 ;
6
+ assert s3 .length () == 6 ;
7
+ assert s3 .startsWith ("abcxyz" );
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test --property "java::Main.test:()V.assertion.1" --property "java::Main.test:()V.assertion.2"
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ public class Main {
2
+ public void test1 () {
3
+ String s1 = "abc" ;
4
+ String s2 = "" ;
5
+ String s3 = s1 + s2 ;
6
+ assert s3 .length () == 3 ;
7
+ assert s3 .startsWith ("abc" );
8
+ }
9
+
10
+ public void test2 () {
11
+ String s1 = "" ;
12
+ String s2 = "abc" ;
13
+ String s3 = s1 + s2 ;
14
+ assert s3 .length () == 3 ;
15
+ assert s3 .startsWith ("abc" );
16
+ }
17
+
18
+ public void test3 () {
19
+ String s1 = "" ;
20
+ String s2 = "" ;
21
+ String s3 = s1 + s2 ;
22
+ assert s3 .length () == 0 ;
23
+ assert s3 .startsWith ("" );
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test1 --property "java::Main.test1:()V.assertion.1" --property "java::Main.test1:()V.assertion.2"
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test2 --property "java::Main.test2:()V.assertion.1" --property "java::Main.test2:()V.assertion.2"
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test3 --property "java::Main.test3:()V.assertion.1" --property "java::Main.test3:()V.assertion.2"
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
Original file line number Diff line number Diff line change
1
+ public class Main {
2
+ public void test1 (String s1 ) {
3
+ String s2 = "abc" ;
4
+ assert (s1 + s2 ).startsWith ("abc" );
5
+ }
6
+
7
+ public void test2 (String s ) { assert ("" + s ).startsWith ("abc" ); }
8
+
9
+ public void test3 (String s ) { assert (s + s ).startsWith ("abc" ); }
10
+ }
Original file line number Diff line number Diff line change
1
+ CORE symex-driven-lazy-loading-expected-failure
2
+ Main.class
3
+ --function Main.test1 --property "java::Main.test1:(Ljava/lang/String;)V.assertion.1"
4
+ ^Generated [0-9]+ VCC\(s\), 1 remaining after simplification$
5
+ ^EXIT=10$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION FAILED$
8
+ --
9
+ --
10
+ This test checks that constant propagation does not happen, since a constant
11
+ result cannot be determined from the arguments to `+`.
Original file line number Diff line number Diff line change
1
+ CORE symex-driven-lazy-loading-expected-failure
2
+ Main.class
3
+ --function Main.test2 --property "java::Main.test2:(Ljava/lang/String;)V.assertion.1"
4
+ ^Generated [0-9]+ VCC\(s\), 1 remaining after simplification$
5
+ ^EXIT=10$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION FAILED$
8
+ --
9
+ --
10
+ This test checks that constant propagation does not happen, since a constant
11
+ result cannot be determined from the arguments to `+`.
Original file line number Diff line number Diff line change
1
+ CORE symex-driven-lazy-loading-expected-failure
2
+ Main.class
3
+ --function Main.test3 --property "java::Main.test3:(Ljava/lang/String;)V.assertion.1"
4
+ ^Generated [0-9]+ VCC\(s\), 1 remaining after simplification$
5
+ ^EXIT=10$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION FAILED$
8
+ --
9
+ --
10
+ This test checks that constant propagation does not happen, since a constant
11
+ result cannot be determined from the arguments to `+`.
Original file line number Diff line number Diff line change
1
+ public class Main {
2
+ public void test () {
3
+ String s = new String ();
4
+ assert s .isEmpty ();
5
+ assert s .startsWith ("" );
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Main.class
3
+ --function Main.test
4
+ ^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION SUCCESSFUL$
8
+ --
9
+ --
You can’t perform that action at this time.
0 commit comments