Skip to main content

any

Function any 

Source
pub fn any<T>() -> impl Strategy<T>
where T: Arbitrary,
Expand description

The default Strategy for a type: proptest’s any::<T>(), surfaced through the seam.

This is what property! uses when the closure binding has a type annotation and no using clause. It is available for direct use too: for_all(any::<u32>(), |n| ...) is the same as naming the u32 strategy inline. The quickcheck counterpart is arbitrary.

use test_better_core::TestResult;
use test_better_matchers::{check, ge};
use test_better_property::{any, for_all};

for_all(any::<u8>(), |n: u8| check!(u16::from(n)).satisfies(ge(0u16)))
    .map_err(|f| f.failure)?;