[][src]Struct proptest::test_runner::TestRunner

pub struct TestRunner { /* fields omitted */ }

State used when running a proptest test.

Methods

impl TestRunner[src]

pub fn new(config: Config) -> Self[src]

Create a fresh TestRunner with the given configuration.

The runner will use an RNG with a generated seed and the default algorithm.

In no_std environments, every TestRunner will use the same hard-coded seed. This seed is not contractually guaranteed and may be changed between releases without notice.

pub fn deterministic() -> Self[src]

Create a fresh TestRunner with the standard deterministic RNG.

This is sugar for the following:

let config = Config::default();
let algorithm = config.rng_algorithm;
TestRunner::new_with_rng(
    config,
    TestRng::deterministic_rng(algorithm));

Refer to TestRng::deterministic_rng() for more information on the properties of the RNG used here.

pub fn new_with_rng(config: Config, rng: TestRng) -> Self[src]

Create a fresh TestRunner with the given configuration and RNG.

pub fn rng(&mut self) -> &mut TestRng[src]

Returns the RNG for this test run.

pub fn new_rng(&mut self) -> TestRng[src]

Create a new, independent but deterministic RNG from the RNG in this runner.

pub fn config(&self) -> &Config[src]

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]

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]

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]

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]

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 Debug for TestRunner[src]

impl Default for TestRunner[src]

Equivalent to: TestRunner::new(Config::default()).

impl Display for TestRunner[src]

Auto Trait Implementations

impl !RefUnwindSafe for TestRunner

impl Send for TestRunner

impl Sync for TestRunner

impl Unpin for TestRunner

impl !UnwindSafe for TestRunner

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,