| 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.
|
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 | 3 | function2(); | ||
| 33 | 3 | } else { | ||
| 34 | 9 | function1(); | ||
| 35 | } | |||
| 36 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
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/8✗ 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.
|
12 | if (((function1() == 1) || (function2()==1)) && ((function1() != 1) && (function2()!=1))) { | |
| 45 | // never called | |||
| 46 | ✗ | function2(); | ||
| 47 | ✗ | } | ||
| 48 | 12 | } | ||
| 49 | 6 | } | ||
| 50 | ||||
| 51 | 3 | return 0; | ||
| 52 | } | |||
| 53 |