- The
Generatetrait that is implemented for many of rust's standard types allows the generation of any random composite data through combinator (such as tuples,Any,Map,Flattenand more). It is designed for composability and its usage should feel like working withIterators. - The
Shrinktrait tries to reduce a generated sample to a 'smaller' version of it while maintaining its constraints (ex: a sampleusizein the range10..100will never be shrunk out of its range). For numbers, it means bringing the sample closer to 0, for vectors, it means removing irrelevant items and shrinking the remaining ones, etc.. - The
Provetrait is meant to represent a desirable property of a system under test. It is used mainly in the context of theGenerate::checkorChecker::checkmethods and it is the failure of a proof that triggers the shrinking process. It is implemented for a couple of standard types such asboolandResult.
Example
use ;
;
See the examples and tests folder for more detailed examples.