Module Quickcheck

module Quickcheck: sig .. end
Module for easily generating unit tests. Based on code posted by padiolea@irisa.fr to the caml mailing list.

type 'a gen = unit -> 'a 
the type of a random 'a-generator
val fg : float gen
float generator (no nan, inf, etc.)
val cg : char gen
character generator
val nng : int gen
natural number generator
val uig : int gen
unsigned int generator (uniform random in range min_int, max_int)
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 always : 'a -> 'a gen
generator that always returns given value
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.
val repeat : int -> ('a -> unit) -> 'a gen -> unit