module Test:sig..end
type 'a cell
val make_cell : ?count:int ->
?max_gen:int ->
?max_fail:int ->
?small:('a -> int) ->
?name:string -> 'a QCheck.arbitrary -> ('a -> bool) -> 'a cellmake arb prop builds a test that checks property prop on instances
of the generator arb.count : number of test cases to run, counting only
the test cases which satisfy preconditions.max_gen : maximum number of times the generation function
is called in total to replace inputs that do not satisfy
preconditions (should be >= count)max_fail : maximum number of failures before we stop generating
inputs. This is useful if shrinking takes too much time.small : kept for compatibility reasons; if provided, replaces
the field arbitrary.small.
If there is no shrinking function but there is a small
function, only the smallest failures will be printed.name : the name of the testval get_arbitrary : 'a cell -> 'a QCheck.arbitrary
val get_law : 'a cell -> 'a -> bool
val get_name : 'a cell -> string option
val set_name : 'a cell -> string -> unit
type t =
| |
Test : |
(* |
Same as
'a cell, but masking the type parameter. This allows to
put tests on different types in the same list of tests. | *) |
val make : ?count:int ->
?max_gen:int ->
?max_fail:int ->
?small:('a -> int) ->
?name:string -> 'a QCheck.arbitrary -> ('a -> bool) -> tmake arb prop builds a test that checks property prop on instances
of the generator arb.
See QCheck.Test.make_cell for a description of the parameters.exception Test_fail of string * string list
Test_fail (name, l) means test name failed on elements of lexception Test_error of string * string * exn * string
e, with
the sample that triggered the exception.
Test_error (name, i, e, st)
means name failed on i with exception e, and st is the
stacktrace (if enabled) or an empty stringval print_instance : 'a QCheck.arbitrary -> 'a -> string
val print_c_ex : 'a QCheck.arbitrary -> 'a QCheck.TestResult.counter_ex -> string
val print_fail : 'a QCheck.arbitrary ->
string -> 'a QCheck.TestResult.counter_ex list -> string
val print_error : ?st:string ->
'a QCheck.arbitrary ->
string -> 'a QCheck.TestResult.counter_ex * exn -> string
val print_test_fail : string -> string list -> string
val print_test_error : string -> string -> exn -> string -> string
val check_result : 'a cell -> 'a QCheck.TestResult.t -> unitcheck_result cell res checks that res is Ok _, and returns unit.
Otherwise, it raises some exceptionTest_error if res = Error _Test_error if res = Failed _type'acallback =string -> 'a cell -> 'a QCheck.TestResult.t -> unit
f name cell res means test cell, named name, gave resval check_cell : ?call:'a callback ->
?rand:Random.State.t -> 'a cell -> 'a QCheck.TestResult.tcheck ~rand test generates up to count random
values of type 'a using arbitrary and the random state st. The
predicate law is called on them and if it returns false or raises an
exception then we have a counter example for the law.call : function called on each test case, with the resultval check_cell_exn : ?call:'a callback ->
?rand:Random.State.t -> 'a cell -> unitQCheck.Test.check_cell but calls QCheck.Test.check_result on the result.Test_error if res = Error _Test_error if res = Failed _val check_exn : ?rand:Random.State.t -> t -> unitQCheck.Test.check_cell but calls QCheck.Test.check_result on the result.Test_error if res = Error _Test_error if res = Failed _