File tree 3 files changed +33
-0
lines changed
regression/jbmc-strings/StringLastIndexOf
3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ public class Test {
2
+ int fromIndex ;
3
+
4
+ public void check (String input_String1 , String input_String2 , int i ) {
5
+ if (input_String1 != null && input_String2 != null ) {
6
+ if (i == 0 ) {
7
+ // The last occurrence of the empty string "" is considered to
8
+ // occur at the index value this.length()
9
+ int lio = input_String1 .lastIndexOf (input_String2 );
10
+ if (input_String2 .length () == 0 )
11
+ assert lio == input_String1 .length ();
12
+ } else if (i == 1 ) {
13
+ // Contradiction with the previous condition (should fail).
14
+ assert "foo" .lastIndexOf ("" ) != 3 ;
15
+ } else if (i == 2 && input_String2 .length () > 0 ) {
16
+ int lio = input_String1 .lastIndexOf (input_String2 .charAt (0 ), fromIndex );
17
+ if (input_String2 .length () == 0 )
18
+ assert lio == fromIndex ;
19
+ } else if (i == 3 ) {
20
+ assert "foo" .lastIndexOf ("" , 2 ) != 2 ;
21
+ }
22
+ }
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --function Test.check --refine-strings --string-max-length 100
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ assertion at file Test.java line 11 .* SUCCESS$
7
+ assertion at file Test.java line 14 .* FAILURE$
8
+ assertion at file Test.java line 18 .* SUCCESS$
9
+ assertion at file Test.java line 20 .* FAILURE$
You can’t perform that action at this time.
0 commit comments