shrink package:falsify
Shrink counter-example
This will run the generator repeatedly until it finds a
counter-example to the given property, and will then shrink it.
Returns
Nothing if no counter-example could be found.
Start with Just x for some x, then shrink to
Nothing
Start with x, then shrink to one of the xs
Once shrunk, will not shrink again.
Minimal value is the first shrunk value, if it exists, and the
original otherwise.
Shrink with provided shrinker
This provides compatibility with QuickCheck-style manual shrinking.
Defined in terms of
fromShrinkTree; see discussion there for
some notes on performance.
Generalization of
shrink. Returns the full shrink history.
Does a given shrunk value represent a valid shrink step?
Construct generator from shrink tree
This provides compatibility with Hedgehog-style integrated shrinking.
This is O(n^2) in the number of shrink steps: as this shrinks, the
generator is growing a path of indices which locates a particular
value in the shrink tree (resulting from unfolding the provided
shrinking function). At each step during the shrinking process the
shrink tree is re-evaluated and the next value in the tree is located;
since this path throws linearly, the overall cost is O(n^2).
The O(n^2) cost is only incurred on locating the next element
to be tested; the property is not reevaluated at already-shrunk
values.
Expose the full shrink tree of a generator
This generator does not shrink.
Disable shrinking in the given generator
Due to the nature of internal shrinking, it is always possible that a
generator gets reapplied to samples that were shrunk wrt to a
different generator. In this sense,
withoutShrinking
should be considered to be a hint only.
This function is only occassionally necessary; most users will
probably not need to use it.
Test shrinking of a property
A property is normally only shrunk when it fails. We do the
same here: if the property succeeds, we discard the test and try
again.
If the given property itself discards immediately, then this generator
will discard also; otherwise, only shrink steps are considered that do
not lead to a discard.
Test shrinking of a generator
We check any shrink step that the generator can make
(independent of any property).
Override the maximum number of shrink steps for this test