forked from project-oak/rust-verification-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a prelude to verification-annotations to make it easier to import. Added verifier module, that re-exports klee/seahorn, and moved shared code from those modules to verifier. Reimplemented verifier_nondet_bytes (not using klee_make_symbolic anymore). Added a string module to propverify with strategies for generating an arbitrary string with `n` bytes (doesn't work very well), and ascii string with `n` bytes (works quite well with Klee). Added demo/simple/string to test the new string module.
- Loading branch information
Showing
20 changed files
with
338 additions
and
279 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,22 @@ | ||
[package] | ||
name = "string" | ||
version = "0.1.0" | ||
authors = ["Shaked Flur <[email protected]>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
regex = "1" | ||
|
||
[target.'cfg(verify)'.dependencies] | ||
propverify = { path="/home/rust-verification-tools/propverify" } | ||
verification-annotations = { path = "/home/rust-verification-tools/verification-annotations" } | ||
|
||
[target.'cfg(not(verify))'.dependencies] | ||
proptest = { version = "*" } | ||
|
||
[features] | ||
verifier-klee = ["propverify/verifier-klee", "verification-annotations/verifier-klee"] | ||
verifier-crux = ["propverify/verifier-crux"] | ||
verifier-seahorn = ["propverify/verifier-seahorn"] |
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,38 @@ | ||
#[cfg(not(verify))] | ||
use proptest::prelude::*; | ||
#[cfg(verify)] | ||
use propverify::prelude::*; | ||
|
||
use regex::Regex; | ||
|
||
proptest! { | ||
#[test] | ||
// Construct an arbitrary (utf8) string from 3 bytes. | ||
// Klee can only handle a small number of bytes in this case. | ||
fn string(s in prop::string::arbitrary(3)) { | ||
let re = Regex::new(r"^a").unwrap(); | ||
prop_assume!(re.is_match(&s)); | ||
prop_assert!(s.starts_with('a')); | ||
} | ||
} | ||
|
||
proptest! { | ||
#[test] | ||
// Construct a (utf8) string from 100 bytes, restricted to ascii chars. | ||
// Klee can handle much more bytes this way. | ||
fn ascii_string(s in prop::string::arbitrary_ascii(100)) { | ||
let re = Regex::new(r"^a").unwrap(); | ||
prop_assume!(re.is_match(&s)); | ||
prop_assert!(s.starts_with('a')); | ||
} | ||
} | ||
|
||
proptest! { | ||
#[test] | ||
#[should_panic] | ||
fn string_add(s1 in prop::string::arbitrary_ascii(200), s2 in prop::string::arbitrary_ascii(200)) { | ||
let s = s1 + &s2; | ||
let s: String = s.chars().rev().collect(); | ||
prop_assert!(s.len() == 200); | ||
} | ||
} |
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
Oops, something went wrong.