gopter icon indicating copy to clipboard operation
gopter copied to clipboard

Are there resources to learn about shrinking algorithms?

Open CreatCodeBuild opened this issue 6 years ago • 3 comments

Property based tests are great tools to assert properties of an API. Though I haven't done it in Go, this package looks useful.

I'm more curious about the implementation and the algorithm. Do you know any references or papers I could read?

CreatCodeBuild avatar Jul 17 '18 20:07 CreatCodeBuild

There is a blog article summing up the the interna of scalacheck: https://blog.ssanj.net/posts/2017-04-12-how-does-scalacheck-shrinking-work.html

And there are several some material about QuickCheck, though I haven't read those.

untoldwind avatar Aug 13 '18 07:08 untoldwind

The tests for Int64Shrinker follow a different pattern to the examples in the linked article; is this intentional? I.e. the tests shrink 10 into 0, 5, -5, 8, -8, 9, -9; whereas I would have expected 5, -5, 3, -3, 2, -2, 1, -1, 0. That is to say that the test, like Zeno's tortoise, continually advance towards the shunk value but never reach it instead of exponentially decaying towards zero.

au-phiware avatar Oct 18 '18 13:10 au-phiware

I have come across this article that seems to take a similar approach as gopter (at least in the ordering/direction of the shrinking values): https://deque.blog/2017/02/10/code-your-own-quickcheck-shrink/

Is this the kind of approach that gopter takes?

au-phiware avatar Oct 18 '18 20:10 au-phiware