Skip to content

Commit

Permalink
nondeterminstics_size test
Browse files Browse the repository at this point in the history
  • Loading branch information
Matias Scharager committed Jun 24, 2024
1 parent 1484c65 commit e04f299
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
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
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_slice(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 main() {
let mut x = [0..kani::any()].map(|_|kani::any());
zero(&mut x);
}

0 comments on commit e04f299

Please sign in to comment.