Test.check_exn and more unit tests #174
Closed
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.
When writing the shrinking logs I noticed that the
Test.check_exn
was wrong:It said it would throw a
Test_error
exception on both failures and errors.I figured it would be nice to add a couple of unit-tests to ensure this for
QCheck2
.This PR does both of these.
As a bonus, it adds a few unit tests for
QCheck
, including some for theint*
shrinkersto bring the unit test status closer to
QCheck2
.After having realized that the shrinker's output depend on whether the tested property holds or not,
I split them up into a successful shrink trace and a failure shrink trace,
I then noticed that our current
int*
shrinkers produce the same number twice at the end, e.g.,for
Shrink.int 100
tested on, e.g.,(fun i -> i<100)
it tries:[50; 75; 88; 94; 97; 99; 99]
🤔This is confirmed by
shrink_algo_logs/int_smaller_209609_qcheck.expected
which tests 209608 twice at the end.I'll investigate. I think that could make for another potential
Shrink.int
improvement on top of PR #173.