Skip to content

Commit 6e26a18

Browse files
Joel Allredromainbrenguier
Joel Allred
authored andcommitted
Add performance tests with negated asserts
Add a series of performance tests that check that the negation of the assertions found in the smoke tests indeed fail.
1 parent 1b30cbe commit 6e26a18

File tree

79 files changed

+494
-0
lines changed

Some content is hidden

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

79 files changed

+494
-0
lines changed
Lines changed: 9 additions & 0 deletions
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
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_append_char.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 15.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 17 additions & 0 deletions
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_append_int.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 9.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 11 additions & 0 deletions
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_append_object.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 15.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 17 additions & 0 deletions
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_append_string.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 12.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 14 additions & 0 deletions
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_case.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 8.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 12 additions & 0 deletions
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+
!u.equals("AB") ||
10+
!s.equalsIgnoreCase("aB"));
11+
}
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_char_array.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 9.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 13 additions & 0 deletions
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+
a != 'a' ||
11+
c != 'c');
12+
}
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_init.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 14.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
assert(s.length() != 10 ||
15+
!t.equals("el") ||
16+
!s.startsWith("Hello"));
17+
}
18+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_char_at.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 5.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 7 additions & 0 deletions
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_code_point.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 8.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 14 additions & 0 deletions
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+
StringBuilder sb = new StringBuilder();
7+
sb.appendCodePoint(0x10907);
8+
assert(s.codePointAt(1) != 67847 ||
9+
s.codePointBefore(3) != 67847 ||
10+
s.codePointCount(1,5) < 2 ||
11+
s.offsetByCodePoints(1,2) < 3 ||
12+
s.charAt(1) != sb.charAt(0));
13+
}
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_compare.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 7.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 9 additions & 0 deletions
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+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FUTURE
2+
test_concat.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 10.* SUCCESS$
7+
^\[.*assertion.2\].* line 11.* FAILURE$
8+
--
Binary file not shown.
Lines changed: 13 additions & 0 deletions
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 != 'p');
12+
}
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_contains.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 7.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
assert(!s.contains(u));
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_delete.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 8.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 10 additions & 0 deletions
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_delete_char_at.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 9.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 11 additions & 0 deletions
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_empty.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 6.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 8 additions & 0 deletions
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+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_endswith.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 7.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
assert(!s.endsWith(suff));
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_equal.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 8.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
assert(!s.equals(t));
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_float.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 15.* FAILURE$
7+
--
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class test_float
2+
{
3+
public static void main(/*String[] arg*/)
4+
{
5+
float inf = 100.0f / 0.0f;
6+
float minus_inf = -100.0f / 0.0f;
7+
float nan = 0.0f / 0.0f;
8+
String inf_string = Float.toString(inf);
9+
String mininf_string = Float.toString(minus_inf);
10+
String nan_string = Float.toString(nan);
11+
System.out.println(nan_string);
12+
System.out.println(inf_string);
13+
System.out.println(mininf_string);
14+
assert(!nan_string.equals("NaN") || !inf_string.equals("Infinity")
15+
|| !mininf_string.equals("-Infinity"));
16+
}
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUTURE
2+
test_hash_code.class
3+
--string-refine
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[.*assertion.1\].* line 7.* FAILURE$
7+
--
Binary file not shown.

0 commit comments

Comments
 (0)