pub fn test_coverage_percent(covered: f64, total: f64) -> Option<f64>Expand description
Test coverage as a percentage: covered lines (or branches) / total × 100.
Coverage measures whether code executed during a test run, not whether
the test meaningfully verified its behaviour. Use it to find untested
code (a floor), not as a ceiling to maximize; pair it with
mutation_kill_rate_percent to check that the covered code is actually
being verified.
§Arguments
covered— lines, branches, or paths executed by the test suite.total— total lines, branches, or paths in the measured code.
§Returns
Some(percentage) (e.g. 95.0 for 95%), or None when total is zero
(coverage undefined — there is no code to cover).
§Examples
use software_engineering::test_effectiveness::test_coverage_percent;
// A company-wide 95% coverage requirement, met at face value.
assert_eq!(test_coverage_percent(95.0, 100.0), Some(95.0));
assert_eq!(test_coverage_percent(1.0, 0.0), None);