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

Fix shrinking of floats with one bound #1644

Closed
wants to merge 7 commits into from

Conversation

Zac-HD
Copy link
Member

@Zac-HD Zac-HD commented Oct 18, 2018

Fixes #1212, fixes #1683 and fixes #1707.

Unfortunately fixing shrinking for floats() with two bounds will be much more involved. I'd prefer incremental to no progress though, so I've written up #1704 as a separate issue.

@Zac-HD Zac-HD force-pushed the shrink-floats branch 3 times, most recently from e7d2360 to 6fee9f2 Compare December 23, 2018 06:04
@DRMacIver
Copy link
Member

I'm actually unsure whether I do prefer incremental progress here - given that we have a general fix proposed in #1704 and it doesn't share any code to speak of with this PR, do we actually still want to merge this?

@Zac-HD
Copy link
Member Author

Zac-HD commented Dec 28, 2018

"incremental" is probably the wrong word - this is a full fix for the shrinking problem with one bound. floats() with two bounds uses a different SearchStrategy subclass internally, with completely different generation and shrinking behaviour. The change proposed in #1704 would complement but not replace this one.

@DRMacIver
Copy link
Member

The change proposed in #1704 would complement but not replace this one.

Hmm. What I was imagining there, which maybe wasn't what you intended, was having a single wrapper strategy called say FloatShrinkingStrategy which wraps some underlying strategy and filter function (or set of float specific constraints) and automatically produces a float strategy that shrinks correctly. This would then commonize shrinking logic between all three float strategies, and potentially would allow us to (later) improve the generation of floats to boot.

@Zac-HD
Copy link
Member Author

Zac-HD commented Dec 28, 2018

Oooh, that sounds great.

I'll open a new PR with just the incidental fixes which have... accumulated. TBH I'm probably violating the multi-purpose-PR rule again 😇

@Zac-HD Zac-HD closed this Dec 28, 2018
@DRMacIver
Copy link
Member

TBH I'm probably violating the multi-purpose-PR rule again 😇

You are, but I decided not to make an issue of it until we'd decided whether you wanted to continue with this PR. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test-case-reduction about efficiently finding smaller failing examples
Projects
None yet
2 participants