You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hm, I haven't looked in depth but I think this might rely on unspecified behavior. It'll ultimately call randomR, and I don't see anything in between that causes the bounds to be swapped. (Maybe Range.bounds should take care of that?)
Minor suggestions:
I'd add a third choice retaining the original behavior. Then elements in the middle are still 1/3 as likely to get picked as now, rather than only getting generated when the size is sufficiently large (which I think would be the case with just the exponentials).
If the shrinking is a problem, it would be easy to use a variant of choice that doesn't shrink to a different list element (it would be defined using integral_ instead of integral to select the index).
First things first, Hedgehog is awesome!
One minor stumbling block I came across is that Hedgehog is unlikely to find counterexamples that are close to the bounds of a large
enum
range.Problem
Given a broken function
and a property
it is unlikely that Hedgehog will find a counterexample:
Possible solution
The definition of
enum
usesRange.constant
.Changing this to
Range.exponential
will make Hedgehog discover counterexamples close to the lower bound.However, this will make it even more unlikely to discover a counterexample close to the upper bound.
The easiest thing I could think of is
which will discover counterexamples both close to the upper / lower bound, albeit with altered shrinking behavior.
Any thoughts?
The text was updated successfully, but these errors were encountered: