tree: ca557b92c89bc726957368b40ada0313114b443c [path history] [tgz]
  1. src/
  2. tests/
  3. .android-checksum.json
  4. .cargo-checksum.json
  5. .cargo_vcs_info.json
  6. Android.bp
  7. Cargo.lock
  8. Cargo.toml
  9. Cargo.toml.orig
  10. cargo_embargo.json
  11. LICENSE-APACHE
  12. METADATA
  13. MODULE_LICENSE_APACHE2
  14. README.md
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