Skip to content

Commit

Permalink
Add back test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhassan-aws committed Oct 1, 2024
1 parent 040ab6f commit b751ad8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/cargo-kani/mir-linker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT
[package]
name = "mir-linker"
version = "0.1.0"
edition = "2021"
description = "Ensures that the mir-linker works accross crates"

[dependencies]
semver = "1.0"
3 changes: 3 additions & 0 deletions tests/cargo-kani/mir-linker/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Status: SUCCESS\
Next is greater\
in function check_version
29 changes: 29 additions & 0 deletions tests/cargo-kani/mir-linker/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Dummy test to check --mir-linker runs on a cargo project.
use semver::{BuildMetadata, Prerelease, Version};

#[kani::proof]
fn check_version() {
let next_major: u64 = kani::any();
let next_minor: u64 = kani::any();
kani::assume(next_major != 0 || next_minor != 0);

// Check whether this requirement matches version 1.2.3-alpha.1 (no)
let v0 = Version {
major: 0,
minor: 0,
patch: 0,
pre: Prerelease::EMPTY,
build: BuildMetadata::EMPTY,
};
let next = Version {
major: next_major,
minor: next_minor,
patch: 0,
pre: Prerelease::EMPTY,
build: BuildMetadata::EMPTY,
};
assert!(next > v0, "Next is greater");
}

0 comments on commit b751ad8

Please sign in to comment.