Mavryk_test_helpers.Assertmodule Assert contains Alcotest convenience assertions.
An assertion that a relation between two elements of 'ty holds true. This assertion returns a value of type 'res when it succeeds, typically unit, as in check2. *
type ('ty, 'res) assertion = ('ty, 'res) tAlias for t used in EQUALITIES.
type 'ty check2 = ('ty, unit) tA 'a check2 is an assertion over two elements of type 'a returning unit when it holds.
type ('base_ty, 'container_ty) equality_check =
?eq:('base_ty -> 'base_ty -> bool) ->
?pp:(Stdlib.Format.formatter -> 'base_ty -> unit) ->
'container_ty check2An equality_check is an assertion that the boolean relation defined by eq holds on two series -- of type 'container_ty -- of elements of 'base_ty,
This typically defines the type of assertions on lists (see equal_list), or arrays, but it is also used to defined new checks based on an equality function.
type ('base_ty, 'container_ty) comparison_check =
?cmp:('base_ty -> 'base_ty -> int) ->
?pp:(Stdlib.Format.formatter -> 'base_ty -> unit) ->
'container_ty check2A comparison_check is similar to a equality_check except the assertion is based on the optional comparison function cmp.
fail ?loc ?msg pp x y fails after printing message "<loc> <msg>: expected <x> got <y>".
msg is omitted "<msg:> " is not printedloc is omitted "<loc> " is not printedfail_msg fmt fails after pretty-printing fmt
val equal : ('a, 'a) equality_checkequal ?eq ?pp ?msg ?loc a b checks that eq a b and if not calls fail pp a b
msg loc
val unequal : ('a, 'a) equality_checkunequal ?eq ?pp ?msg ?loc a b checks that eq a b does not hold. See equal for the rest of the documentation.
val equal_list : ('a, 'a list) equality_checkequal_list ?eq ?pp ?msg ?loc l1 l2 is like equal but for polymorphic lists 'a list.
val equal_list_list : ('a, 'a list list) equality_checkequal_list_list is like equal but for polymorphic lists of lists 'a
list list.
val leq : ('a, 'a) comparison_checkleq ?cmp ?pp ?loc ?msg a b checks that cmp a b <= 0.
val lt : ('a, 'a) comparison_checklt ?cmp ?pp ?loc ?msg a b checks that cmp a b < 0.
See leq for details of the parameters.
val geq : ('a, 'a) comparison_checkgeq ?cmp ?pp ?loc ?msg a b checks that cmp a b >= 0.
See leq for details of the parameters.
val gt : ('a, 'a) comparison_checkgt ?cmp ?pp ?loc ?msg a b checks that cmp a b > 0.
See leq for details of the parameters.
Assert that at least one value in l satisfies f.
contains m msg x ls asserts that one testable in ls equals x, and otherwise fails with msg
val is_none :
?loc:string ->
?msg:string ->
?pp:(Stdlib.Format.formatter -> 'a -> unit) ->
'a option ->
unitCheck that an option value is None.
module type EQUALITIES = sig ... endAssertions for equality/disequality
module type COMPARISONS = sig ... endChecks for extra binary relations
module Bytes : COMPARISONS with type t = bytesmodule Bool : COMPARISONS with type t = boolval is_true : bool check1val is_false : bool check1module String : sig ... endmodule Int32 : sig ... endmodule Int64 : sig ... endmodule Int : sig ... endmodule type COMPARABLE = sig ... endmodule type EQUALABLE = sig ... endmodule Make_equalities (X : EQUALABLE) : EQUALITIES with type t = X.tProvide equality-based assertions for type X.t
module Make_comparisons (X : COMPARABLE) : COMPARISONS with type t = X.tProvide all comparisons assertions for type X.t