Deterministically vary the number of seed slides in Test.check #911
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.
(re-attempt of #841, after that was inadvertently turned into an empty PR in the process of moving to a feature branch in my fork)
A
Prop.forAll
of multiple parameters will use the initial seed to generate the first parameter and slide the seed once for each of the subsequent parameters. When combined withTest.check
which slides the seed before evaluating the property, this means that for a property with m > 1 parameters, if the i th evaluation of the property had seeds (seed1 ... seedm), then the i+1 th evaluation will have seeds (seed2 ... seedm, seedm.slide). If the same generator is used for multiple parameters, then a generated value in one evaluation will be reused in a different position in a specific later evaluation.This addresses this by varying the number of slides done in
Test.check
based on the number of times a given property has been evaluated. The number of slides remains deterministic, just less amenable to pattern recognition.The seed sliding behavior between checks is configurable:
maxRNGSpins
is1
,0
, or negative: 1 spin is performedmaxRNGSpins
will be performed; the number of spins is deterministic and as the number of checks of a given property increases, the total number of spins performed between checks converges toN * (maxRNGSpins + 1)/2