Module Test.Eq

Equality testers.

module type T = sig ... end

The type for types with equality and formatters.

type 'a t = (module T with type t = 'a)

The type for testing equality of values of type 'a.

val make : ?equal:('a -> 'a -> bool) -> ?pp:(Stdlib.Format.formatter -> 'a -> unit) -> unit -> 'a t

make ~equal ~pp () is an equality tester.

Note. If your module M implement T (and most often should) it can directly be used as an equality tester as (module M), you don't need to call this function.

val true' : 'a t

true' equates all values.

val false' : 'a t

false' negates all values.

val any : 'a t

any uses Stdlib.compare for testing values for equality (works on nan values).

val bool : bool t

bool tests booleans.

val char : char t

char tests characters (bytes).

val int : int t

int tests integers.

val int32 : int32 t

int32 tests 32-bit integers.

val uint32 : int32 t

uint32 tests unsigned 32-bit integers.

val int64 : int64 t

int64 tests 64-bit integers.

val uint64 : int64 t

uint64 tests 64-bit integers.

val nativeint : nativeint t

nativeint tests a native integer.

val float : float t

float tests floats. Warning This uses Float.equal see Test.float.

val string : string t

string tests textual strings.

val binary_string : string t

binary_string tests binary string.

val styled_string : string t

styled_string tests textual string styled with ANSI escape sequences.

val bytes : bytes t

bytes tests bytes.

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

list elt tests list of elements tested with elt.

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

array elt test array of elements tested with elt.

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

option v tests options of values tested with v.

val result : ok:'a t -> error:'e t -> ('a, 'e) Stdlib.result t

result ~ok ~error tests result values using the given equalities for the values of each case.