Module Quickcheck.ShrinkerSource
A 'a Quickcheck.Shrinker.t takes a value of type 'a and produces similar values that are smaller by some metric.
The defined shrinkers generally try to make a single change for each value based on the assumption that the first resulting value that preserves the desired property will be used to create another sequence of shrunk values.
Within Quickcheck.test the shrinker is used as described above.
Shrinkers aim to aid understanding of what's causing an error by reducing the input down to just the elements making it fail. The default shrinkers remove elements of compound structures, but leave atomic values alone. For example, the default list shrinker tries removing elements from the list, but the default int shrinker does nothing. This default strikes a balance between performance and precision. Individual tests can use different shrinking behavior as necessary.
See lib/base_quickcheck/examples/shrinker_example.ml for some example shrinkers.
val map :
'a Core.Quickcheck.Shrinker.t ->
f:('a -> 'b) ->
f_inverse:('b -> 'a) ->
'b Core.Quickcheck.Shrinker.tval filter :
'a Core.Quickcheck.Shrinker.t ->
f:('a -> Base.Bool.t) ->
'a Core.Quickcheck.Shrinker.tval filter_map :
'a Core.Quickcheck.Shrinker.t ->
f:('a -> 'b Base.Option.t) ->
f_inverse:('b -> 'a) ->
'b Core.Quickcheck.Shrinker.tFilters and maps according to f, and provides input to t via f_inverse. Only the f direction produces options, intentionally.
val tuple2 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
('a * 'b) Core.Quickcheck.Shrinker.tval tuple3 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
'c Core.Quickcheck.Shrinker.t ->
('a * 'b * 'c) Core.Quickcheck.Shrinker.tval tuple4 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
'c Core.Quickcheck.Shrinker.t ->
'd Core.Quickcheck.Shrinker.t ->
('a * 'b * 'c * 'd) Core.Quickcheck.Shrinker.tval tuple5 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
'c Core.Quickcheck.Shrinker.t ->
'd Core.Quickcheck.Shrinker.t ->
'e Core.Quickcheck.Shrinker.t ->
('a * 'b * 'c * 'd * 'e) Core.Quickcheck.Shrinker.tval tuple6 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
'c Core.Quickcheck.Shrinker.t ->
'd Core.Quickcheck.Shrinker.t ->
'e Core.Quickcheck.Shrinker.t ->
'f Core.Quickcheck.Shrinker.t ->
('a * 'b * 'c * 'd * 'e * 'f) Core.Quickcheck.Shrinker.tval variant2 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
[ `A of 'a | `B of 'b ] Core.Quickcheck.Shrinker.tval variant3 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
'c Core.Quickcheck.Shrinker.t ->
[ `A of 'a | `B of 'b | `C of 'c ] Core.Quickcheck.Shrinker.tval variant4 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
'c Core.Quickcheck.Shrinker.t ->
'd Core.Quickcheck.Shrinker.t ->
[ `A of 'a | `B of 'b | `C of 'c | `D of 'd ] Core.Quickcheck.Shrinker.tval variant5 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
'c Core.Quickcheck.Shrinker.t ->
'd Core.Quickcheck.Shrinker.t ->
'e Core.Quickcheck.Shrinker.t ->
[ `A of 'a | `B of 'b | `C of 'c | `D of 'd | `E of 'e ]
Core.Quickcheck.Shrinker.tval variant6 :
'a Core.Quickcheck.Shrinker.t ->
'b Core.Quickcheck.Shrinker.t ->
'c Core.Quickcheck.Shrinker.t ->
'd Core.Quickcheck.Shrinker.t ->
'e Core.Quickcheck.Shrinker.t ->
'f Core.Quickcheck.Shrinker.t ->
[ `A of 'a | `B of 'b | `C of 'c | `D of 'd | `E of 'e | `F of 'f ]
Core.Quickcheck.Shrinker.tval fixed_point :
('a Core.Quickcheck.Shrinker.t -> 'a Core.Quickcheck.Shrinker.t) ->
'a Core.Quickcheck.Shrinker.tfixed_point assists with shrinking structures recursively. Its advantage over directly using rec in the definition of the shrinker is that it causes lazy evaluation where possible.