-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This resolves #664. I added an argument to rmc and cargo rmc (--tests) to allow users to target test harnesses as their verification function.
- Loading branch information
Showing
6 changed files
with
68 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
// Check that we can verify test harnesses using the --tests argument. | ||
// Note: We need to provide the compile-flags because compile test runs rustc directly and via rmc. | ||
|
||
// compile-flags: --test | ||
// rmc-flags: --tests --function test_harness | ||
|
||
pub mod my_mod { | ||
pub fn fn_under_verification(a: i32) { | ||
assert!(a > 0); | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use my_mod::fn_under_verification; | ||
|
||
#[test] | ||
#[no_mangle] | ||
fn test_harness() { | ||
let input: i32 = rmc::nondet(); | ||
rmc::assume(input > 1); | ||
fn_under_verification(input); | ||
} | ||
} |