Skip to content

Commit

Permalink
Add test for saving coverage results
Browse files Browse the repository at this point in the history
  • Loading branch information
adpaco-aws committed Aug 15, 2024
1 parent 9620601 commit 8511087
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/ui/save-coverage-results/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Source-based code coverage results:

[info] Coverage results saved to
29 changes: 29 additions & 0 deletions tests/ui/save-coverage-results/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: --coverage -Zsource-coverage

//! Checks that we print a line which points the user to the path where coverage
//! results have been saved. The line should look like:
//! ```
//! [info] Coverage results saved to /path/to/outdir/kanicov_YYYY-MM-DD_hh-mm
//! ```
fn _other_function() {
println!("Hello, world!");
}

fn test_cov(val: u32) -> bool {
if val < 3 || val == 42 {
true
} else {
false
}
}

#[cfg_attr(kani, kani::proof)]
fn main() {
let test1 = test_cov(1);
let test2 = test_cov(2);
assert!(test1);
assert!(test2);
}

0 comments on commit 8511087

Please sign in to comment.