Legend:
Library
Module
Module type
Parameter
Class
Class type
Shrinking helper functions.
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.
This is meant to help developers find a simpler counter-example to ease investigation and find more easily the root cause (be it in the tested code or in the test).
This module exposes helper functions that one can reuse in combination with Gen.make_primitive to craft custom primitive generators (not by composing other generators). The vast majority of use cases will probably not need this module.
This generic function is exposed to let users reuse this shrinking technique for their custom number types. More specialized, convenient functions are provided below, e.g. int_towards.
try removing floating digits, i.e. towards integer values
try to get as close as possible to the destination, no matter the number of digits
a mix of both
This implementation, as it relies on the generic number_towards function, tries to get as close as possible to the destination, e.g. the last value of Gen.float_towards 50 100 may be 99.9969482421875 (or a similar value).
val int_aggressive_towards : int ->int ->int Stdlib.Seq.t
int_agressive_towards destination n gives all integers from destination to n (excluded).
Be careful about time and memory as the resulting list can be huge