module Assertion:This module provides functions evaluating assertions.sig..end
type failure = {
|
expected_value : |
(* | Expected value converted to string. | *) |
|
actual_value : |
(* | Actual value converted to string. | *) |
|
message : |
(* | Short message associated with failure. | *) |
exception Failed of failure
val fail : string -> string -> string -> 'aFailed with the passed parameters
(expected value, actual value, and message).val fail_msg : string -> 'afail_msg m is equivalent to fail "" "" m.val default_printer : 'a -> string"".val equal : ?eq:('a -> 'a -> bool) ->
?prn:('a -> string) -> ?msg:string -> 'a -> 'a -> unitequal ~eq:e ~prn:p ~msg:m x y raises Failed if x and y are
not equal, relatively to the equality function e. p is used to
convert x and y into strings (used only upon failure), and m
is the message associated with the assertion.
Default parameter values:
e defaults to (=);p defaults to default_printer;m defaults to "".val not_equal : ?eq:('a -> 'a -> bool) ->
?prn:('a -> string) -> ?msg:string -> 'a -> 'a -> unitnot_equal ~eq:e ~prn:p ~msg:m x y raises Failed if x and y
are equal, relatively to the equality function e. p is used to
convert x and y into strings (used only upon failure), and m
is the message associated with the assertion.
Default parameter values:
e defaults to (=);p defaults to default_printer;m defaults to "".val same : ?prn:('a -> string) -> ?msg:string -> 'a -> 'a -> unitequal, but based on physical equality.val not_same : ?prn:('a -> string) -> ?msg:string -> 'a -> 'a -> unitnot_equal, but based on physical equality.val make_equal : ('a -> 'a -> bool) -> ('a -> string) -> ?msg:string -> 'a -> 'a -> unitmake_equal e p is equivalent to equal ~eq:e ~prn:p.val make_not_equal : ('a -> 'a -> bool) -> ('a -> string) -> ?msg:string -> 'a -> 'a -> unitmake_not_equal e p is equivalent to not_equal ~eq:e ~prn:p.val make_equal_array : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a array -> 'a array -> unitmake_equal_array eq prn returns a function for testing equality of
arrays. eq is used to compare elements, while prn is used to
print them.val make_not_equal_array : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a array -> 'a array -> unitmake_not_equal_array eq prn returns a function for testing inequality
of arrays. eq is used to compare elements, while prn is used to
print them.val make_equal_list : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a list -> 'a list -> unitmake_equal_list eq prn returns a function for testing equality of
list. eq is used to compare elements, while prn is used to
print them.val make_not_equal_list : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a list -> 'a list -> unitmake_not_equal_list eq prn returns a function for testing inequality
of lists. eq is used to compare elements, while prn is used to
print them.val make_equal_hashtbl : ('b -> 'b -> bool) ->
('a -> string) ->
('b -> string) ->
?msg:string -> ('a, 'b) Hashtbl.t -> ('a, 'b) Hashtbl.t -> unitmake_equal_hashtbl eq prn prn' returns a function for testing
equality of hash tables. eq is used to compare elements, while
prn is used to print keys and prn' is used to print values.val make_not_equal_hashtbl : ('b -> 'b -> bool) ->
('a -> string) ->
('b -> string) ->
?msg:string -> ('a, 'b) Hashtbl.t -> ('a, 'b) Hashtbl.t -> unitmake_not_equal_hashtbl eq prn prn' returns a function for testing
inequality of hash tables. eq is used to compare elements, while
prn is used to print keys and prn' is used to print values.module type Printer =sig..end
module Map:
Map.S.t values.
module Set:
Map.S.t values.
val make_equal_queue : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a Queue.t -> 'a Queue.t -> unitmake_equal_queue eq prn returns a function for testing equality of
queues. eq is used to compare elements, while prn is used to
print them.val make_not_equal_queue : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a Queue.t -> 'a Queue.t -> unitmake_not_equal_queue eq prn returns a function for testing inequality
of queues. eq is used to compare elements, while prn is used to
print them.val make_equal_stack : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a Stack.t -> 'a Stack.t -> unitmake_equal_stack eq prn returns a function for testing equality of
stacks. eq is used to compare elements, while prn is used to
print them.val make_not_equal_stack : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a Stack.t -> 'a Stack.t -> unitmake_not_equal_stack eq prn returns a function for testing inequality
of stacks. eq is used to compare elements, while prn is used to
print them.val make_equal_weak : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a Weak.t -> 'a Weak.t -> unitmake_equal_weak eq prn returns a function for testing equality of
weak arrays. eq is used to compare elements, while prn is used to
print them.val make_not_equal_weak : ('a -> 'a -> bool) ->
('a -> string) -> ?msg:string -> 'a Weak.t -> 'a Weak.t -> unitmake_not_equal_weak eq prn returns a function for testing inequality
of weak arrays. eq is used to compare elements, while prn is used to
print them.val equal_bool : ?msg:string -> bool -> bool -> unitequal, but specialized for bool values.val not_equal_bool : ?msg:string -> bool -> bool -> unitnot_equal, but specialized for bool values.val equal_int : ?msg:string -> int -> int -> unitequal, but specialized for int values.val not_equal_int : ?msg:string -> int -> int -> unitnot_equal, but specialized for int values.val equal_int32 : ?msg:string -> int32 -> int32 -> unitequal, but specialized for int32 values.val not_equal_int32 : ?msg:string -> int32 -> int32 -> unitnot_equal, but specialized for int32 values.val equal_int64 : ?msg:string -> int64 -> int64 -> unitequal, but specialized for int64 values.val not_equal_int64 : ?msg:string -> int64 -> int64 -> unitnot_equal, but specialized for int64 values.val equal_nativeint : ?msg:string -> nativeint -> nativeint -> unitequal, but specialized for nativeint values.val not_equal_nativeint : ?msg:string -> nativeint -> nativeint -> unitnot_equal, but specialized for nativeint values.val equal_char : ?msg:string -> char -> char -> unitequal, but specialized for char values.val not_equal_char : ?msg:string -> char -> char -> unitnot_equal, but specialized for char values.val equal_string : ?msg:string -> string -> string -> unitequal, but specialized for string values.val not_equal_string : ?msg:string -> string -> string -> unitnot_equal, but specialized for string values.val equal_float : ?eps:float -> ?msg:string -> float -> float -> unitequal, but specialized for float values.
eps is the epsilon used for float comparison,
defaulting to epsilon_float.val not_equal_float : ?eps:float -> ?msg:string -> float -> float -> unitnot_equal, but specialized for float values.
eps is the epsilon used for float comparison,
defaulting to epsilon_float.val equal_complex : ?eps:float -> ?msg:string -> Complex.t -> Complex.t -> unitequal, but specialized for Complex.t values.
eps is the epsilon used for float comparison,
defaulting to epsilon_float.val not_equal_complex : ?eps:float -> ?msg:string -> Complex.t -> Complex.t -> unitnot_equal, but specialized for Complex.t values.
eps is the epsilon used for float comparison,
defaulting to epsilon_float.val is_true : ?msg:string -> bool -> unitis_true ~msg:m x raises Failed if x is false.
The default value for m is "".val is_false : ?msg:string -> bool -> unitis_false ~msg:m x raises Failed if x is true.
The default value for m is "".val is_some : ?msg:string -> 'a option -> unitis_some ~msg:m x raises Failed if x is equal to None.
The default value for m is "".val is_none : ?msg:string -> 'a option -> unitis_none ~msg:m x raises Failed if x is different from None.
The default value for m is "".val raises : ?msg:string -> (unit -> 'a) -> unitraises ~msg:m f raises Failed if f () evaluates without raising
an exception. The default value for m is "".val no_raise : ?msg:string -> (unit -> 'a) -> unitno_raise ~msg:m f raises Failed if f () raises an exception.
The default value for m is "".val make_raises : (exn -> bool) -> (exn -> string) -> ?msg:string -> (unit -> 'a) -> unitmake_raises eq p ~msg:m f raises Failed if f () evaluates
without raising an exception e that makes eq e evaluates to
true. p is used to convert e into a string (used only upon
failure), and m is the message associated with the assertion
(defaulting to "").