package qcheck-core

  1. Overview
  2. Docs

Result of running a test

type 'a counter_ex = {
  1. instance : 'a;
    (*

    The counter-example

    *)
  2. shrink_steps : int;
    (*

    How many shrinking steps for this counter-example

    *)
  3. msg_l : string list;
    (*

    Messages of the test. Currently only populated by Test.fail_report and Test.fail_reportf.

    • since 0.7
    *)
}

A counter-example when a test fails.

type 'a state =
  1. | Success
    (*

    If the test passed.

    *)
  2. | Failed of {
    1. instances : 'a counter_ex list;
      (*

      Failed instance(s)

      *)
    }
    (*

    If the test failed "normally", i.e. a test returned false.

    *)
  3. | Failed_other of {
    1. msg : string;
    }
    (*

    If the test failed for an unusual reason:

    • an exception was raised by a generator
    • too many assumptions failed and Test.if_assumptions_fail was set to `Fatal
    *)
  4. | Error of {
    1. instance : 'a counter_ex;
      (*

      Instance that triggered the exception in the test

      *)
    2. exn : exn;
      (*

      The raised exception

      *)
    3. backtrace : string;
      (*

      A best-effort backtrace of the exception

      *)
    }
    (*

    If the test failed "exceptionally" (an exception was raised by the test).

    *)

Result state.

changed in 0.10 (move to inline records, add Fail_other)

type 'a t
val get_state : 'a t -> 'a state

get_state t returns the final state after a test execution.

val get_count : _ t -> int

get_count t returns the number of tests executed.

val get_count_gen : _ t -> int

get_count_gen t returns the number of generated cases.

val get_collect : _ t -> (string, int) Hashtbl.t option

get_collect t returns the repartition of generated values.

  • since 0.18
val get_stats : 'a t -> ('a stat * (int, int) Hashtbl.t) list

get_stats t returns the statistics captured by the test.

  • since 0.18
val get_warnings : _ t -> string list

get_warnings t returns the list of warnings emitted during the test.

  • since 0.18
val is_success : _ t -> bool

Returns true iff the state is Success

  • since 0.9
val is_failed : _ t -> bool

Returns true iff the state is Failed _

val stats : 'a t -> ('a stat * (int, int) Hashtbl.t) list

Obtain statistics

  • since 0.6
val warnings : _ t -> string list

Obtain list of warnings

  • since 0.10
val collect : _ t -> (string, int) Hashtbl.t option

Obtain statistics

  • since 0.6
OCaml

Innovation. Community. Security.