Module Async.Quickcheck
include Async_quickcheck
module Generator = Core_kernel.Quickcheck.Generator
module Observer = Core_kernel.Quickcheck.Observer
module Shrinker = Core_kernel.Quickcheck.Shrinker
include Async_quickcheck__.Async_quickcheck_intf.Quickcheck_async_configured
include Core_kernel.Quickcheck.Quickcheck_configured
include Core_kernel.Quickcheck_intf.Quickcheck_config
val default_seed : Core_kernel.Quickcheck_intf.seed
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.
val default_sizes : Core_kernel__.Import.int Core_kernel.Sequence.t
default_sizes
determines the default sequence of sizes used in generating values.
val default_trial_count : Core_kernel__.Import.int
default_trial_count
determines the number of trials per test, except in tests that explicitly override it.
val default_can_generate_trial_count : Core_kernel__.Import.int
default_can_generate_trial_count
determines the number of trials used in attempts to generate satisfying values, except in tests that explicitly override it.
val default_shrink_attempts : Core_kernel.Quickcheck_intf.shrink_attempts
default_shrink_attempts
determines the number of attempts at shrinking when runningtest
oriter
with~shrinker
and without~shrink_attempts
val random_value : ?seed:Core_kernel.Quickcheck_intf.seed -> ?size:Core_kernel__.Import.int -> 'a Base_quickcheck.Generator.t -> 'a
random_value gen
produces a single value chosen fromgen
usingseed
.
val iter : ?seed:Core_kernel.Quickcheck_intf.seed -> ?sizes:Core_kernel__.Import.int Core_kernel.Sequence.t -> ?trials:Core_kernel__.Import.int -> 'a Base_quickcheck.Generator.t -> f:('a -> Core_kernel__.Import.unit) -> Core_kernel__.Import.unit
iter gen ~f
runsf
on up totrials
different values generated bygen
. It stops successfully aftertrials
successful trials or ifgen
runs out of values. It raises an exception iff
raises an exception.
val test : ?seed:Core_kernel.Quickcheck_intf.seed -> ?sizes:Core_kernel__.Import.int Core_kernel.Sequence.t -> ?trials:Core_kernel__.Import.int -> ?shrinker:'a Base_quickcheck.Shrinker.t -> ?shrink_attempts:Core_kernel.Quickcheck_intf.shrink_attempts -> ?sexp_of:('a -> Base.Sexp.t) -> ?examples:'a Core_kernel__.Import.list -> 'a Base_quickcheck.Generator.t -> f:('a -> Core_kernel__.Import.unit) -> Core_kernel__.Import.unit
test gen ~f
is likeiter
, with optional concreteexamples
that are tested before values fromgen
, and additional information provided on failure. Iff
raises an exception andsexp_of
is provided, the exception is re-raised with a description of the random input that triggered the failure. Iff
raises an exception andshrinker
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.
val test_or_error : ?seed:Core_kernel.Quickcheck_intf.seed -> ?sizes:Core_kernel__.Import.int Core_kernel.Sequence.t -> ?trials:Core_kernel__.Import.int -> ?shrinker:'a Base_quickcheck.Shrinker.t -> ?shrink_attempts:Core_kernel.Quickcheck_intf.shrink_attempts -> ?sexp_of:('a -> Base.Sexp.t) -> ?examples:'a Core_kernel__.Import.list -> 'a Base_quickcheck.Generator.t -> f:('a -> Core_kernel__.Import.unit Core_kernel.Or_error.t) -> Core_kernel__.Import.unit Core_kernel.Or_error.t
test_or_error
is liketest
, except failure is determined usingOr_error.t
. Any exceptions raised byf
are also treated as failures.
val test_can_generate : ?seed:Core_kernel.Quickcheck_intf.seed -> ?sizes:Core_kernel__.Import.int Core_kernel.Sequence.t -> ?trials:Core_kernel__.Import.int -> ?sexp_of:('a -> Base.Sexp.t) -> 'a Base_quickcheck.Generator.t -> f:('a -> Core_kernel__.Import.bool) -> Core_kernel__.Import.unit
test_can_generate gen ~f
is useful for testinggen
values, to make sure they can generate useful examples. It testsgen
by generating up totrials
values and passing them tof
. Once a value satisfiesf
, the iteration stops. If no values satisfyf
,test_can_generate
raises an exception. Ifsexp_of
is provided, the exception includes all of the generated values.
val test_distinct_values : ?seed:Core_kernel.Quickcheck_intf.seed -> ?sizes:Core_kernel__.Import.int Core_kernel.Sequence.t -> ?sexp_of:('a -> Base.Sexp.t) -> 'a Base_quickcheck.Generator.t -> trials:Core_kernel__.Import.int -> distinct_values:Core_kernel__.Import.int -> compare:('a -> 'a -> Core_kernel__.Import.int) -> Core_kernel__.Import.unit
test_distinct_values gen
is useful for testinggen
values, to make sure they create sufficient distinct values. It testsgen
by generating up totrials
values and making sure at leastdistinct_values
of the resulting values are unique with respect tocompare
. If too few distinct values are generated,test_distinct_values
raises an exception. Ifsexp_of
is provided, the exception includes the values generated.
val random_sequence : ?seed:Core_kernel.Quickcheck_intf.seed -> ?sizes:Core_kernel__.Import.int Core_kernel.Sequence.t -> 'a Base_quickcheck.Generator.t -> 'a Core_kernel.Sequence.t
random_sequence ~seed gen
produces a sequence of values chosen fromgen
.
val async_test : ?seed:Core_kernel.Quickcheck.seed -> ?trials:int -> ?sexp_of:('a -> Core_kernel.Sexp.t) -> 'a Core_kernel.Quickcheck.Generator.t -> f:('a -> unit Async_kernel.Deferred.t) -> unit Async_kernel.Deferred.t
Like
test
, but for asynchronous tests.
module Configure = Async_quickcheck.Configure