Skip to content

Commit ee66d56

Browse files
Joel Allredtautschnig
Joel Allred
authored andcommitted
Restructuration of tests on strings
Add test java_intern Adapt test.desc to new output format Make more robust java tests. Add test for parseint. Correction in the hacks to use refined strings in C programs Add smoke tests for java string support Quick set of tests. Created by modifying the existing development tests. Longer tests are run when using 'make testall'. Format of java files was adapted. No change to the validation tests (written by Lucas Cordeiro). Update smoke tests Add a series of performance tests that check that the negation of the assertions found in the smoke tests indeed fail. Update java_char_array_init/test_init.class Add first fixed_bugs test For bug #95 Update test description with new option name String refinement option name has changed to --refine-strings Formatting in cprover-string-hack.h Move smoke tests to regression folder. Move fixed bugs tests to strings folder Move string perfomance tests to strings directory These are not really performance tests, only tests that are longer than the smoke tests. Adapt Makefile for new location of smoke tests
1 parent 2470950 commit ee66d56

File tree

339 files changed

+1402
-738
lines changed

Some content is hidden

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

339 files changed

+1402
-738
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
test:
3+
@../test.pl -c ../../../src/cbmc/cbmc
4+
5+
testfuture:
6+
@../test.pl -c ../../../src/cbmc/cbmc -CF
7+
8+
testall:
9+
@../test.pl -c ../../../src/cbmc/cbmc -CFTK
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_append_char.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class test_append_char
2+
{
3+
public static void main(/*String[] args*/)
4+
{
5+
char[] diff = {'d', 'i', 'f', 'f'};
6+
char[] blue = {'b', 'l', 'u', 'e'};
7+
8+
StringBuilder buffer = new StringBuilder();
9+
10+
buffer.append(diff)
11+
.append(blue);
12+
13+
String tmp=buffer.toString();
14+
System.out.println(tmp);
15+
assert tmp.equals("diffblue");
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_append_int.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class test_append_int
2+
{
3+
public static void main(/*String[] args*/)
4+
{
5+
StringBuilder diffblue = new StringBuilder();
6+
diffblue.append("d");
7+
diffblue.append(4);
8+
String s = diffblue.toString();
9+
assert s.equals("d4");
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_append_object.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class test_append_object
2+
{
3+
public static void main(/*String[] args*/)
4+
{
5+
Object diff = "diff";
6+
Object blue = "blue";
7+
8+
StringBuilder buffer = new StringBuilder();
9+
10+
buffer.append(diff)
11+
.append(blue);
12+
13+
String tmp=buffer.toString();
14+
System.out.println(tmp);
15+
assert tmp.equals("diffblue");
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_append_string.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class test_append_string
2+
{
3+
public static void main(/*String[] args*/)
4+
{
5+
String di = new String("di");
6+
StringBuilder diff = new StringBuilder();
7+
diff.append(di);
8+
diff.append("ff");
9+
System.out.println(diff);
10+
String s = diff.toString();
11+
System.out.println(s);
12+
assert s.equals("diff");
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_case.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class test_case
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
String s = new String("Ab");
6+
String l = s.toLowerCase();
7+
String u = s.toUpperCase();
8+
assert(l.equals("ab"));
9+
assert(u.equals("AB"));
10+
assert(s.equalsIgnoreCase("aB"));
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_char_array.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
char c = str[2];
8+
char a = s.charAt(0);
9+
assert(str.length == 3);
10+
assert(a == 'a');
11+
assert(c == 'c');
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_init.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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.length());
15+
assert(s.length() == 10);
16+
System.out.println(s);
17+
System.out.println(t);
18+
assert(t.equals("el"));
19+
assert(s.startsWith("Hello"));
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_char_at.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class test_char_at {
2+
3+
public static void main(/*String[] argv*/) {
4+
String s = new String("abc");
5+
assert(s.charAt(2)=='c');
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_code_point.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class test_code_point
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
String s = "!𐤇𐤄𐤋𐤋𐤅";
6+
assert(s.codePointAt(1) == 67847);
7+
assert(s.codePointBefore(3) == 67847);
8+
assert(s.codePointCount(1,5) >= 2);
9+
assert(s.offsetByCodePoints(1,2) >= 3);
10+
StringBuilder sb = new StringBuilder();
11+
sb.appendCodePoint(0x10907);
12+
assert(s.charAt(1) == sb.charAt(0));
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_compare.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class test_compare
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
String s1 = "ab";
6+
String s2 = "aa";
7+
assert(s1.compareTo(s2) == 1);
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FUTURE
2+
test_concat.class
3+
--refine-strings
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 10.* SUCCESS$
7+
^\[.*assertion.2\].* line 11.* FAILURE$
8+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class test_concat
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
String s = new String("pi");
6+
int i = s.length();
7+
String t = new String("ppo");
8+
String u = s.concat(t);
9+
char c = u.charAt(i);
10+
assert(c == 'p');
11+
assert(c == 'o');
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FUTURE
2+
test_contains.class
3+
--refine-strings
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 8.* SUCCESS$
7+
^\[.*assertion.2\].* line 9.* FAILURE$
8+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class test_contains
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
String s = new String("Abc");
6+
String u = "bc";
7+
String t = "ab";
8+
assert(s.contains(u));
9+
assert(s.contains(t));
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_delete.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class test_delete
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
StringBuilder s = new StringBuilder("Abc");
6+
s.delete(1,2);
7+
String str = s.toString();
8+
assert(str.equals("Ac"));
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_delete_char_at.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class test_delete_char_at
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
StringBuilder s = new StringBuilder();
6+
s.append("Abc");
7+
s.deleteCharAt(1);
8+
String str = s.toString();
9+
assert(str.equals("Ac"));
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_empty.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class test_empty
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
String empty = "";
6+
assert(empty.isEmpty());
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FUTURE
2+
test_endswith.class
3+
--refine-strings
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 9.* SUCCESS$
7+
^\[.*assertion.2\].* line 10.* FAILURE$
8+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class test_endswith
2+
{
3+
public static void main(/*String[] argv*/)
4+
{
5+
String s = new String("Abcd");
6+
String suff = "cd";
7+
String bad_suff = "bc";
8+
9+
assert(s.endsWith(suff));
10+
assert(s.endsWith(bad_suff));
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FUTURE
2+
test_equal.class
3+
--refine-strings
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 8.* FAILURE$
7+
^\[.*assertion.2\].* line 9.* SUCCESS$
8+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class test_equal
2+
{
3+
public static void main(String[] argv)
4+
{
5+
String s = new String("pi");
6+
String t = new String("po");
7+
String u = "po";
8+
assert(s.equals(t));
9+
assert(t.equals(u));
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_float.class
3+
--refine-strings
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.

0 commit comments

Comments
 (0)