GCC Code Coverage Report


Directory: .
File: main.c
Date: 2025-09-27 21:24:05+00:00
Coverage Exec Excl Total
Lines: 72.7% 24 0 33
Functions: 75.0% 3 0 4
Branches: 62.5% 10 0 16
Calls: -% 0 0 0

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