Skip to content

Commit 1905908

Browse files
committed
Add tests
1 parent cb2a6a4 commit 1905908

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright Kani Contributors
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
//! This test makes sure Kani uses its hook for align_offset.
5+
6+
#[kani::proof]
7+
fn align_offset() {
8+
let x = 10;
9+
let ptr = &x as *const i32;
10+
let alignment = ptr.align_offset(1);
11+
assert_eq!(alignment, usize::MAX);
12+
}

tests/kani/Strings/2363.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright Kani Contributors
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
//! This test is to check that we have addressed the performance issue called out in
5+
//! https://github.com/model-checking/kani/issues/2363.
6+
7+
#[kani::proof]
8+
#[kani::unwind(7)]
9+
#[kani::solver(cadical)]
10+
fn main() {
11+
let s = "Mary had a little lamb";
12+
let v: Vec<&str> = s.split(' ').collect();
13+
assert_eq!(v, ["Mary", "had", "a", "little", "lamb"]);
14+
}

0 commit comments

Comments
 (0)