Skip to content

Commit 3d681e9

Browse files
smowtonromainbrenguier
authored andcommitted
Add execution tests for array-cell-sensitivity
These are companions to the existing tests that check the show-vcc output, and serve to check that the formulas generated appear to behave properly.
1 parent afe1308 commit 3d681e9

File tree

22 files changed

+171
-3
lines changed

22 files changed

+171
-3
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
The real test is in test.desc; this is a companion to check that the program under
10+
test actually behaves as expected.

regression/cbmc/array-cell-sensitivity10/test.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ struct A
99
int main(int argc, char **argv)
1010
{
1111
struct A array[10];
12-
struct A *ptr = argc % 2 ? (struct A *)&argc : &array[0];
12+
struct A other[2];
13+
struct A *ptr = argc % 2 ? &other : &array[0];
1314
ptr[argc].x = 1;
1415
ptr[1].x = argc;
16+
assert(ptr[1].x == argc);
1517
assert(array[1].x == argc);
1618
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION FAILED$
5+
^\[main.assertion\.1\] line 16.*SUCCESS$
6+
^\[main.assertion\.2\] line 17.*FAILURE$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
The real test is in test.desc; this is a companion to check that the program under
12+
test actually behaves as expected.

regression/cbmc/array-cell-sensitivity11/test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ int main(int argc, char **argv)
1111
struct A array[10];
1212
int *ptr = argc % 2 ? &argc : &array[0].y;
1313
*ptr = argc;
14+
assert(*ptr == argc);
1415
assert(array[1].y == argc);
1516
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION FAILED$
5+
^\[main.assertion\.1\] line 14.*SUCCESS$
6+
^\[main.assertion\.2\] line 15.*FAILURE$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
The real test is in test.desc; this is a companion to check that the program under
12+
test actually behaves as expected.

regression/cbmc/array-cell-sensitivity12/test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ int main(int argc, char **argv)
1111
struct A array[10];
1212
int *ptr = argc % 2 ? &array[0].x : &array[0].y;
1313
*ptr = argc;
14+
assert(*ptr == argc);
1415
assert(array[0].y == argc);
1516
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION FAILED$
5+
^\[main.assertion\.1\] line 14.*SUCCESS$
6+
^\[main.assertion\.2\] line 15.*FAILURE$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
The real test is in test.desc; this is a companion to check that the program under
12+
test actually behaves as expected.

regression/cbmc/array-cell-sensitivity13/test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ int main(int argc, char **argv)
1717
node2.children[0] = argc % 11 ? &node1 : &node2;
1818
node2.children[1] = argc % 13 ? &node1 : &node2;
1919
root.children[0]->children[1]->children[1]->children[0]->data = 1;
20+
assert(root.children[0]->children[1]->children[1]->children[0]->data == 1);
2021
assert(node1.data == argc);
2122
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION FAILED$
5+
^\[main.assertion\.1\] line 20.*SUCCESS$
6+
^\[main.assertion\.2\] line 21.*FAILURE$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
The real test is in test.desc; this is a companion to check that the program under
12+
test actually behaves as expected.

regression/cbmc/array-cell-sensitivity14/test.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ int main(int argc, char **argv)
1818
node2.children[1] = argc % 13 ? &node1 : &node2;
1919
int idx1 = 0, idx2 = 1, idx3 = 1, idx4 = 0;
2020
root.children[idx1]->children[idx2]->children[idx3]->children[idx4]->data = 1;
21+
assert(
22+
root.children[idx1]->children[idx2]->children[idx3]->children[idx4]->data ==
23+
1);
2124
assert(node1.data == argc);
2225
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION FAILED$
5+
^\[main.assertion\.1\] line 21.*SUCCESS$
6+
^\[main.assertion\.2\] line 24.*FAILURE$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
The real test is in test.desc; this is a companion to check that the program under
12+
test actually behaves as expected.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
The real test is in test.desc; this is a companion to check that the program under
10+
test actually behaves as expected.

regression/cbmc/array-cell-sensitivity3/test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ int main(int argc, char **argv)
66
int *ptr = argc % 2 ? &argc : &array[0];
77
ptr[argc] = 1;
88
ptr[1] = argc;
9+
assert(ptr[1] == argc);
910
assert(array[1] == argc);
1011
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION FAILED$
5+
^\[main.assertion\.1\] line 9.*SUCCESS$
6+
^\[main.assertion\.2\] line 10.*FAILURE$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
The real test is in test.desc; this is a companion to check that the program under
12+
test actually behaves as expected.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
The real test is in test.desc; this is a companion to check that the program under
10+
test actually behaves as expected.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
The real test is in test.desc; this is a companion to check that the program under
10+
test actually behaves as expected.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
The real test is in test.desc; this is a companion to check that the program under
10+
test actually behaves as expected.

regression/cbmc/array-cell-sensitivity7/test.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ int main(int argc, char **argv)
77
char *ptr = argc % 2 ? (char *)&array[0] : (char *)&argc;
88
ptr[argc] = 'a';
99
ptr[1] = (char)argc;
10-
assert(array[1] == argc);
10+
assert(ptr[1] == (char)argc);
11+
assert(array[1] == (char)argc);
1112
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE broken-smt-backend
2+
test.c
3+
4+
^VERIFICATION FAILED$
5+
^\[main.assertion\.1\] line 10.*SUCCESS$
6+
^\[main.assertion\.2\] line 11.*FAILURE$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
The real test is in test.desc; this is a companion to check that the program under
12+
test actually behaves as expected.

regression/cbmc/array-cell-sensitivity8/test.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
int main(int argc, char **argv)
55
{
66
int array[10];
7-
long long *ptr = argc % 2 ? (long long *)&array[0] : (long long *)&argc;
7+
long long other;
8+
long long *ptr = argc % 2 ? (long long *)&array[0] : &other;
89
ptr[argc] = 1;
910
ptr[1] = argc;
11+
assert(ptr[1] == argc);
1012
assert(array[1] == argc);
1113
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE broken-smt-backend
2+
test.c
3+
4+
^VERIFICATION FAILED$
5+
^\[main.assertion\.1\] line 11.*SUCCESS$
6+
^\[main.assertion\.2\] line 12.*FAILURE$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
The real test is in test.desc; this is a companion to check that the program under
12+
test actually behaves as expected.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
The real test is in test.desc; this is a companion to check that the program under
10+
test actually behaves as expected.

0 commit comments

Comments
 (0)