BurntSushi / quickcheck

Automated property based testing for Rust (with shrinking).
The Unlicense
2.4k stars 149 forks source link

Handle non-terminating shrinkers in shrink_failure #157

Closed JacekLach closed 6 years ago

JacekLach commented 7 years ago

Rather than failing with a stack overflow, if we hit an arbitrary depth, we report the most simplified form, and note that shrinking does not seem to terminate.

This is a more generic alternative to #139, and should address common cases of #133.

Before this is ready to merge (assuming it's the approach you want to go with), we need to decide what a reasonable default recursion limit (maximum depth) is. Currently it's hardcoded to 1000 in an embarrassing fashion. I'm not sure what the best way of exposing it to configuration in QuickCheck<G> is; perhaps it should just be an additional argument to .result(), passed in by quicktest<A>?

Disclaimer: this is the first piece of Rust I've ever written, and was mostly done so that I have something to experiment with. So I might be missing something obvious, doing something really wrong, etc; you should probably review it more closely than something from an experienced rust dev. But hey, it compiled and passed tests!

BurntSushi commented 6 years ago

Closing due to inactivity. Thanks for attempting this though!