property

Macro property 

Source
macro_rules! property {
    ($generator:expr, $closure:expr) => { ... };
    ($generator:expr, iterations = $n:expr, $closure:expr) => { ... };
    ($generator:expr, seed = $seed:expr, $closure:expr) => { ... };
    ($generator:expr, iterations = $n:expr, seed = $seed:expr, $closure:expr) => { ... };
}
Expand description

Create and run a property test with minimal syntax

This macro accepts a closure and optional configuration, automatically infers the generator, and runs the property test.

ยงExamples

Basic usage:

use protest::property;
use protest::primitives::IntGenerator;

property!(IntGenerator::new(0, 100), |x: i32| x >= 0);

With configuration:

use protest::property;
use protest::primitives::IntGenerator;

property!(
    IntGenerator::new(0, 100),
    iterations = 1000,
    seed = 42,
    |x: i32| x >= 0
);