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
Conditions: 59.1% 13 0 22
Calls: 56.2% 9 0 16

Line Branch Condition 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 31 → 4 taken 6 times.
✓ Branch 31 → 32 taken 3 times.
2/2
✓ Fully covered.
9 for (a = 0; a < 2; a++) {
29
2/2
✓ Branch 29 → 5 taken 12 times.
✓ Branch 29 → 30 taken 6 times.
2/2
✓ Fully covered.
18 for (b= 0; b < 2; b++) {
30 12 c = 0;
31
5/6
✓ Branch 5 → 6 taken 6 times.
✓ Branch 5 → 7 taken 6 times.
✓ Branch 6 → 7 taken 3 times.
✓ Branch 6 → 8 taken 3 times.
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 9 times.
5/6
✓ Condition 0: Fully covered.
✓ Condition 1: Fully covered.
✗ Condition 2: True not covered.
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 10 → 11 not taken.
✓ Branch 10 → 14 taken 12 times.
1/2
✗ True not covered.
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 17 → 18 not taken.
✓ Branch 17 → 20 taken 12 times.
✗ Branch 19 → 20 not taken.
✗ Branch 19 → 25 not taken.
✗ Branch 21 → 22 not taken.
✓ Branch 21 → 25 taken 12 times.
✗ Branch 23 → 24 not taken.
✗ Branch 23 → 25 not taken.
✗ Branch 26 → 27 not taken.
✓ Branch 26 → 28 taken 12 times.
3/10
✗ Condition 0.0: False not covered.
✗ Condition 0.1: Not covered.
✗ Condition 0.2: True not covered.
✗ Condition 0.3: Not covered.
✗ Condition 1: True not covered.
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