Skip to content

Commit bad0d16

Browse files
Add comments to tests
1 parent 3d21a85 commit bad0d16

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
CORE paths-lifo-expected-failure
22
test.c
33
--cover location --pointer-check --malloc-may-fail --malloc-fail-null
4-
\[main\.coverage\.4\] file test\.c line \d+ function main block 4 \(lines test\.c:main:13,14\): SATISFIED
5-
\[main\.coverage\.3\] file test\.c line \d+ function main block 3 \(lines test\.c:main:11\): FAILED
6-
\[main\.coverage\.2\] file test\.c line \d+ function main block 2 \(lines test\.c:main:5,6,8,10\): SATISFIED
4+
\[main\.coverage\.4\] file test\.c line \d+ function main block 4 \(lines test\.c:main:17,18\): SATISFIED
5+
\[main\.coverage\.3\] file test\.c line \d+ function main block 3 \(lines test\.c:main:15\): FAILED
6+
\[main\.coverage\.2\] file test\.c line \d+ function main block 2 \(lines test\.c:main:5,6,12,14\): SATISFIED
77
\[main\.coverage\.1\] file test\.c line \d+ function main block 1 \(lines test\.c:main:5\): SATISFIED
88
^EXIT=0$
99
^SIGNAL=0$
1010
--
1111
^warning: ignoring
12+
--
13+
This is checking that without the --cover-failed-assertions flag we still get the same result as we did before adding
14+
it in this example.

regression/cbmc/cover-failed-assertions/test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ int main()
55
int *ptr = malloc(sizeof(*ptr));
66
int a;
77

8+
// pointer check would detect the dereference of a null pointer here
9+
// default --cover lines behaviour is to treat non-cover assertions as
10+
// assumptions instead, so in the ptr == NULL case we don't get past this line
11+
// leading to failed coverage for the body of the if statement down below
812
a = *ptr;
913

1014
if(ptr == NULL)
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
CORE paths-lifo-expected-failure
22
test.c
33
--cover location --cover-failed-assertions --pointer-check --malloc-may-fail --malloc-fail-null
4-
\[main.coverage\.4\] file test\.c line \d+ function main block 4 \(lines test\.c:main:13,14\): SATISFIED
5-
\[main.coverage\.3\] file test\.c line \d+ function main block 3 \(lines test\.c:main:11\): SATISFIED
6-
\[main.coverage\.2\] file test\.c line \d+ function main block 2 \(lines test\.c:main:5,6,8,10\): SATISFIED
4+
\[main.coverage\.4\] file test\.c line \d+ function main block 4 \(lines test\.c:main:17,18\): SATISFIED
5+
\[main.coverage\.3\] file test\.c line \d+ function main block 3 \(lines test\.c:main:15\): SATISFIED
6+
\[main.coverage\.2\] file test\.c line \d+ function main block 2 \(lines test\.c:main:5,6,12,14\): SATISFIED
77
\[main.coverage\.1\] file test\.c line \d+ function main block 1 \(lines test\.c:main:5\): SATISFIED
88
^EXIT=0$
99
^SIGNAL=0$
1010
--
1111
^warning: ignoring
12+
--
13+
This is checking that the if statement body can actually be covered with the new flag

0 commit comments

Comments
 (0)