forked from rust-lang/rust
-
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.
Report CBMC verification time (rust-lang#1247)
- Loading branch information
1 parent
dcb2992
commit adebe36
Showing
3 changed files
with
27 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
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 @@ | ||
Verification Time: |
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,22 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
// This test is meant for checking that the "Verification time:" line (which | ||
// reports the time spent in CBMC) is printed in the output | ||
|
||
fn is_sorted(s: &[i32]) -> bool { | ||
for i in 0..s.len() - 1 { | ||
if !(s[i] <= s[i + 1]) { | ||
return false; | ||
} | ||
} | ||
true | ||
} | ||
|
||
#[kani::proof] | ||
#[kani::unwind(6)] | ||
fn check_sorted() { | ||
let mut arr: [i32; 5] = kani::any(); | ||
arr.sort(); | ||
assert!(is_sorted(&arr)); | ||
} |