GCC Code Coverage Report


Directory: .
File: main.c
Date: 0000-00-00 00:00:00
Exec Total Coverage
Lines: 22 28 78.6%
Functions: 3 4 75.0%
Branches: 13 22 59.1%
Calls: 9 16 56.2%

Line Branch Call Exec Source
1 #include <stdio.h>
2
3 33 int function1(void)
4 {
5
1/1
✓ Call 0 invoked.
33 printf("Inside function()/n");
6 33 return 1;
7 }
8
9 27 int function2(void)
10 {
11
1/1
✓ Call 0 invoked.
27 printf("Inside function2()/n");
12 27 return 1;
13 }
14
15 int function3(int a)
16 {
17
0/1
✗ Call 0 not invoked.
printf("Inside function3()/n");
18 return 1;
19 }
20
21 3 int main(int argc, char **argv)
22 {
23
1/1
✓ Call 0 invoked.
3 printf("test/n");
24 3 int a = 0;
25 3 int b = 0;
26 3 int c = 0;
27
28
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
9 for (a = 0; a < 2; a++) {
29
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
18 for (b= 0; b < 2; b++) {
30 12 c = 0;
31
5/6
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
12 if (a > 0 && b > 0 || c > 0) {
32
1/1
✓ Call 0 invoked.
3 function2();
33 } else {
34
1/1
✓ Call 0 invoked.
9 function1();
35 }
36
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 if (c > 0) {
37 // Never called
38
0/2
✗ Call 0 not invoked.
✗ Call 1 not invoked.
function3(function2());
39
0/1
✗ Call 0 not invoked.
function2();
40 }
41
1/1
✓ Call 0 invoked.
12 function2();
42
1/1
✓ Call 0 invoked.
12 function2();
43 // called not called called not called
44
3/10
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 12 times.
2/4
✓ Call 0 invoked.
✗ Call 3 not invoked.
✓ Call 6 invoked.
✗ Call 9 not invoked.
12 if (((function1() == 1) || (function2()==1)) && ((function1() != 1) && (function2()!=1))) {
45 // never called
46
0/1
✗ Call 0 not invoked.
function2();
47 }
48 }
49 }
50
51 3 return 0;
52 }
53