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 25, 2024
1 parent
33be618
commit 3437710
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
tests/expected/function-contract/modifies_slice/nondeterministic_size.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,5 @@ | ||
assertion\ | ||
- Status: SUCCESS\ | ||
- Description: "|_| x.into_iter().map(|v| *v == 0).fold(true,|a,b|a&b)"\ | ||
|
||
VERIFICATION:- SUCCESSFUL |
17 changes: 17 additions & 0 deletions
17
tests/expected/function-contract/modifies_slice/nondeterministic_size.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,17 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// kani-flags: -Zfunction-contracts | ||
|
||
// Test that modifies a slice of nondeterministic size | ||
|
||
#[kani::modifies(x)] | ||
#[kani::ensures(|_| x.into_iter().map(|v| *v == 0).fold(true,|a,b|a&b))] | ||
fn zero(x: &mut [u8]) { | ||
x.fill(0) | ||
} | ||
|
||
#[kani::proof_for_contract(zero)] | ||
fn harness() { | ||
let mut x = [0..kani::any()].map(|_| kani::any()); | ||
zero(&mut x); | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/expected/function-contract/modifies_slice/u8slice.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,5 @@ | ||
assertion\ | ||
- Status: SUCCESS\ | ||
- Description: "|_| x.into_iter().map(|v| *v == 0).fold(true,|a,b|a&b)"\ | ||
|
||
VERIFICATION:- SUCCESSFUL |
17 changes: 17 additions & 0 deletions
17
tests/expected/function-contract/modifies_slice/u8slice.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,17 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// kani-flags: -Zfunction-contracts | ||
|
||
// Test that modifies a slice containing bytesize data | ||
|
||
#[kani::modifies(x)] | ||
#[kani::ensures(|_| x.into_iter().map(|v| *v == 0).fold(true,|a,b|a&b))] | ||
fn zero(x: &mut [u8]) { | ||
x.fill(0) | ||
} | ||
|
||
#[kani::proof_for_contract(zero)] | ||
fn harness() { | ||
let mut x = [kani::any(), kani::any(), kani::any()]; | ||
zero(&mut x); | ||
} |