QCheck.ShrinkThe Shrink module contains combinators to build up composite shrinkers for user-defined types
Warning: A hand-written shrinker returning its own argument, will cause QCheck's shrinking phase to loop infinitely.
type 'a t = 'a -> 'a Iter.tGiven a counter-example, return an iterator on smaller versions of the counter-example.
val nil : 'a tNo shrink
val unit : unit tunit shrinker. Does not produce any shrinking candidates.
val bool : bool tbool shrinker. Shrinks towards false.
val char : char tchar shrinker. Shrinks towards 'a'.
val char_numeral : char tchar digit shrinker. Shrinks towards '0'.
val char_printable : char tPrintable char shrinker. Shrinks towards 'a' like !char. The output is also a printable character.
val int : int tint shrinker. Shrinks towards 0.
val int32 : int32 tint32 shrinker. Shrinks towards 0l.
val int64 : int64 tint64 shrinker. Shrinks towards 0L.
option shrinker. Shrinks towards None. option shk reduces Some v values using shk to reduce v.
result shrinker. result ashk eshk reduces Ok a values using ashk and Error e values using eshk.
filter 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_spine : 'a list tTry to shrink lists by removing one or more elements.
pair 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.
tup2 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.
Similar to 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 tup2