-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add much higher miri coverage including for proptests.
- Loading branch information
1 parent
1641a9e
commit 423c00a
Showing
21 changed files
with
357 additions
and
234 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#![allow(dead_code, unused_imports)] | ||
|
||
use proptest::prelude::*; | ||
pub(crate) use quickcheck::QuickCheck; | ||
|
||
pub fn default_proptest_config() -> ProptestConfig { | ||
ProptestConfig { | ||
cases: if cfg!(miri) { | ||
10 | ||
} else { | ||
ProptestConfig::default().cases | ||
}, | ||
max_shrink_iters: if cfg!(miri) { | ||
10 | ||
} else { | ||
ProptestConfig::default().max_shrink_iters | ||
}, | ||
failure_persistence: if cfg!(miri) { | ||
None | ||
} else { | ||
ProptestConfig::default().failure_persistence | ||
}, | ||
..ProptestConfig::default() | ||
} | ||
} | ||
|
||
// This is almost identical to quickcheck's itself, just to add default arguments | ||
// https://docs.rs/quickcheck/1.0.3/src/quickcheck/lib.rs.html#43-67 | ||
// The code is unlicensed. | ||
#[macro_export] | ||
macro_rules! default_quickcheck { | ||
(@as_items $($i:item)*) => ($($i)*); | ||
{ | ||
$( | ||
$(#[$m:meta])* | ||
fn $fn_name:ident($($arg_name:ident : $arg_ty:ty),*) -> $ret:ty { | ||
$($code:tt)* | ||
} | ||
)* | ||
} => ( | ||
$crate::default_quickcheck! { | ||
@as_items | ||
$( | ||
#[test] | ||
$(#[$m])* | ||
fn $fn_name() { | ||
fn prop($($arg_name: $arg_ty),*) -> $ret { | ||
$($code)* | ||
} | ||
$crate::util::QuickCheck::new() | ||
.max_tests(if cfg!(miri) { 10 } else { 10_000 }) | ||
.quickcheck(prop as fn($($arg_ty),*) -> $ret); | ||
} | ||
)* | ||
} | ||
) | ||
} |
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.