module Quickcheck: Quickcheck
type 'a
gen = unit -> 'a
the type of a random 'a
-generator
val pfg : float gen
positive float generator
val fg : float gen
float generator (no nan, inf, etc.)
val nng : int gen
natural number generator
val uig : int gen
unsigned int generator (uniform random in range min_int, max_int)
val cg : char gen
char generator
val pg : 'a gen -> 'b gen -> ('a * 'b) gen
pair generator
val tg : 'a gen ->
'b gen -> 'c gen -> ('a * 'b * 'c) gen
triple generator
val lg : 'a gen -> ?size_gen:int gen -> 'a list gen
list generator
val sg : ?char_gen:char gen ->
?size_gen:int gen -> string gen
string generator
val oneof : 'a gen list -> 'a gen
Given a list of generators, returns generator that randomly uses one of the
generators from the list
val always : 'a -> 'a gen
generator that always returns given value
val frequency : (int * 'a) list -> 'a
Given list of (frequency,value)
pairs, returns value with probability
proportional to given frequency
val frequencyl : (int * 'a) list -> 'a gen
a gen
-returning version of frequency
val repeat : int -> ('a -> unit) -> 'a gen -> unit
repeat n test t
tests that the first n
values generated by t
all pass test
val laws : int -> 'a gen -> ('a -> bool) -> 'a option
laws iter gen func
applies func
repeatedly (iter
times) on output
of gen
, and if func
ever returns false, then the input that caused
the failure is returned optionally.
val laws_exn : string -> int -> 'a gen -> ('a -> bool) -> unit
Like laws, but throws an exception instead of returning an option.