Skip to content

Commit

Permalink
Add test for model-checking#1226
Browse files Browse the repository at this point in the history
  • Loading branch information
zhassan-aws committed Dec 8, 2022
1 parent a3fb14c commit 06e0564
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/perf/vec/vec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT

[package]
name = "vec"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
4 changes: 4 additions & 0 deletions tests/perf/vec/vec/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Status: SUCCESS\
Description: "assertion failed: v2 == vec![1]"

VERIFICATION:- SUCCESSFUL
16 changes: 16 additions & 0 deletions tests/perf/vec/vec/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! This test checks the performance of 2d-vectors
//! The test is from https://github.com/model-checking/kani/issues/1226.
//! Pre CBMC 5.72.0, it ran out of memory.
//! With CBMC 5.72.0, it takes ~2 seconds and consumes a few hundred MB of memory.

#[kani::proof]
#[kani::unwind(5)]
fn main() {
let v1: Vec<Vec<i32>> = vec![vec![1], vec![]];

let v2: Vec<i32> = v1.into_iter().flatten().collect();
assert_eq!(v2, vec![1]);
}

0 comments on commit 06e0564

Please sign in to comment.