pub fn arbitrary<T>() -> ArbitraryStrategy<T>where
T: Arbitrary,Expand description
Bridges a quickcheck::Arbitrary type into the seam as a Strategy<T>.
Use it anywhere a strategy is expected:
use test_better_core::TestResult;
use test_better_matchers::{expect, lt};
use test_better_property::{arbitrary, check};
// A `u8` is `quickcheck::Arbitrary`; doubling one in `u16` never overflows.
check(arbitrary::<u8>(), |n: u8| {
expect!(u16::from(n) * 2).to(lt(512u16))
})
.map_err(|f| f.failure)?;