package osnap

  1. Overview
  2. Docs

Module Osnap.SpecSource

include module type of Spec
module Gen : sig ... end
Sourcetype 'a gen = 'a QCheck.Gen.t

'a gen is used to generate random values inside spec. QCheck combinators are available using Spec.Gen.

Sourcetype 'a printer = 'a -> string

'a printer is used to store randomly generated values

Sourcetype 'a spec = {
  1. gen : 'a gen;
  2. printer : 'a printer;
}

'a spec combines an 'a gen and a printer

Sourcetype ('fn, 'r) t =
  1. | Result : 'a printer -> ('a, 'a) t
  2. | Arrow : 'a spec * ('fn, 'r) t -> ('a -> 'fn, 'r) t

t is the specification type, describing a function. Thus t declaration must end with (^>>).

Sourceval unit : unit spec

unit specification

Sourceval bool : bool spec

bool specification

Sourceval float : float spec

float specification

Sourceval int : int spec

int specification

Sourceval char : char spec

char specification

Sourceval string : string spec

string specification

Sourceval option : 'a spec -> 'a option spec

option spec creates an option spec for spec

Sourceval array : 'a spec -> 'a array spec

array spec creates an array spec for spec

Sourceval list : 'a spec -> 'a list spec

list spec creates a list spec for spec

Sourceval (^>) : 'a spec -> ('b, 'c) t -> ('a -> 'b, 'c) t

(^>) x y combines spec x and y to create x -> y

Sourceval (^>>) : 'a spec -> 'b printer -> ('a -> 'b, 'b) t

(^>>) x res combines a specification and printer for the result type