Import 'cov-mark' crate

Request Document: go/android-rust-importing-crates
For CL Reviewers: go/android3p#cl-review
For Build Team: go/ab-third-party-imports
Bug: 364711528
Test: m libcov_mark
Change-Id: I1c0be9d88fd5fd02600029e211201d9c99059aa6
14 files changed
tree: f5d48020fde7d9d491b40f72d73d46d6a360aee2
  1. src/
  2. tests/
  3. .cargo_vcs_info.json
  4. .gitignore
  5. Android.bp
  6. Cargo.toml
  7. Cargo.toml.orig
  8. cargo_embargo.json
  9. LICENSE-APACHE
  10. METADATA
  11. MODULE_LICENSE_APACHE2
  12. OWNERS
  13. README.md
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