GCC Code Coverage Report


Directory: .
File: main.c
Date: 2025-09-27 21:24:05+00:00
Coverage Exec Excl Total
Lines: 78.6% 22 0 28
Functions: 75.0% 3 0 4
Branches: 59.1% 13 0 22
Calls: 56.2% 9 0 16

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 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 12 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 12 times.
2/4
✓ Call 0 invoked.
✗ Call 1 not invoked.
✓ Call 2 invoked.
✗ Call 3 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