-
Notifications
You must be signed in to change notification settings - Fork 38
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 Gen.{nat,pos}_split{2,} #183
Conversation
4bc5052
to
906af37
Compare
Maybe we could add these generators in |
I don't know what the current status is for QCheck vs. QCheck2, is there some explanation somewhere? |
I believe we kept Line 1753 in b065a81
Because |
I think it would be nice to (review and) merge this PR without waiting too much, because it fixes real bugs in released code. I don't mind duplicating the logic in QCheck2.ml, but I think this is a somewhat independent question that can be handled in another PR. In any case, I wish the current status of core/QCheck.ml vs. core/QCheck2.ml was clearly stated somewhere, for example in the README, so that other occasional contributors know what to do. |
yes
and yes |
LGTM, I tested the bugs reported in #180 with this fix. (We (I) will make a followup merge request for changelogs, qcheck2, etc.) |
That's a good question actually. I think both still have their place, even if only because |
This is a fix for several bugs reported in #180.
Those functions (and
range_subset
), implemented by myself in #114, were utter garbage. I had tested their implementation heavily within a different random library, and when I ported them to QCheck it seems that I messed things up considerably (this is fiddly code full of off-by-one traps etc.).In the present PR I have gone over the implementation of each function and done some manual testing, and I also wrote automated tests in the existing QCheck testsuite. (This forced me to think about the valid input space for the combinators; I extended
pos_split
to support the casesize=0, n=0
, and found a treacherous bug whensize=1
.)My recommendation for the future would be to encourage new generators to come with their tests.
Sorry for the mess, and thanks @max-lang for the report!