Artifact 4582ba90344f8d337deb9974c1c10b7ab40692be388055dd31f7cc14958a3113:
- File
test/probes/mcdc.c
— part of check-in
[11f47eadde]
at
2026-11-18 11:58:22
on branch trunk
— Record S0/S1 qualification groundwork before product code
Contract maps and pinned Pi reference, local C qualification fixtures, MC/DC and Fil-C remote lifecycle tooling, and the context transaction substrate probe. No product harness code yet. (user: dmestas, size: 1410) [annotate] [blame] [check-ins using]
/* Bounded MC/DC probe for the S0 toolchain gate. * * Two compound safety-style decisions, three conditions each. The complete * vector set exercises every condition independently under masking MC/DC. * Building with -DPROBE_OMIT_VECTORS=1 keeps both decisions reachable but drops * the independence pairs, so a real coverage report shows incomplete condition * coverage and the gate must reject it. */ #include <stdio.h> #ifndef PROBE_OMIT_VECTORS #define PROBE_OMIT_VECTORS 0 #endif static int accept_all(int a, int b, int c) { if (a > 0 && b > 0 && c > 0) { /* decision 1 */ return 1; } return 0; } static int accept_either(int a, int b, int c) { if (a > 0 || (b > 0 && c > 0)) { /* decision 2, nested grouping */ return 1; } return 0; } int main(void) { static const int complete[][3] = {{1, 1, 1}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}, {0, 0, 1}, {0, 1, 0}}; static const int reduced[][3] = {{1, 1, 1}, {0, 0, 0}}; const int(*vectors)[3] = PROBE_OMIT_VECTORS ? reduced : complete; unsigned n = PROBE_OMIT_VECTORS ? 2u : 6u; unsigned long hits = 0; for (unsigned i = 0; i < n; i++) { hits += (unsigned)accept_all(vectors[i][0], vectors[i][1], vectors[i][2]); hits += (unsigned)accept_either(vectors[i][0], vectors[i][1], vectors[i][2]); } printf("vectors=%u hits=%lu\n", n, hits); return hits == 0 ? 3 : 0; }