Crates.io | cov-mark |
lib.rs | cov-mark |
version | 2.0.0 |
source | src |
created_at | 2020-05-29 12:32:54.932245 |
updated_at | 2024-06-20 09:01:00.15164 |
description | Manual coverage marks. |
homepage | |
repository | https://github.com/matklad/cov-mark |
max_upload_size | |
id | 247352 |
size | 21,485 |
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