scirs2_core/testing/
propertybased.rs1#[cfg(feature = "testing")]
4use quickcheck::{Arbitrary, Gen, QuickCheck};
5
6pub struct PropertyTestConfig {
8 pub tests: u64,
9 pub max_size: usize,
10}
11
12impl Default for PropertyTestConfig {
13 fn default() -> Self {
14 Self {
15 tests: 100,
16 max_size: 100,
17 }
18 }
19}
20
21pub fn run_property_test<F, A>(property: F, config: PropertyTestConfig)
23where
24 F: Fn(A) -> bool + quickcheck::Testable,
25 A: Arbitrary + std::fmt::Debug,
26{
27 QuickCheck::new()
28 .tests(config.tests)
29 .max_tests(config.tests)
30 .quickcheck(property);
31}