Further QCheck2 list shrinker improvements #321
Merged
+145
−126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a small adjustment to the QCheck2 list shrinker, so that lists counterexamples of size 1-3 are treated uniformly,
removing one element in turn. For example [1;2;3] will trigger [2;3], [1;3], [1;2] (in that order).
This makes a difference for the test suite where, e.g.,
Test bytes have unique chars failed
will return minimal 2-char counterexamples as expected (rather than the 3-char ones that really bugged me).With this, the QCheck2 shrinkers are now in good shape, witnessed by the expect test outputs on all OCaml{4,5} {64,32}-bit combinations.
The exception is the shrinker for
QCheck2.Gen.list_size
(and derivatives) which I've not attempted to improve.For reference below I include a
shrink_bench.log
output for OCaml 4.14.2 on my laptop dominated byOf these the 3 first use
QCheck2.Gen.list_size
- and the last uses a function first (a known pain point also for QCheck(1)),