Module prelude
Re-exports the most commonly-needed APIs of proptest.
This module is intended to be wildcard-imported, i.e.,
use proptest::prelude::*;. Note that it re-exports the whole crate itself
under the name prop, so you don't need a separate use proptest; line.
In addition to Proptest's own APIs, this also reexports a small portion of
the rand crate sufficient to easily use prop_perturb and other
functionality that exposes random number generators. Please note that this
is will always be a direct reexport; using these in preference to using the
rand crate directly will not provide insulation from the upcoming
revision to the rand crate.
Modules
-
prop
Re-exports the entire public API of proptest so that an import of
preludeallows simply writing, for example,prop::num::i32::ANYrather thanproptest::num::i32::ANYplus a separateuse proptest;.
Structs
-
BoxedStrategy
A boxed
Strategytrait object as produced byStrategy::boxed(). -
Just
A
Strategywhich always produces a single value value and never simplifies. - ProptestConfig Configuration for how a proptest test should be run.
-
SBoxedStrategy
A boxed
Strategytrait object which is alsoSyncandSend, as produced byStrategy::sboxed().
Enums
- TestCaseError Errors which can be returned from test cases to indicate non-successful completion.
Traits
Functions
-
any
Generates a
Strategyproducing [Arbitrary][trait Arbitrary] values ofA. Unlike [arbitrary][fn arbitrary], it should be used for being explicit on whatAis. For clarity, this may be a good idea. -
any_with
Generates a
StrategyproducingArbitraryvalues ofAwith the given configuration arguments passed inargs. Unlikearbitrary_with, it should be used for being explicit on whatAis. For clarity, this may be a good idea.
Macros
-
prop_assert
Similar to
assert!from std, but returns a test failure instead of panicking if the condition fails. -
prop_assert_eq
Similar to
assert_eq!from std, but returns a test failure instead of panicking if the condition fails. -
prop_assert_ne
Similar to
assert_ne!from std, but returns a test failure instead of panicking if the condition fails. - prop_assume Rejects the test input if assumptions are not met.
- prop_compose Convenience to define functions which produce new strategies.
- prop_oneof Produce a strategy which picks one of the listed choices.
-
proptest
Easily define
proptesttests.