/* 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;
}