Files
heuropt/.cargo/mutants.toml
T
swaits 36e1d9d796 test(mutants): add cargo-mutants config for advisory mutation testing
Adds `.cargo/mutants.toml` configuring cargo-mutants to focus on the
algorithmic core (skipping benches, examples, tests_support) and pass
`--test-tool=cargo --no-shuffle` so a mutation that breaks the suite
gets caught quickly.

Mutation testing modifies the source one operator at a time (`>` →
`>=`, `+` → `-`, `true` → `false`, etc.) and re-runs the test suite.
A mutation that *survives* (tests still pass) is a hint that the test
suite isn't checking that bit of behavior — usually because:
- The mutated branch is dead code
- The unit tests rely on side-effects rather than return values
- A property test or invariant is missing

Not wired into CI as a gating check (it's slow — every mutation
re-runs the whole suite). Run locally with `cargo install cargo-mutants`
followed by `cargo mutants --in-diff HEAD~1` for incremental coverage,
or `cargo mutants` for a full sweep.

The config exclusions list explains *why* each module is skipped — most
are the "obvious" kind (benchmark harness, example problems) where
mutation kills are not informative.
2026-05-05 10:39:32 -06:00

34 lines
1.2 KiB
TOML

# cargo-mutants configuration for heuropt.
#
# Run with:
# cargo install cargo-mutants
# cargo mutants # full sweep (slow)
# cargo mutants --in-diff HEAD~1 # only mutate recently-changed lines
#
# A *surviving* mutation = the test suite passed despite a code change,
# which usually means a missing test or a missing invariant.
#
# This isn't gated CI; it's an advisory tool. The property tests in
# tests/properties.rs are the natural place to land new invariants
# discovered via mutation runs.
# Files to skip mutating. We skip:
# - examples (illustrative, not core algorithm correctness)
# - benches (microbench harness, not behavior)
# - the docs/* spec markdown
# - tests_support (test helpers; mutating them changes test inputs,
# not behavior under test)
exclude_globs = [
"examples/**/*.rs",
"benches/**/*.rs",
"src/tests_support/**/*.rs",
]
# `cargo-mutants` defaults to `cargo test` for the suite. Keep that.
# `--no-shuffle` makes failure attribution deterministic.
additional_cargo_test_args = ["--", "--test-threads=1"]
# Time-out per mutated build+test cycle. Big enough for a slow test
# (proptest can take ~10s) but short enough to detect infinite loops.
timeout_multiplier = 5.0