package qcheck

  1. Overview
  2. Docs

Shrink Values

Shrinking is used to reduce the size of a counter-example. It tries to make the counter-example smaller by decreasing it, or removing elements, until the property to test holds again; then it returns the smallest value that still made the test fail

type 'a t = 'a -> 'a Iter.t

Given a counter-example, return an iterator on smaller versions of the counter-example

val nil : 'a t

No shrink

val int : int t
val option : 'a t -> 'a option t
val string : string t
val list : ?shrink:'a t -> 'a list t

Try to shrink lists by removing elements one by one.

  • parameter shrink

    if provided, will be used to also try to reduce the elements of the list themselves (e.g. in an int list one can try to decrease the integers)

val array : ?shrink:'a t -> 'a array t

Shrink an array.

  • parameter shrink

    see list

val pair : 'a t -> 'b t -> ('a * 'b) t
val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
val quad : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t
OCaml

Innovation. Community. Security.