tree: ceb8d0dc6b12083471d27c1bfc2e8ca2db4c8968 [path history] [tgz]
  1. src/
  2. tests/
  3. .android-checksum.json
  4. .cargo-checksum.json
  5. Android.bp
  6. Cargo.toml
  7. cargo_embargo.json
  8. LICENSE-APACHE
  9. LICENSE-MIT
  10. METADATA
  11. MODULE_LICENSE_APACHE2
  12. README.md
  13. TEST_MAPPING
crates/cov-mark/README.md

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