proptest::test_runner

Trait FailurePersistence

Source
pub trait FailurePersistence:
    Send
    + Sync
    + Debug {
    // Required methods
    fn box_clone(&self) -> Box<dyn FailurePersistence>;
    fn eq(&self, other: &dyn FailurePersistence) -> bool;
    fn as_any(&self) -> &dyn Any;

    // Provided methods
    fn load_persisted_failures2(
        &self,
        source_file: Option<&'static str>,
    ) -> Vec<PersistedSeed> { ... }
    fn load_persisted_failures(
        &self,
        source_file: Option<&'static str>,
    ) -> Vec<[u8; 16]> { ... }
    fn save_persisted_failure2(
        &mut self,
        source_file: Option<&'static str>,
        seed: PersistedSeed,
        shrunken_value: &dyn Debug,
    ) { ... }
    fn save_persisted_failure(
        &mut self,
        source_file: Option<&'static str>,
        seed: [u8; 16],
        shrunken_value: &dyn Debug,
    ) { ... }
}
Expand description

Provides external persistence for historical test failures by storing seeds.

Note: Implementing load_persisted_failures and save_persisted_failures is deprecated and these methods will be removed in proptest 0.10.0. Instead, implement load_persisted_failures2 and save_persisted_failures2.

Required Methods§

Source

fn box_clone(&self) -> Box<dyn FailurePersistence>

Delegate method for producing a trait object usable with Clone

Source

fn eq(&self, other: &dyn FailurePersistence) -> bool

Equality testing delegate required due to constraints of trait objects.

Source

fn as_any(&self) -> &dyn Any

Assistant method for trait object comparison.

Provided Methods§

Source

fn load_persisted_failures2( &self, source_file: Option<&'static str>, ) -> Vec<PersistedSeed>

Supply seeds associated with the given source_file that may be used by a TestRunner’s random number generator in order to consistently recreate a previously-failing Strategy-provided value.

The default implementation is for backwards compatibility. It delegates to load_persisted_failures and converts the results into XorShift seeds.

Source

fn load_persisted_failures( &self, source_file: Option<&'static str>, ) -> Vec<[u8; 16]>

👎Deprecated

Use load_persisted_failures2 instead.

This function inadvertently exposes the implementation of seeds prior to Proptest 0.9.1 and only works with XorShift seeds.

Source

fn save_persisted_failure2( &mut self, source_file: Option<&'static str>, seed: PersistedSeed, shrunken_value: &dyn Debug, )

Store a new failure-generating seed associated with the given source_file.

The default implementation is for backwards compatibility. It delegates to save_persisted_failure if seed is a XorShift seed.

Source

fn save_persisted_failure( &mut self, source_file: Option<&'static str>, seed: [u8; 16], shrunken_value: &dyn Debug, )

👎Deprecated

Use save_persisted_failures2 instead.

This function inadvertently exposes the implementation of seeds prior to Proptest 0.9.1 and only works with XorShift seeds.

Trait Implementations§

Source§

impl Clone for Box<dyn FailurePersistence>

Source§

fn clone(&self) -> Box<dyn FailurePersistence>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, 'b> PartialEq<dyn FailurePersistence + 'b> for dyn FailurePersistence + 'a

Source§

fn eq(&self, other: &(dyn FailurePersistence + 'b)) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Implementors§