Page
Library
Module
Module type
Parameter
Class
Class type
Source
QCheck.Gentype 'a t = Random.State.t -> 'aA random generator for values of type 'a.
type 'a sized = int -> Random.State.t -> 'aRandom generator with a size bound.
val return : 'a -> 'a tCreate a constant generator.
Monadic bind for writing dependent generators. First generates an 'a and then passes it to the given function, to generate a 'b.
Infix operator for composing a function generator and an argument generator into a result generator.
map f g transforms a generator g by applying f to each generated element.
map2 f g1 g2 transforms two generators g1 and g2 by applying f to each pair of generated elements.
map3 f g1 g2 g3 transforms three generators g1, g2, and g3 by applying f to each triple of generated elements.
map_keep_input f g transforms a generator g by applying f to each generated element. Returns both the generated element from g and the output from f.
val oneofl : 'a list -> 'a tConstructs a generator that selects among a given list of values.
val oneofa : 'a array -> 'a tConstructs a generator that selects among a given array of values.
Constructs a generator that selects among a given list of generators. Each of the given generators are chosen based on a positive integer weight.
val frequencyl : (int * 'a) list -> 'a tConstructs a generator that selects among a given list of values. Each of the given values are chosen based on a positive integer weight.
val frequencya : (int * 'a) array -> 'a tConstructs a generator that selects among a given array of values. Each of the array entries are chosen based on a positive integer weight.
val shuffle_a : 'a array -> unit tShuffles the array in place.
val shuffle_l : 'a list -> 'a list tCreates a generator of shuffled lists.
val unit : unit tThe unit generator.
val bool : bool tThe boolean generator.
val float : float tGenerates floating point numbers.
val pfloat : float tGenerates positive floating point numbers.
val nfloat : float tGenerates negative floating point numbers.
val nat : int tGenerates small natural numbers.
val neg_int : int tGenerates negative integers.
val pint : int tGenerates positive integers uniformly.
val int : int tGenerates integers uniformly.
val small_int : int tSmall UNSIGNED integers, for retrocompatibility.
val small_signed_int : int tSmall SIGNED integers.
val int_bound : int -> int tUniform integer generator producing integers within 0... bound.
val int_range : int -> int -> int tUniform integer generator producing integers within low,high.
graft_corners gen l () makes a new generator that enumerates the corner cases in l and then behaves like g.
val ui32 : int32 tGenerates (unsigned) int32 values.
val ui64 : int64 tGenerates (unsigned) int64 values.
Builds a list generator from an element generator. List size is generated by nat.
Builds a list generator from a (non-negative) size generator and an element generator.
list_repeat i g builds a list generator from exactly i elements generated by g.
Builds an array generator from an element generator. Array size is generated by nat.
Builds an array generator from a (non-negative) size generator and an element generator.
array_repeat i g builds an array generator from exactly i elements generated by g.
val char : char tGenerates characters upto character code 255.
val printable : char tGenerates printable characters.
val numeral : char tGenerates numeral characters.
Builds a string generator from a (non-negative) size generator. Accepts an optional character generator (the default is char).
Builds a string generator. String size is in the range 0--10. Accepts an optional character generator (the default is char).
Creates a generator from a size-bounded generator by first generating a size using nat and passing the result to the size-bounded generator.
Creates a generator from a size-bounded generator by first generating a size using the integer generator and passing the result to the size-bounded generator.
Fixpoint combinator for generating recursive, size-bounded data types. The passed size-parameter should decrease to ensure termination.
Example:
type tree = Leaf of int | Node of tree * tree
let leaf x = Leaf x
let node x y = Node (x,y)
let g = QCheck.Gen.(sized @@ fix
(fun self n -> match n with
| 0 -> map leaf nat
| n ->
frequency
[1, map leaf nat;
2, map2 node (self (n/2)) (self (n/2))]
))
val generate : ?rand:Random.State.t -> n:int -> 'a t -> 'a listgenerate ~n g generates n instances of g.
val generate1 : ?rand:Random.State.t -> 'a t -> 'agenerate1 g generates one instance of g.