Is there a way to observe how a generator shrinks?
Like sample
, but starting from a “big” generated value and then shrinking down?
theoretically yes, there's just not an easy function included that does this
I've written it once or twice, it's only a few lines; I probably don't have one handy though
your request can be interpreted a couple of different ways though
default shrinks are going to be less interesting; e.g., if your generator is (gen/vector gen-some-big-hairy-data-structure)
, then the easiest way of shrinking it consists of taking one step to []
Maybe a version of sample that returns small
, medium
, big
, medium
, small
, so that it’s easy to see how a value grows then shrinks?
that might be weirder than it sounds
I should probably get a much better understanding of test.check’s shrinking before bugging you furthur
it's tempting to think that the growing you see in sample
and in a test run is related to the shrinking you get in a failure, but they're almost entirely unrelated processes
I don't mind discussing it, the whole thing is currently underdocumented so I deserve to have to explain things live :)
another thing you could implement without too much trouble is a random shrink
it might not resemble too closely what would happen in a real test, but it could at least give you an idea of what sorts of steps are possible
@nwjsmith this part of this talk introduces the idea of a shrink tree, which is most of what you need to know to understand the shrinking mechanics: https://youtu.be/u0t-6lUvXHo?t=11m6s
Oh, excellent. Thanks!
I suppose it's a rather steep introduction, but it's at least better than me typing stuff