Macro prop_assert
macro_rules! prop_assert {
($cond:expr) => { ... };
($cond:expr, $($fmt:tt)*) => { ... };
}
Similar to assert! from std, but returns a test failure instead of
panicking if the condition fails.
This can be used in any function that returns a Result<_, TestCaseError>,
including the top-level function inside proptest!.
Both panicking via assert! and returning a test case failure have the
same effect as far as proptest is concerned; however, the Rust runtime
implicitly prints every panic to stderr by default (including a backtrace
if enabled), which can make test failures unnecessarily noisy. By using
prop_assert! instead, the only output on a failing test case is the final
panic including the minimal test case.
Example
use *;
proptest!
// The macro can be used from another function provided it has a compatible
// return type.
#
#