Skip to content

Commit 4af02ce

Browse files
committed
Add tests of multi-line statement coverage
To show that the new updated printing is working correctly.
1 parent 87d73e1 commit 4af02ce

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
*
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <stdlib.h>
2+
3+
int foo(int x, int y)
4+
{
5+
return x;
6+
}
7+
8+
int main()
9+
{
10+
int *ptr = malloc(sizeof(*ptr));
11+
12+
// clang-format off
13+
foo(1,
14+
*ptr);
15+
// clang-format on
16+
17+
if(0)
18+
{
19+
*ptr = 0;
20+
}
21+
22+
return 0;
23+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <stdlib.h>
2+
3+
int foo(int x, int y)
4+
{
5+
return x;
6+
}
7+
8+
int main()
9+
{
10+
int *ptr = malloc(sizeof(*ptr));
11+
12+
// clang-format off
13+
foo(
14+
1,
15+
#include "dereference.h"
16+
ptr);
17+
// clang-format on
18+
19+
if(0)
20+
{
21+
*ptr = 0;
22+
}
23+
24+
return 0;
25+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
multi-file.c
3+
--cover location
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[main.coverage.2\] file multi-file.c line 10 function main block 2 \(lines dereference.h:main:2; multi-file.c:main:10,13,14,16\): SATISFIED
7+
--
8+
^warning: ignoring
9+
--
10+
Test that the lines covered by location coverage in the output include all lines
11+
of a multi-line statement where some of the lines are in an included file.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
example.c
3+
--cover location
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[main.coverage.2\] file example.c line 10 function main block 2 \(lines example.c:main:10,13,14\): SATISFIED$
7+
--
8+
^warning: ignoring
9+
--
10+
Test that the lines covered by location coverage in the output include all lines
11+
of a multi-line statement.

0 commit comments

Comments
 (0)