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