Struct bolero::TestTarget [−][src]
pub struct TestTarget<Generator, Engine, InputOwnership> { /* fields omitted */ }
Expand description
Configuration for a test target
Implementations
Create a TestTarget
with the given Engine
pub fn with_generator<Generator: ValueGenerator>(
self,
generator: Generator
) -> TestTarget<Generator, Engine, InputOwnership> where
Generator::Output: Debug,
pub fn with_generator<Generator: ValueGenerator>(
self,
generator: Generator
) -> TestTarget<Generator, Engine, InputOwnership> where
Generator::Output: Debug,
Set the value generator for the TestTarget
The function with_generator::<Generator>(generator)
will use the provided Generator
,
which implements generator::ValueGenerator
, to generate input
values of type Generator::Output
.
This mode is used for testing an implementation that requires structured input with specific constraints applied to the type.
pub fn with_type<T: Debug + TypeGenerator>(
self
) -> TestTarget<TypeValueGenerator<T>, Engine, InputOwnership>
pub fn with_type<T: Debug + TypeGenerator>(
self
) -> TestTarget<TypeValueGenerator<T>, Engine, InputOwnership>
Set the type generator for the TestTarget
Calling with_type::<Type>()
will generate random values of Type
to be tested. Type
is required to implement generator::TypeGenerator
in order to use this method.
This mode is used for testing an implementation that requires structured input.
pub fn map<F: Fn(G::Output) -> T, T: Debug>(
self,
map: F
) -> TestTarget<MapGenerator<G, F>, Engine, InputOwnership>
pub fn map<F: Fn(G::Output) -> T, T: Debug>(
self,
map: F
) -> TestTarget<MapGenerator<G, F>, Engine, InputOwnership>
Map the value of the generator
pub fn and_then<F: Fn(G::Output) -> T, T: ValueGenerator>(
self,
map: F
) -> TestTarget<AndThenGenerator<G, F>, Engine, InputOwnership> where
T::Output: Debug,
pub fn and_then<F: Fn(G::Output) -> T, T: ValueGenerator>(
self,
map: F
) -> TestTarget<AndThenGenerator<G, F>, Engine, InputOwnership> where
T::Output: Debug,
Map the value of the generator with a new generator
pub fn filter<F: Fn(&G::Output) -> bool>(
self,
filter: F
) -> TestTarget<FilterGenerator<G, F>, Engine, InputOwnership>
pub fn filter<F: Fn(&G::Output) -> bool>(
self,
filter: F
) -> TestTarget<FilterGenerator<G, F>, Engine, InputOwnership>
Filter the value of the generator
pub fn filter_map<F: Fn(G::Output) -> Option<T>, T>(
self,
filter_map: F
) -> TestTarget<FilterMapGenerator<G, F>, Engine, InputOwnership>
pub fn filter_map<F: Fn(G::Output) -> Option<T>, T>(
self,
filter_map: F
) -> TestTarget<FilterMapGenerator<G, F>, Engine, InputOwnership>
Filter the value of the generator and map it to something else
Set the driver mode for the test target
Set the number of iterations executed
Set the maximum length of the generated bytes
Use a cloned value for the test input
Cloning the test inputs will force a call to Clone::clone
on each input value, and therefore, will be less
efficient than using a reference.
pub fn for_each<F>(self, test: F) -> E::Output where
E: Engine<BorrowedGeneratorTest<F, G, G::Output>>,
BorrowedGeneratorTest<F, G, G::Output>: Test,
pub fn for_each<F>(self, test: F) -> E::Output where
E: Engine<BorrowedGeneratorTest<F, G, G::Output>>,
BorrowedGeneratorTest<F, G, G::Output>: Test,
Iterate over all of the inputs and check the TestTarget
pub fn for_each<F>(self, test: F) -> E::Output where
E: Engine<ClonedGeneratorTest<F, G, G::Output>>,
ClonedGeneratorTest<F, G, G::Output>: Test,
pub fn for_each<F>(self, test: F) -> E::Output where
E: Engine<ClonedGeneratorTest<F, G, G::Output>>,
ClonedGeneratorTest<F, G, G::Output>: Test,
Iterate over all of the inputs and check the TestTarget
pub fn for_each<T>(self, test: T) -> E::Output where
E: Engine<BorrowedSliceTest<T>>,
BorrowedSliceTest<T>: Test,
pub fn for_each<T>(self, test: T) -> E::Output where
E: Engine<BorrowedSliceTest<T>>,
BorrowedSliceTest<T>: Test,
Iterate over all of the inputs and check the TestTarget
pub fn for_each<T>(self, test: T) -> E::Output where
E: Engine<ClonedSliceTest<T>>,
ClonedSliceTest<T>: Test,
pub fn for_each<T>(self, test: T) -> E::Output where
E: Engine<ClonedSliceTest<T>>,
ClonedSliceTest<T>: Test,
Iterate over all of the inputs and check the TestTarget