Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deriver: derive shrinkers #191

Open
Tracked by #192
vch9 opened this issue Oct 11, 2021 · 5 comments
Open
Tracked by #192

Deriver: derive shrinkers #191

vch9 opened this issue Oct 11, 2021 · 5 comments

Comments

@vch9
Copy link
Contributor

vch9 commented Oct 11, 2021

We could derive shrinker from the type declaration. However, shouldn't we admit that people wanting shrinkers should migrate to QCheck2 instead?
ping @jmid as you mentioned this

@vch9 vch9 mentioned this issue Oct 11, 2021
5 tasks
@c-cube
Copy link
Owner

c-cube commented Oct 11, 2021

I think it's still not clear that QCheck2 will always be the better choice. A shrinker generator would be useful. However it's not urgent, I think it's reasonable to focus on QCheck2 generators instead and do a release.

@jmid
Copy link
Collaborator

jmid commented Oct 11, 2021

I agree with @c-cube. The QCheck2 shrinker code is still relatively immature.

Also: as I tried to illustrate in the shrink logs #172 QCheck2 sometimes has shrinker issues due to missing a splittable RNG + sub-optimal shrinker algorithms. QCheck's shrinkers are not optimal either (description in #177) - but with a couple of improvements to the list and string shrinkers (lying on my HD in a ~1 month old git stash... 😅) all the benchmarks run reasonably fast. I hope to push these at some point - and that the algorithms can then be mirrored in QCheck2...

As to a splittable RNG I've suggested we go with a "poor man's" implementation first.
I noticed we already use such an approach in the runner to check a list of tests independently of each other:

let rand = Random.State.copy rand in

@vch9
Copy link
Contributor Author

vch9 commented Oct 12, 2021

If we plan on adding the shrinker deriver in the ppx, we should decide before any release the plugins names: #190.

@tmcgilchrist
Copy link
Contributor

@jmid Have you tried either of pringo or splittable_random as a splittable RNG library?

@jmid
Copy link
Collaborator

jmid commented Jan 19, 2022

@jmid Have you tried either of pringo or splittable_random as a splittable RNG library?

I think I tried them briefly at some point.
My interest was in how splitting enabled more predictable/better shrinking in the rose-tree setup by decoupling random choices (and thus shrink trees) of sub-parts. (rereading that I'm not sure anyone understands 😅)

There's big news in the pipeline for 5.00 though: ocaml/ocaml#10742
So

  • we should start preparing for a QCheck setup that can work on both pre-5.00 and 5.00 with split
  • the splitting per domain enables a "parallel QCheck mode" where several cores run in parallel 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants