Add parameter for retrying a property while shrinking#212
Merged
jmid merged 3 commits intoc-cube:masterfrom Dec 16, 2021
Merged
Add parameter for retrying a property while shrinking#212jmid merged 3 commits intoc-cube:masterfrom
jmid merged 3 commits intoc-cube:masterfrom
Conversation
Owner
|
That seems most reasonable. Would you consider adding these explanations in comments somewhere, so they live nearer the code? |
c-cube
approved these changes
Dec 16, 2021
Owner
c-cube
left a comment
There was a problem hiding this comment.
good to merge, but feel free to comment more if you want to :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 adds a parameter
~retriesto QCheck and QCheck2 tests.When passing a
~retriesnumberngreater than 1, the tested property is checkedntimes for each shrunk input candidate.The default value is 1, thus causing no change in behaviour.
This feature can be useful when testing non-deterministic code with QCheck (such as https://github.com/jmid/multicoretests)
In the words of Hughes-Bolinder:Erlang11, Sec.6:
"As we explained in section 4, we ensure that tests fail when races are present simply by repeating each test a large number of times, and by running on a dual core machine. We obtained the minimal failing cases in the previous section by repeating each test 100 times during shrinking: thus we stopped shrinking a test case only when all of its candidate shrinkings passed 100 tests in a row."