package base_quickcheck
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=360e6b8f3660398936ec88fecb9e7761370ee63acf8372d3208d4d31c00181f2
doc/base_quickcheck/Base_quickcheck/Observer/index.html
Module Base_quickcheck.ObserverSource
Observers create random functions. Generator.fn creates a random function using an observer for the input type and a generator for the output type.
Basic Observers
Produces an observer that treats all values as equivalent. Random functions generated using this observer will be constant with respect to the value(s) it observes.
This helper module type exists separately just to open Bigarray in its scope.
val bigstring :
(Base.char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
tval float32_vec :
(Base.float, Bigarray.float32_elt, Bigarray.fortran_layout) Bigarray.Array1.t
tval float64_vec :
(Base.float, Bigarray.float64_elt, Bigarray.fortran_layout) Bigarray.Array1.t
tval float32_mat :
(Base.float, Bigarray.float32_elt, Bigarray.fortran_layout) Bigarray.Array2.t
tval float64_mat :
(Base.float, Bigarray.float64_elt, Bigarray.fortran_layout) Bigarray.Array2.t
tProduces an observer that generates random inputs for a given function, calls the function on them, then observes the corresponding outputs.
Observers Based on Hash Functions
Creates an observer that just calls a hash function. This is a good default for most hashable types not covered by the basic observers above.
Modifying Observers
Observers for Recursive Types
Ties the recursive knot to observe recursive types.
For example, here is an observer for binary trees:
let tree_observer leaf_observer =
fixed_point (fun self ->
either leaf_observer (both self self)
|> unmap ~f:(function
| `Leaf leaf -> First leaf
| `Node (l, r) -> Second (l, r)))Creates a t that forces the lazy argument as necessary. Can be used to tie (mutually) recursive knots.
Low-Level functions
Most users do not need to call these functions.