assert_property

Macro assert_property 

Source
macro_rules! assert_property {
    ($generator:expr, $closure:expr) => { ... };
    ($generator:expr, $closure:expr, $msg:expr) => { ... };
}
Expand description

Assert that a property holds, panicking if it fails

This is useful for tests where you want assertion-style failures.

ยงExamples

use protest::assert_property;
use protest::primitives::IntGenerator;

assert_property!(IntGenerator::new(1, 100), |x: i32| x > 0);

With a custom message:

use protest::assert_property;
use protest::primitives::IntGenerator;

assert_property!(
    IntGenerator::new(1, 100),
    |x: i32| x > 0,
    "All positive numbers should be greater than zero"
);