A minimal demo of Mull mutation testing, based on the Quick Primer.
range_tests.c implements a (buggy) in_range function that checks whether a value falls within a closed interval [min, max], along with three assertions that serve as its test suite:
int in_range(int value, int min, int max) {
return value >= min && value < max;
}The tests cover below-min, mid-range, and above-max cases — achieving 100% line coverage. Despite this, Mull reveals that two mutations survive:
>=changed to>(the boundary atminis not tested)<changed to<=(the boundary atmaxis not tested)
This demonstrates a core limitation of coverage-based testing: coverage does not guarantee that the tests actually validate the semantics of the code.
Install mull (see installation docs), then:
clang-22 \
-fpass-plugin=/usr/lib/mull-ir-frontend-22 \
-g -grecord-command-line \
range_tests.c -o range_tests
mull-runner-22 range_tests