← Back to Report
● FULL ◐ PARTIAL ○ NONE
simple_if.c
📄 tests/examples/simple_if.c
1/*
2 * simple_if.c — Minimal example for the C Testing Coverage Tool smoke test.
3 *
4 * This file contains 2 branch constructs = 4 branches total.
5 * A complete test suite should cover all 4 branches (100%).
6 *
7 * Build and run via:
8 * bash smoke_test.sh
9 */
10#include <stdio.h>
11extern int __VERIFIER_nondet_int(void);
12
13int main(void) {
14 int x = __VERIFIER_nondet_int();
15
16 /* Branch 1: true = x > 0, false = x <= 0 */
17 if (x > 0) {●FULL
18 printf("positive\n");
19 } else {
20 printf("non-positive\n");
21 }
22
23 /* Branch 2: true = even, false = odd */
24 if (x % 2 == 0) {●FULL
25 printf("even\n");
26 } else {
27 printf("odd\n");
28 }
29
30 return 0;
31}