Struct proptest::test_runner::TestRunner [−][src]
pub struct TestRunner { /* fields omitted */ }
State used when running a proptest test.
Methods
impl TestRunner
[src]
impl TestRunner
pub fn new(config: Config) -> Self
[src]
pub fn new(config: Config) -> Self
Create a fresh TestRunner
with the given configuration.
pub fn rng(&mut self) -> &mut TestRng
[src]
pub fn rng(&mut self) -> &mut TestRng
Returns the RNG for this test run.
pub fn new_rng(&mut self) -> TestRng
[src]
pub fn new_rng(&mut self) -> TestRng
Create a new, independent but deterministic RNG from the RNG in this runner.
pub fn config(&self) -> &Config
[src]
pub fn config(&self) -> &Config
Returns the configuration of this runner.
pub fn run<S: Strategy>(
&mut self,
strategy: &S,
test: impl Fn(S::Value) -> TestCaseResult
) -> Result<(), TestError<<S as Strategy>::Value>>
[src]
pub fn run<S: Strategy>(
&mut self,
strategy: &S,
test: impl Fn(S::Value) -> TestCaseResult
) -> Result<(), TestError<<S as Strategy>::Value>>
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.
pub fn run_one<V: ValueTree>(
&mut self,
case: V,
test: impl Fn(V::Value) -> TestCaseResult
) -> Result<bool, TestError<V::Value>>
[src]
pub fn run_one<V: ValueTree>(
&mut self,
case: V,
test: impl Fn(V::Value) -> TestCaseResult
) -> 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.
This does not honour the fork
config, and will not be able to
terminate the run if it runs for longer than timeout
. However, if the
test function returns but took longer than timeout
, the test case
will fail.
pub fn reject_local(
&mut self,
whence: impl Into<Reason>
) -> Result<(), Reason>
[src]
pub fn reject_local(
&mut self,
whence: impl Into<Reason>
) -> Result<(), 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.
pub fn flat_map_regen(&self) -> bool
[src]
pub fn flat_map_regen(&self) -> bool
Increment the counter of flat map regenerations and return whether it is still under the configured limit.
Trait Implementations
impl Clone for TestRunner
[src]
impl Clone for TestRunner
fn clone(&self) -> TestRunner
[src]
fn clone(&self) -> TestRunner
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for TestRunner
[src]
impl Debug for TestRunner
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for TestRunner
[src]
impl Display for TestRunner
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for TestRunner
[src]
impl Default for TestRunner
Equivalent to: TestRunner::new(Config::default())
.
Auto Trait Implementations
impl Send for TestRunner
impl Send for TestRunner
impl Sync for TestRunner
impl Sync for TestRunner