forked from model-checking/kani
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for saving coverage results
- Loading branch information
1 parent
9620601
commit 8511087
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Source-based code coverage results: | ||
|
||
[info] Coverage results saved to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |