Skip to content

Commit f2c4804

Browse files
Romain Brenguierromainbrenguier
authored andcommitted
Regression test for the string-refine option
We are going to add a string-refine option to CBMC, (instead a pass option as used in previous version of the tests). We changed the test description file accordingly and added a few extra tests (for java char arrays). Also changed the flag in string regression from CORE to FUTURE: Since the string solver is not yet part of this branch, we mark the tests for string functions as FUTURE. They will be changed to CORE once the corresponding features are integrated in CBMC. I also changed the Makefile for being able to test tests marked as future.
1 parent 1029635 commit f2c4804

File tree

61 files changed

+210
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+210
-121
lines changed

regression/strings/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11

22
test:
3-
../test.pl -c ../../../src/cbmc/cbmc
3+
@../test.pl -c ../../../src/cbmc/cbmc
4+
5+
testfuture:
6+
@../test.pl -c ../../../src/cbmc/cbmc -F

regression/strings/cprover-string-hack.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ typedef unsigned char __CPROVER_char;
5656
******************************************************************************/
5757
extern __CPROVER_char __CPROVER_uninterpreted_string_char_at_func(__CPROVER_string str, int pos);
5858
extern __CPROVER_bool __CPROVER_uninterpreted_string_equal_func(__CPROVER_string str1, __CPROVER_string str2);
59-
extern __CPROVER_string __CPROVER_uninterpreted_string_literal_func();
59+
extern __CPROVER_string __CPROVER_uninterpreted_string_literal_func(char * str);
6060
extern __CPROVER_char __CPROVER_uninterpreted_char_literal_func();
6161
extern __CPROVER_string __CPROVER_uninterpreted_string_concat_func(__CPROVER_string str1, __CPROVER_string str2);
6262
extern int __CPROVER_uninterpreted_string_length_func(__CPROVER_string str);
@@ -68,5 +68,5 @@ extern int __CPROVER_uninterpreted_string_index_of_func(__CPROVER_string str, __
6868
extern int __CPROVER_uninterpreted_string_last_index_of_func(__CPROVER_string str, __CPROVER_char c);
6969
extern __CPROVER_string __CPROVER_uninterpreted_string_char_set_func(__CPROVER_string str, int pos, __CPROVER_char c);
7070
extern __CPROVER_string __CPROVER_uninterpreted_string_copy_func(__CPROVER_string str);
71-
extern unsigned __CPROVER_uninterpreted_string_parse_int_func(__CPROVER_string str);
72-
extern __CPROVER_string __CPROVER_uninterpreted_string_of_int_func(unsigned i);
71+
extern int __CPROVER_uninterpreted_string_parse_int_func(__CPROVER_string str);
72+
extern __CPROVER_string __CPROVER_uninterpreted_string_of_int_func(int i);

regression/strings/java_case/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CORE
1+
FUTURE
22
test_case.class
3-
--pass
3+
--string-refine
44
^EXIT=10$
55
^SIGNAL=0$
66
^\[assertion.1\] assertion at file test_case.java line 11: SUCCESS$
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FUTURE
2+
test_char_array.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[assertion.1\] assertion at file test_char_array.java line 11: SUCCESS$
7+
^\[assertion.2\] assertion at file test_char_array.java line 12: SUCCESS$
8+
^\[assertion.3\] assertion at file test_char_array.java line 13: FAILURE$
9+
--
820 Bytes
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
public class test_char_array {
2+
3+
public static void main(String[] argv)
4+
{
5+
String s = "abc";
6+
char [] str = s.toCharArray();
7+
int[] test = new int[312];
8+
char c = str[2];
9+
String t = argv[0];
10+
char d = t.charAt(0);
11+
assert(str.length == 3);
12+
assert(c == 'c');
13+
assert(c == d || d < 'a' || d > 'z' );
14+
}
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FUTURE
2+
test_init.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[assertion.1\] assertion at file test_init.java line 16: SUCCESS$
7+
^\[assertion.2\] assertion at file test_init.java line 17: SUCCESS$
8+
^\[assertion.3\] assertion at file test_init.java line 18: SUCCESS$
9+
^\[assertion.4\] assertion at file test_init.java line 20: SUCCESS$
10+
^\[assertion.5\] assertion at file test_init.java line 21: FAILURE$
11+
--
1.18 KB
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public class test_init {
2+
3+
public static void main(String[] argv)
4+
{
5+
char [] str = new char[10];
6+
str[0] = 'H';
7+
str[1] = 'e';
8+
str[2] = 'l';
9+
str[3] = 'l';
10+
str[4] = 'o';
11+
String s = new String(str);
12+
String t = new String(str,1,2);
13+
14+
System.out.println(s);
15+
System.out.println(s.length());
16+
assert(s.startsWith("Hello"));
17+
assert(s.length() == 10);
18+
assert(t.equals("el"));
19+
String u = String.valueOf(str,3,2);
20+
assert(u.equals("lo"));
21+
assert(s.equals("Hello") || !t.equals("el") || !u.equals("lo"));
22+
}
23+
}

regression/strings/java_char_at/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CORE
1+
FUTURE
22
test_char_at.class
3-
--pass
3+
--string-refine
44
^EXIT=10$
55
^SIGNAL=0$
66
^\[assertion.1\] assertion at file test_char_at.java line 11: SUCCESS$

0 commit comments

Comments
 (0)