Struct proptest::test_runner::TestRunner
[−]
[src]
pub struct TestRunner { /* fields omitted */ }
State used when running a proptest test.
Methods
impl TestRunner
[src]
fn new(config: Config) -> Self
[src]
Create a fresh TestRunner
with the given configuration.
fn rng(&mut self) -> &mut XorShiftRng
[src]
Returns the RNG for this test run.
fn new_rng(&mut self) -> XorShiftRng
[src]
Create a new, independent but deterministic RNG from the RNG in this runner.
fn config(&self) -> &Config
[src]
Returns the configuration of this runner.
fn set_source_file(&mut self, source: &'static Path)
[src]
Set the source file to use for resolving the location of the persisted failing cases file.
The source location can only be used if it is absolute. If source
is
not an absolute path, an attempt will be made to determine the absolute
path based on the current working directory and its parents. If no
absolute path can be determined, a warning will be printed and proptest
will continue as if this function had never been called.
See FailurePersistence
for details on
how this value is used once it is made absolute.
This is normally called automatically by the proptest!
macro, which
passes file!()
.
fn run<S: Strategy, F: Fn(&ValueFor<S>) -> TestCaseResult>(
&mut self,
strategy: &S,
test: F
) -> Result<(), TestError<ValueFor<S>>>
[src]
&mut self,
strategy: &S,
test: F
) -> Result<(), TestError<ValueFor<S>>>
Run test cases against f
, choosing inputs via strategy
.
If any failure cases occur, try to find a minimal failure case and
report that. If invoking f
panics, the panic is turned into a
TestCaseError::Fail
.
If failure persistence is enabled, all persisted failing cases are tested first. If a later non-persisted case fails, its seed is persisted before returning failure.
Returns success or failure indicating why the test as a whole failed.
fn run_one<V: ValueTree, F: Fn(&V::Value) -> TestCaseResult>(
&mut self,
case: V,
test: F
) -> Result<bool, TestError<V::Value>>
[src]
&mut self,
case: V,
test: F
) -> Result<bool, TestError<V::Value>>
Run one specific test case against this runner.
If the test fails, finds the minimal failing test case. If the test does not fail, returns whether it succeeded or was filtered out.
fn reject_local<R>(&mut self, whence: R) -> Result<(), Reason> where
R: Into<Reason>,
[src]
R: Into<Reason>,
Update the state to account for a local rejection from whence
, and
return Ok
if the caller should keep going or Err
to abort.
fn flat_map_regen(&self) -> bool
[src]
Increment the counter of flat map regenerations and return whether it is still under the configured limit.
Trait Implementations
impl Clone for TestRunner
[src]
fn clone(&self) -> TestRunner
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for TestRunner
[src]
impl Display for TestRunner
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Default for TestRunner
[src]
Equivalent to: TestRunner::default(Config::default())
.