Proptest is a property testing framework (the family of which QuickCheck is perhaps most well-known) inspired by Hypothesis. It allows to test that certain properties of your code hold for arbitrary inputs, and if a failure is found, automatically finds the minimal test case to reproduce the problem. Unlike QuickCheck, generation and shrinking is defined on a per-value basis instead of per-type, which makes it much more flexible and simplifies composition.
For a full introduction and examples, see the documentation.
In my personal usage, everything works pretty well, though the crate itself has a few rough edges.
There may be breaking changes when "impl Trait" becomes stable or when the
possible restructuring of the
rand crate occurs.
0.2.0: Breaking changes:
Strategy now requires
Strategynow has a family of
prop_flat_map()combinators for producing dynamic and higher-order strategies.
prop_recursive()combinator which allows generating recursive structures.
proptest::bool::weighted()to pull booleans from a weighted distribution.
prop_oneof!macro makes it easier to select from one of several strategies.
prop_compose!macro to simplify writing most types of custom strategies.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.