Module QCheck.Test

module Test: sig .. end

Module related to individual tests.


type res = QCheck2.Test.res = 
| Success
| Failure
| FalseAssumption
| Error of exn * string
type 'a event = 'a QCheck2.Test.event = 
| Generating
| Collecting of 'a
| Testing of 'a
| Shrunk of int * 'a
| Shrinking of int * int * 'a
type 'a cell = 'a QCheck2.Test.cell 
type 'a handler = 'a QCheck2.Test.handler 
type 'a step = 'a QCheck2.Test.step 
type 'a callback = 'a QCheck2.Test.callback 
type t = QCheck2.Test.t 
val fail_report : string -> 'a

Fail the test with some additional message that will be reported.

val fail_reportf : ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a

Format version of QCheck.Test.fail_report

val make_cell : ?if_assumptions_fail:[ `Fatal | `Warning ] * float ->
?count:int ->
?long_factor:int ->
?max_gen:int ->
?max_fail:int ->
?small:('a -> int) ->
?name:string -> 'a QCheck.arbitrary -> ('a -> bool) -> 'a cell

make_cell arb prop builds a test that checks property prop on instances of the generator arb.

if_assumptions_fail : the minimum fraction of tests that must satisfy the precondition for a success to be considered valid. The fraction should be between 0. and 1. A warning will be emitted otherwise if the flag is `Warning, the test will be a failure if the flag is `Fatal. (since 0.10)
count : number of test cases to run, counting only the test cases which satisfy preconditions.
long_factor : the factor by which to multiply count, max_gen and max_fail when running a long test (default: 1).
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 test.
val get_law : 'a cell -> 'a -> bool
Deprecated. use QCheck2.Test.get_law instead
val get_name : 'a cell -> string
Deprecated. use QCheck2.Test.get_name instead
val set_name : 'a cell -> string -> unit
Deprecated. use QCheck2.Test.set_name instead
val get_count : 'a cell -> int
Deprecated. use QCheck2.Test.get_count instead

Get the count of a cell.

val get_long_factor : 'a cell -> int
Deprecated. use QCheck2.Test.get_long_factor instead

Get the long factor of a cell.

val make : ?if_assumptions_fail:[ `Fatal | `Warning ] * float ->
?count:int ->
?long_factor:int ->
?max_gen:int ->
?max_fail:int ->
?small:('a -> int) ->
?name:string -> 'a QCheck.arbitrary -> ('a -> bool) -> t

make 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.

include QCheck2.Test_exceptions
val print_instance : 'a cell -> 'a -> string
val print_c_ex : 'a cell -> 'a QCheck.TestResult.counter_ex -> string
val print_fail : 'a cell ->
string -> 'a QCheck.TestResult.counter_ex list -> string
val print_fail_other : string -> msg:string -> string
val print_error : ?st:string ->
'a cell ->
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_cell : ?long:bool ->
?call:'a callback ->
?step:'a step ->
?handler:'a handler ->
?rand:Stdlib.Random.State.t -> 'a cell -> 'a QCheck.TestResult.t
val check_cell_exn : ?long:bool ->
?call:'a callback ->
?step:'a step ->
?rand:Stdlib.Random.State.t -> 'a cell -> unit
val check_exn : ?long:bool -> ?rand:Stdlib.Random.State.t -> t -> unit