-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
- Loading branch information
1 parent
62bdf68
commit 468c9ab
Showing
12 changed files
with
87 additions
and
11 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
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
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
1 change: 1 addition & 0 deletions
1
tests/expected/function-contract/modifies/check_only_verification.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 @@ | ||
VERIFICATION:- SUCCESSFUL |
34 changes: 34 additions & 0 deletions
34
tests/expected/function-contract/modifies/check_only_verification.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,34 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// kani-flags: -Zfunction-contracts | ||
|
||
//! Check that Kani does not report any error when unused modifies clauses | ||
//! includes objects of types that do not implement `kani::Arbitrary`. | ||
|
||
#[kani::requires(*ptr < 100)] | ||
#[kani::modifies(ptr)] | ||
#[kani::ensures(result == 100)] | ||
fn modify(ptr: &mut u32) -> u32 { | ||
*ptr += 1; | ||
*ptr | ||
} | ||
|
||
#[kani::requires(*ptr < 100)] | ||
#[kani::modifies(ptr)] | ||
fn wrong_modify(ptr: &mut u32) -> &'static str { | ||
*ptr += 1; | ||
let msg: &'static str = "done"; | ||
msg | ||
} | ||
|
||
fn use_modify(ptr: &mut u32) { | ||
*ptr = 99; | ||
assert!(modify(ptr) == 100); | ||
} | ||
|
||
#[kani::proof] | ||
#[kani::stub_verified(modify)] | ||
fn harness() { | ||
let mut i = kani::any_where(|x| *x < 100); | ||
use_modify(&mut i); | ||
} |
3 changes: 1 addition & 2 deletions
3
tests/expected/function-contract/modifies/mistake_condition_return.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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
Failed Checks: assertion failed: res == 100 \ | ||
File: "mistake_condition_return.rs", line 31, in use_modify \ | ||
Failed Checks: assertion failed: res == 100 | ||
|
||
VERIFICATION:- FAILED |