Module TCHGenerator

Provides functions generating values.

val make_random : unit -> TCHTestApi.random_t

Creates a new random source

val make_random_seed : int -> TCHTestApi.random_t

Creates a new random source, using the passed value as the seed

val make_random_full : int array -> TCHTestApi.random_t

Creates a new random source, using the passed value as the seed

val unit : unit TCHTestApi.generator_t

Dummy generator for unit value

val bool : bool TCHTestApi.generator_t

Generator of bool values

val make_bool : int -> int -> bool TCHTestApi.generator_t

make_bool w1 w2 constructs a generator for bool values. w1 and w2 are the weights for respectively true and false. Raises Invalid_arg if either w1 or w2 is negative.

Generator for int values.

val pos_int : int TCHTestApi.generator_t

Generator for positive int values.

val neg_int : int TCHTestApi.generator_t

Generator for negative int values.

val make_int : int -> int -> int TCHTestApi.generator_t

make_int m n constructs a generator for int values. Generated values are between m (inclusive) and n (exclusive). Raises Invalid_arg if m >= n.

val select_int : int list -> int TCHTestApi.generator_t

Generator for int values selected from a given set.

val char : char TCHTestApi.generator_t

Generator for char values.

val digit : char TCHTestApi.generator_t

Generator for char values representing (decimal) digits.

val digit_bin : char TCHTestApi.generator_t

Generator for char values representing (binary) digits.

val digit_hex : char TCHTestApi.generator_t

Generator for char values representing (hexadecimal) digits.

val letter : char TCHTestApi.generator_t

Generator for char values representing letters.

val select_letter : char list -> char TCHTestApi.generator_t

Generator for char values that selects from a given list of characters.

val alphanum : char TCHTestApi.generator_t

Generator for char values representing alphanumeric characters (i.e. letters, decimal digits, as well as underscores).

string i c constructs a generator for string values. i is the generator used to determine the string length, while c is the generator used to generate characters.

val strings : string -> int TCHTestApi.generator_t -> string TCHTestApi.generator_t -> string TCHTestApi.generator_t

strings sep i s constructs a generator for string values. The generated strings are the concatenation of strings generated by s, separated by sep. The number of strings is determined by i.

number n constructs a generator for string values representing numbers. n is used to determine the number of (decimal) digits.

val number_bin : int TCHTestApi.generator_t -> string TCHTestApi.generator_t

number_bin n constructs a generator for string values representing numbers. n is used to determine the number of (binary) digits.

val number_hex : int TCHTestApi.generator_t -> string TCHTestApi.generator_t

number_hex n constructs a generator for string values representing numbers. n is used to determine the number of (hexadecimal) digits.

word n constructs a generator for string values representing words. n is used to determine the number of letters.

words n p constructs a generator for string values representing sequences of words. n is used to determine the number of words, while p is used to determine the number of letters for a word. Words are separated by single whitespaces.

val float : float TCHTestApi.generator_t

Generator for float values.

val make_float : float -> float -> float TCHTestApi.generator_t

make_float f g constructs a generator for float values. Generated values are between f (inclusive) and g (exclusive).