package core
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=bcac85c0ec5795ccabf1dccf0968ecd9
sha512=2e68556773549e0bf302c8733c9fc57df3c0fd73a1b547dc17097f74c5b5482c816ef89853b437e49452da7c124ef32a8a0de0dff64d71145b2ab11befbe5bb2
doc/core/Core/Quickcheck/index.html
Module Core.QuickcheckSource
An 'a t a generates values of type 'a with a specific probability distribution.
An 'a Quickcheck.Observer.t represents a hash function on 'a. Observers are used to construct distributions of random functions; see Quickcheck.Generator.fn.
A 'a Quickcheck.Shrinker.t takes a value of type 'a and produces similar values that are smaller by some metric.
include Quickcheck_intf.Syntax
with module Generator := Generator
and module Open_on_rhs := Generator
include Base.Monad.Syntax
with type 'a t := 'a Generator.t
and module Let_syntax.Let_syntax.Open_on_rhs = Generator
These are convenient to have in scope when programming with a monad:
with a default config
include Quickcheck_configured
include Quickcheck_intf.Quickcheck_config
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_sizes determines the default sequence of sizes used in generating values.
default_trial_count determines the number of trials per test, except in tests that explicitly override it.
default_can_generate_trial_count determines the number of trials used in attempts to generate satisfying values, except in tests that explicitly override it.
default_shrink_attempts determines the number of attempts at shrinking when running test or iter with ~shrinker and without ~shrink_attempts
val random_value :
?seed:Quickcheck_intf.seed ->
?size:Base.Int.t ->
'a Base_quickcheck.Generator.t ->
'arandom_value gen produces a single value chosen from gen using seed.
val iter :
?seed:Quickcheck_intf.seed ->
?sizes:Base.Int.t Sequence.t ->
?trials:Base.Int.t ->
'a Base_quickcheck.Generator.t ->
f:('a -> Base.Unit.t) ->
Base.Unit.titer 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.
val test :
?seed:Quickcheck_intf.seed ->
?sizes:Base.Int.t Sequence.t ->
?trials:Base.Int.t ->
?shrinker:'a Base_quickcheck.Shrinker.t ->
?shrink_attempts:Quickcheck_intf.shrink_attempts ->
?sexp_of:('a -> Base.Sexp.t) ->
?examples:'a Base.List.t ->
'a Base_quickcheck.Generator.t ->
f:('a -> Base.Unit.t) ->
Base.Unit.ttest 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.
val test_or_error :
?seed:Quickcheck_intf.seed ->
?sizes:Base.Int.t Sequence.t ->
?trials:Base.Int.t ->
?shrinker:'a Base_quickcheck.Shrinker.t ->
?shrink_attempts:Quickcheck_intf.shrink_attempts ->
?sexp_of:('a -> Base.Sexp.t) ->
?examples:'a Base.List.t ->
'a Base_quickcheck.Generator.t ->
f:('a -> Base.Unit.t Or_error.t) ->
Base.Unit.t Or_error.ttest_or_error is like test, except failure is determined using Or_error.t. Any exceptions raised by f are also treated as failures.
val test_can_generate :
?seed:Quickcheck_intf.seed ->
?sizes:Base.Int.t Sequence.t ->
?trials:Base.Int.t ->
?sexp_of:('a -> Base.Sexp.t) ->
'a Base_quickcheck.Generator.t ->
f:('a -> Base.Bool.t) ->
Base.Unit.ttest_can_generate 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.
val test_distinct_values :
?seed:Quickcheck_intf.seed ->
?sizes:Base.Int.t Sequence.t ->
?sexp_of:('a -> Base.Sexp.t) ->
'a Base_quickcheck.Generator.t ->
trials:Base.Int.t ->
distinct_values:Base.Int.t ->
compare:('a -> 'a -> Base.Int.t) ->
Base.Unit.ttest_distinct_values gen is useful for testing gen values, to make sure they create sufficient distinct values. It tests gen by generating up to trials values and making sure at least distinct_values of the resulting values are unique with respect to compare. If too few distinct values are generated, test_distinct_values raises an exception. If sexp_of is provided, the exception includes the values generated.
val random_sequence :
?seed:Quickcheck_intf.seed ->
?sizes:Base.Int.t Sequence.t ->
'a Base_quickcheck.Generator.t ->
'a Sequence.trandom_sequence ~seed gen produces a sequence of values chosen from gen.