Skip to content

matklad/cov-mark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 20, 2024
930df73 · Jun 20, 2024

History

25 Commits
Jun 20, 2024
Jun 19, 2024
Jun 12, 2021
Jun 20, 2024
Aug 28, 2020
Jun 20, 2024
May 29, 2020
May 29, 2020
May 29, 2020

Repository files navigation

cov-mark

Verify that your tests exercise the conditions you think they are exercising

fn safe_divide(dividend: u32, divisor: u32) -> u32 {
    if divisor == 0 {
        cov_mark::hit!(save_divide_zero);
        return 0;
    }
    dividend / divisor
}

#[test]
fn test_safe_divide_by_zero() {
    cov_mark::check!(save_divide_zero);
    assert_eq!(safe_divide(92, 0), 0);
}

See the docs for details