Trait bolero_engine::Test

source ·
pub trait Test: Sized {
    type Value;

    // Required methods
    fn test<T: TestInput<Result<bool, PanicError>>>(
        &mut self,
        input: &mut T
    ) -> Result<bool, PanicError>;
    fn generate_value<T: TestInput<Self::Value>>(
        &self,
        input: &mut T
    ) -> Self::Value;

    // Provided method
    fn shrink(
        &mut self,
        input: Vec<u8>,
        seed: Option<u64>,
        options: &Options
    ) -> Option<TestFailure<Self::Value>> { ... }
}
Expand description

Trait for defining a test case

Required Associated Types§

source

type Value

The input value for the test case

Required Methods§

source

fn test<T: TestInput<Result<bool, PanicError>>>( &mut self, input: &mut T ) -> Result<bool, PanicError>

Execute one test with the given input

source

fn generate_value<T: TestInput<Self::Value>>( &self, input: &mut T ) -> Self::Value

Generate a value for the given input.

Note: this is used for printing the value related to a test failure

Provided Methods§

source

fn shrink( &mut self, input: Vec<u8>, seed: Option<u64>, options: &Options ) -> Option<TestFailure<Self::Value>>

Shrink the input to a simpler form

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<F: RefUnwindSafe + FnMut(&G::Output) -> Ret, G: ValueGenerator, Ret> Test for BorrowedGeneratorTest<F, G, G::Output>
where Ret: IntoTestResult, G::Output: Debug,

source§

impl<F: RefUnwindSafe + FnMut(&[u8]) -> Ret, Ret> Test for BorrowedSliceTest<F>
where Ret: IntoTestResult,

source§

impl<F: RefUnwindSafe + FnMut(&[u8]) -> Ret, Ret> Test for F
where Ret: IntoTestResult,

source§

impl<F: RefUnwindSafe + FnMut(Vec<u8>) -> Ret, Ret> Test for ClonedSliceTest<F>
where Ret: IntoTestResult,

source§

impl<F: RefUnwindSafe + FnMut(G::Output) -> Ret, G: ValueGenerator, Ret> Test for ClonedGeneratorTest<F, G, G::Output>
where Ret: IntoTestResult, G::Output: Debug + Clone,