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.
- Loading branch information
1 parent
9a227cb
commit e08c8b4
Showing
6 changed files
with
46 additions
and
35 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
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
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,32 @@ | ||
## Coverage | ||
|
||
Recall our `estimate_size` example from [First steps](../tutorial-first-steps.md), | ||
where we wrote a proof harness constraining the range of inputs to integers less than 4096: | ||
|
||
```rust | ||
{{#include ../../tutorial/first-steps-v2/src/lib.rs:kani}} | ||
``` | ||
|
||
We must wonder if we've really fully tested our function. | ||
What if we revise the function, but forget to update the assumption in our proof harness to cover the new range of inputs? | ||
|
||
Fortunately, Kani is able to report a coverage metric for each proof harness. | ||
In the `first-steps-v2` directory, try running: | ||
|
||
``` | ||
cargo kani --coverage -Z line-coverage --harness verify_success | ||
``` | ||
|
||
which verifies the harness, then prints coverage information for each line. | ||
In this case, we see that each line of `estimate_size` is followed by `FULL`, indicating that our proof harness provides full coverage. | ||
|
||
Try changing the assumption in the proof harness to `x < 2048`. | ||
Now the harness won't be testing all possible cases. | ||
Rerun the command. | ||
You'll see this line: | ||
|
||
``` | ||
src/lib.rs, 24, NONE | ||
``` | ||
|
||
which indicates that the proof no longer covers line 24, which addresses the case where `x >= 2048`. |
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,5 @@ | ||
# Experimental Features | ||
|
||
We elaborate on some of the more commonly used experimental features in Kani. | ||
This is not an exhaustive list; to see all of Kani's experimental features, run `cargo kani --help`. | ||
To use an experimental feature, invoke Kani with the `--unstable` or `-Z` flag followed by the name of the feature. |
File renamed without changes.
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