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
Matias Scharager
committed
Jun 28, 2024
1 parent
5a6a5f3
commit d0efa5d
Showing
5 changed files
with
51 additions
and
4 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
6 changes: 6 additions & 0 deletions
6
tests/expected/function-contract/simple_ensures_pass_no_annotation.expected
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,6 @@ | ||
assertion\ | ||
- Status: SUCCESS\ | ||
- Description: "|result| (*result == x) | (*result == y)"\ | ||
in function max | ||
|
||
VERIFICATION:- SUCCESSFUL |
14 changes: 14 additions & 0 deletions
14
tests/expected/function-contract/simple_ensures_pass_no_annotation.rs
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,14 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// kani-flags: -Zfunction-contracts | ||
|
||
#[kani::ensures(|result| (*result == x) | (*result == y))] | ||
fn max(x: u32, y: u32) -> u32 { | ||
if x > y { x } else { y } | ||
} | ||
|
||
#[kani::proof_for_contract(max)] | ||
fn max_harness() { | ||
let _ = Box::new(9_usize); | ||
max(7, 6); | ||
} |