package qcheck-core

  1. Overview
  2. Docs

Printing functions and helpers, used to print generated values on test failures.

type 'a t = 'a -> string

Printer for values of type 'a.

val unit : unit t

unit is a printer of unit.

  • since 0.6
val int : int t

int is a printer of integer.

val bool : bool t

bool is a printer of boolean.

val float : float t

float is a printer of float.

val char : char t

char is a printer of character.

val string : string t

string is a printer of string.

val option : 'a t -> 'a option t

option p is a printer of 'a option, using p if it is a Some.

val pair : 'a t -> 'b t -> ('a * 'b) t

pair p1 p2 is a printer of pair.

val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t

triple p1 p2 p3 is a printer of triple.

val quad : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t

quad p1 p2 p3 p4 is a printer of quadruple.

val list : 'a t -> 'a list t

list p is a printer of list, using p for each element.

val array : 'a t -> 'a array t

array p is a printer of array, using p for each element.

val contramap : ('b -> 'a) -> 'a t -> 'b t

contramap f p transforms printer p into another using f.

Note the reverse order of types in f which may be conter-intuitive: indeed a function that prints values of type 'b can be obtained by transforming a value of type 'b to 'a using f, and then by printing this value of type 'a using p.

val comap : ('b -> 'a) -> 'a t -> 'b t
val tup2 : 'a t -> 'b t -> ('a * 'b) t

2-tuple printer. Expects printers for each component.

val tup3 : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t

3-tuple printer. Expects printers for each component.

val tup4 : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t

4-tuple printer. Expects printers for each component.

val tup5 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> ('a * 'b * 'c * 'd * 'e) t

5-tuple printer. Expects printers for each component.

val tup6 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> 'f t -> ('a * 'b * 'c * 'd * 'e * 'f) t

6-tuple printer. Expects printers for each component.

val tup7 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> 'f t -> 'g t -> ('a * 'b * 'c * 'd * 'e * 'f * 'g) t

7-tuple printer. Expects printers for each component.

val tup8 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> 'f t -> 'g t -> 'h t -> ('a * 'b * 'c * 'd * 'e * 'f * 'g * 'h) t

8-tuple printer. Expects printers for each component.

val tup9 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> 'f t -> 'g t -> 'h t -> 'i t -> ('a * 'b * 'c * 'd * 'e * 'f * 'g * 'h * 'i) t

9-tuple printer. Expects printers for each component.

OCaml

Innovation. Community. Security.