File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed
regression/jbmc-strings/StringBuilderInsert Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ public class Test {
3
+ public void check (int i ) {
4
+ if (i == 0 )
5
+ {
6
+ // Arrange
7
+ StringBuilder s = new StringBuilder ("bar" );
8
+
9
+ // Act
10
+ s = org .cprover .CProverString .insert (s , 0 , "foo" );
11
+
12
+ // Should succeed
13
+ assert s .toString ().equals ("foobar" );
14
+
15
+ // Should fail
16
+ assert !s .toString ().equals ("foobar" );
17
+ }
18
+ if (i == 1 )
19
+ {
20
+ // Arrange
21
+ StringBuilder s = new StringBuilder ("bar" );
22
+
23
+ // Act
24
+ s = org .cprover .CProverString .insert (s , -10 , "foo" );
25
+
26
+ // Should succeed
27
+ assert s .toString ().equals ("foobar" );
28
+
29
+ // Should fail
30
+ assert !s .toString ().equals ("foobar" );
31
+ }
32
+ if (i == 2 )
33
+ {
34
+ // Arrange
35
+ StringBuilder s = new StringBuilder ("bar" );
36
+
37
+ // Act
38
+ s = org .cprover .CProverString .insert (s , 10 , "foo" );
39
+
40
+ // Should succeed
41
+ assert s .toString ().equals ("barfoo" );
42
+
43
+ // Should fail
44
+ assert !s .toString ().equals ("barfoo" );
45
+ }
46
+
47
+ }
48
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --refine-strings --function Test.check
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ assertion at file Test.java line 13 .*: SUCCESS
7
+ assertion at file Test.java line 16 .*: FAILURE
8
+ assertion at file Test.java line 27 .*: SUCCESS
9
+ assertion at file Test.java line 30 .*: FAILURE
10
+ assertion at file Test.java line 41 .*: SUCCESS
11
+ assertion at file Test.java line 44 .*: FAILURE
12
+ --
You can’t perform that action at this time.
0 commit comments