pub struct ValueGenerator { /* private fields */ }
Expand description
Context for generating single values out of strategies.
Proptest is designed to be built around “value trees”, which represent a spectrum from complex values to simpler ones. But in some contexts, like benchmarking or generating corpuses, one just wants a single value. This is a convenience struct for that.
Implementations§
Source§impl ValueGenerator
impl ValueGenerator
Sourcepub fn deterministic() -> Self
pub fn deterministic() -> Self
Creates a new value generator with a deterministic RNG.
This generator has a hardcoded seed, so its results are predictable across test runs. However, a new proptest version may change the seed.
Sourcepub fn from_seed(seed: impl Hash) -> Self
pub fn from_seed(seed: impl Hash) -> Self
Creates a new value generator from the given seed.
This generator is typically used with a hardcoded seed that is keyed on the input data somehow. For example, for a test fixture it may be the name of the fixture.
Sourcepub fn partial_clone(&mut self) -> Self
pub fn partial_clone(&mut self) -> Self
Does a “partial clone” of the ValueGenerator
, creating a new independent but deterministic
RNG.