default_seed
is used initialize the pseudo-random generator that chooses random
values from generators, in each test that is not provided its own seed.
default_trial_count
determines the number of trials per test, except in tests
that explicitly override it.
default_trial_count_for_test_no_duplicates
determines the number of trials when
running test_no_duplicates
without ~trials
, either as a constant or as a factor
of default_trial_count
.
default_attempts_per_trial
determines the maximum number of attempts to generate
inputs for trials, as a multiplier for the number of trials, except in tests that
explicitly override it.
default_probability_threshold_to_remember_choice
determines the minimum
probability, out of 1.0, at which Quickcheck.iter
and derived functions will
remember previous choices and avoid repeating them. Below this threshold, it is
assumed that the space needed to record the choice outweighs the negligible chance
of repeating it.
default_shrink_attempts
determines the number of attempts at shrinking
when running test
or iter
with ~shrinker
and without
~shrink_attempts
iter ~seed ~trials ~attempts gen ~f
runs f
on up to trials
different values
generated by gen
. It stops successfully after trials
successful trials or if
gen
runs out of values. It raises an exception if f
raises an exception or if
it fails to produce trials
inputs from gen
after attempts
attempts.
test ~seed ~trials ~attempts ~sexp_of ~examples gen ~f
is like iter
,
with optional concrete examples
that are tested before values from
gen
, and additional information provided on failure. If f
raises an
exception and sexp_of
is provided, the exception is re-raised with
a description of the random input that triggered the failure. If f
raises an exception and shrinker
is provided, it will be used to
attempt to shrink the value that caused the exception with re-raising
behaving the same as for unshrunk inputs.
test_can_generate ~seed ~trials ~attempts ~sexp_of gen ~f
is useful for testing
gen
values, to make sure they can generate useful examples. It tests
gen
by generating up to trials
values and passing them to f
. Once a value
satisfies f
, the iteration stops. If no values satisfy f
, test_can_generate
raises an exception. If sexp_of
is provided, the exception includes all of the
generated values.
test_no_duplicates ~seed ~trials ~attempts ~sexp_of gen ~by
is useful for testing
gen
values, to make sure they do not create duplicate values. It tests
gen
by generating up to trials
values and comparing each pair of the generated
values using by
. If any of the pairs are identical, test_no_duplicates
raises
an exception. If sexp_of
is provided, the exception includes the identical
values.
random_sequence ~seed gen
produces a sequence of values chosen from gen
.
Like test
, but for asynchronous tests.