Testing module

run_property

procedureextensionsince 0.30.0Source

What a @property test runs: body on count generated inputs. Call it by hand to give the arguments custom generators or another count.

Example
run_property(t, (a: s32, b: s32) {
    expect_equal(cast(s64) a + b, cast(s64) b + a);
}, 50);
run_property :: (
    t: *Test,
    $body: $B,
    count: s64 = DEFAULT_TRIALS,
    generators: [] Custom_Generator = .[]
)

What a @property test runs: body on count generated inputs. Call it by hand to give the arguments custom generators or another count.

Parameters

t: *Test
the running test.
$body: $B
the property; its arguments are generated.
count: s64 = DEFAULT_TRIALS
how many trials to run.
generators: [] Custom_Generator = .[]
custom generators that replace the built-in ones for their types.
Example
run_property(t, (a: s32, b: s32) {
    expect_equal(cast(s64) a + b, cast(s64) b + a);
}, 50);

See also