Skip to content

Commit 4eea798

Browse files
danielsntedinski
authored andcommitted
Add tests for issues rust-lang#763 and rust-lang#702 (rust-lang#812)
1 parent 726bd2d commit 4eea798

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/kani/Vectors/fixme_702.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Failing example from https://github.com/model-checking/kani/issues/702
5+
// Push 5 elements to force the vector to resize, then check that the values were correctly copied.
6+
fn main() {
7+
let mut v = Vec::new();
8+
v.push(72);
9+
v.push(2);
10+
v.push(3);
11+
v.push(4);
12+
v.push(5);
13+
assert!(v[0] == 72);
14+
assert!(v[1] == 2);
15+
assert!(v[2] == 3);
16+
assert!(v[3] == 4);
17+
assert!(v[4] == 5);
18+
}

tests/kani/Vectors/fixme_763.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Failing example from https://github.com/model-checking/kani/issues/763
5+
fn main() {
6+
let x = Vec::<i32>::new();
7+
for i in x {}
8+
}

0 commit comments

Comments
 (0)