Page
Library
Module
Module type
Parameter
Class
Class type
Source
QCheck.ShrinkShrinking 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.tGiven a counter-example, return an iterator on smaller versions of the counter-example.
val nil : 'a tNo shrink
val unit : unit tval char : char tval int : int tval string : string tval int_aggressive : int tShrink integers by trying all smaller integers (can take a lot of time!)
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.