-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow multiple
stub_verified
s on a single harness
- Loading branch information
1 parent
7913e3c
commit 85f9129
Showing
3 changed files
with
42 additions
and
5 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
13 changes: 13 additions & 0 deletions
13
tests/expected/function-contract/simple_replace_multiple_pass.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,13 @@ | ||
.assertion\ | ||
- Status: SUCCESS\ | ||
- Description: "divisor != 0" | ||
|
||
.assertion\ | ||
- Status: SUCCESS\ | ||
- Description: "a >= b" | ||
|
||
main.assertion\ | ||
- Status: SUCCESS\ | ||
- Description: ""contract guarantees smallness"" | ||
|
||
VERIFICATION:- SUCCESSFUL |
22 changes: 22 additions & 0 deletions
22
tests/expected/function-contract/simple_replace_multiple_pass.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,22 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// kani-flags: -Zfunction-contracts | ||
|
||
#[kani::requires(divisor != 0)] | ||
#[kani::ensures(|result : &u32| *result <= dividend)] | ||
fn div(dividend: u32, divisor: u32) -> u32 { | ||
dividend / divisor | ||
} | ||
|
||
#[kani::requires(a >= b)] | ||
#[kani::ensures(|result : &u32| *result <= a)] | ||
fn sub(a: u32, b: u32) -> u32 { | ||
a - b | ||
} | ||
|
||
#[kani::proof] | ||
#[kani::stub_verified(div)] | ||
#[kani::stub_verified(sub)] | ||
fn main() { | ||
assert!(div(sub(9, 1), 1) != 10, "contract guarantees smallness"); | ||
} |