module Mock:This module provides support for mock functions, that record their calls.sig..end
exception Unexpected_value of string
exception End_of_sequence
type ('a, 'b) t
'a to 'b.val from_mapping : ?cmp:('a -> 'a -> int) ->
?prn:('a -> string) -> ('a * 'b) list -> ('a, 'b) tfrom_mapping ~cmp ~prn l returns a mock function based on the
association list l whose couples are (input, output) indicating
that the function should return output when call with paramer
input. cmp (defaulting to Pervasives.compare) is used to
compare input values), while prn is used to convert input values
into strings.
Raises Unexpected_value if the function received an input value
that do not appear in l.
val from_sequence : ?cmp:('a -> 'a -> int) ->
?prn:('a -> string) -> ('a * 'b) list -> ('a, 'b) tfrom_sequence ~cmp ~prn l returns a mock function based on the
association list l whose couples are (input_i, output_i)
indicating that the ith call to the function should have parameter
input_i and should return output_i. cmp (defaulting to
Pervasives.compare) is used to compare input values), while prn
is used to convert input values into strings.
Raises Unexpected_value if the function received as the ith input
value a value that is different from fst (List.nth l i).
Raises End_of_sequence if more than List.length l calls.
val from_function : ?cmp:('a -> 'a -> int) -> ('a -> 'b) -> ('a, 'b) tfrom_function ~cmp f returns a mock function based on the
function f, only recording calls actually made to the function.
cmp (defaulting to Pervasives.compare) is used to compare input
values).
f should raise Unexpected_value if presented an input value it
cannot handle.
val func : ('a, 'b) t -> 'a -> 'bval func2 : ('a1 * 'a2, 'b) t -> 'a1 -> 'a2 -> 'bval func3 : ('a1 * 'a2 * 'a3, 'b) t -> 'a1 -> 'a2 -> 'a3 -> 'bval func4 : ('a1 * 'a2 * 'a3 * 'a4, 'b) t -> 'a1 -> 'a2 -> 'a3 -> 'a4 -> 'bval func5 : ('a1 * 'a2 * 'a3 * 'a4 * 'a5, 'b) t ->
'a1 -> 'a2 -> 'a3 -> 'a4 -> 'a5 -> 'bval count : ('a, 'b) t -> 'a -> intcount f x returns how many time the function f has been called
with a parameter value equal to x.val total : ('a, 'b) t -> intf has been called.val calls : ('a, 'b) t -> 'a list