pub struct ArbTest<P>{ /* private fields */ }
Expand description
A builder for a property-based test.
This builder allows customizing various aspects of the test, such as the initial random seed, the amount of iterations to try, or the amount of random numbers (entropy) each test run gets.
For convenience, ArbTest
automatically runs the test on drop. You can use ArbTest::run
to run the test explicitly.
Implementations§
source§impl<P> ArbTest<P>
impl<P> ArbTest<P>
sourcepub fn size_min(self, size: u32) -> Self
pub fn size_min(self, size: u32) -> Self
Sets the lower bound on the amount of random bytes each test run gets.
Defaults to 32.
Each randomized test gets an arbitrary::Unstructured as a source of
randomness. Unstructured
can be thought of as a finite pseudo random
number generator, or, alternatively, as a finite sequence of random
numbers. The intuition here is that shorter sequences lead to simpler
test cases.
The size
parameter controls the length of the initial random sequence.
More specifically, arbtest
will run the test function multiple times,
increasing the amount of entropy from size_min
to size_max
.
sourcepub fn size_max(self, size: u32) -> Self
pub fn size_max(self, size: u32) -> Self
Sets the upper bound on the amount of random bytes each test run gets.
Defaults to 64 536.
See ArbTest::size_min
.
sourcepub fn budget(self, value: Duration) -> Self
pub fn budget(self, value: Duration) -> Self
Sets the approximate duration for the tests.
Defaults to 100ms, can be overridden via ARBTEST_BUDGET_MS
environmental variable.
arbtest
will re-run the test function until the time runs out or until it panics.
sourcepub fn budget_ms(self, value: u64) -> Self
pub fn budget_ms(self, value: u64) -> Self
Sets the approximate duration for the tests, in milliseconds.