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

Choose/Oneof: shrink towards the first or not #121

Closed
sir4ur0n opened this issue May 26, 2021 · 2 comments
Closed

Choose/Oneof: shrink towards the first or not #121

sir4ur0n opened this issue May 26, 2021 · 2 comments

Comments

@sir4ur0n
Copy link
Contributor

Followup of this discussion

@c-cube asked if we really want to shrink towards the first element of a list of values/generators (choose and oneof families of functions).

IMHO it's best to shrink towards the first element of the list:

  • consistency: no matter the starting point (root generated value), the "optimal" shrink will always be the same
  • it doesn't hurt either, even if no branch is smaller than another, to always pick one

We can also provide an optional parameter to decide the strategy: first element, or none (only shrink on the selected one)

Discuss 😁

@c-cube
Copy link
Owner

c-cube commented May 26, 2021

I think it's fine to shrink towards the beginning of the list, if it's clearly documented :-). It's a good ability to have, I think I was just surprised by it initially.

@c-cube
Copy link
Owner

c-cube commented Jun 6, 2021

I think other discussions on #116 and previous have converged to a point where this is indeed the better behavior.

@c-cube c-cube closed this as completed Jun 6, 2021
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

2 participants