module Shrink:sig..end
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'at ='a -> 'a QCheck.Iter.t
Given a counter-example, return an iterator on smaller versions of the counter-example.
val nil : 'a tNo shrink
val unit : unit tval char : char tShrinks towards 'a'.
val char_numeral : char tShrinks towards '0'.
val char_printable : char tShrinks towards 'a' like !char. The output is also a printable character.
val int : int t
val int32 : int32 tval int64 : int64 tval option : 'a t -> 'a option t
val bytes : ?shrink:char t -> bytes tval string : ?shrink:char t -> string t
val filter : ('a -> bool) -> 'a t -> 'a tfilter f shrink shrinks values the same as shrink, but
only keep smaller values that satisfy f.
This way it's easy to preserve invariants that are enforced by
generators, when shrinking values
val int_aggressive : int tShrink integers by trying all smaller integers (can take a lot of time!)
val list : ?shrink:'a t -> 'a list tTry to shrink lists by removing one or more elements.
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 list_spine : 'a list tTry to shrink lists by removing one or more elements.
val list_elems : 'a t -> 'a list tShrinks the elements of a list, without changing the list size.
val array : ?shrink:'a t -> 'a array tShrink an array.
shrink : see QCheck.Shrink.listval pair : 'a t -> 'b t -> ('a * 'b) tpair a b uses a to shrink the first element of tuples,
then tries to shrink the second element using b.
It is often better, when generating tuples, to put the "simplest"
element first (atomic type rather than list, etc.) because it will be
shrunk earlier. In particular, putting functions last might help.
val triple : 'a t ->
'b t -> 'c t -> ('a * 'b * 'c) tSimilar to QCheck.Shrink.pair
val quad : 'a t ->
'b t ->
'c t ->
'd t -> ('a * 'b * 'c * 'd) tSimilar to QCheck.Shrink.pair
val tup2 : 'a t -> 'b t -> ('a * 'b) ttup2 a b uses a to shrink the first element of tuples,
then tries to shrink the second element using b.
It is often better, when generating tuples, to put the "simplest"
element first (atomic type rather than list, etc.) because it will be
shrunk earlier. In particular, putting functions last might help.
val tup3 : 'a t ->
'b t -> 'c t -> ('a * 'b * 'c) tSimilar to QCheck.Shrink.tup2
val tup4 : 'a t ->
'b t ->
'c t ->
'd t -> ('a * 'b * 'c * 'd) tSimilar to QCheck.Shrink.tup2
val tup5 : 'a t ->
'b t ->
'c t ->
'd t ->
'e t -> ('a * 'b * 'c * 'd * 'e) tSimilar to QCheck.Shrink.tup2
val tup6 : 'a t ->
'b t ->
'c t ->
'd t ->
'e t ->
'f t -> ('a * 'b * 'c * 'd * 'e * 'f) tSimilar to QCheck.Shrink.tup2
val tup7 : 'a t ->
'b t ->
'c t ->
'd t ->
'e t ->
'f t ->
'g t -> ('a * 'b * 'c * 'd * 'e * 'f * 'g) tSimilar to QCheck.Shrink.tup2
val tup8 : 'a t ->
'b t ->
'c t ->
'd t ->
'e t ->
'f t ->
'g t ->
'h t -> ('a * 'b * 'c * 'd * 'e * 'f * 'g * 'h) tSimilar to QCheck.Shrink.tup2
val tup9 : 'a t ->
'b t ->
'c t ->
'd t ->
'e t ->
'f t ->
'g t ->
'h t ->
'i t ->
('a * 'b * 'c * 'd * 'e * 'f * 'g * 'h * 'i) tSimilar to QCheck.Shrink.tup2