Test

Trait Test 

Source
pub trait Test: Sized {
    type Value;

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

    // Provided method
    fn shrink<I: Input>(
        &mut self,
        input: I,
        seed: Option<Seed>,
        options: &Options,
    ) -> Option<Failure<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: Input<Result<bool, PanicError>>>( &mut self, input: &mut T, ) -> Result<bool, PanicError>

Execute one test with the given input

Source

fn generate_value<T: Input<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<I: Input>( &mut self, input: I, seed: Option<Seed>, options: &Options, ) -> Option<Failure<Self::Value>>

Shrink the input to a simpler form

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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: IntoResult, G::Output: Debug,

Source§

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

Source§

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

Source§

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

Source§

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