Repository navigation
fix(test): seed the seed pair selection in the variability tests - #45
Merged
Merged
Conversation
selectSeedPair draws two distinct nodes from a caller-supplied random source. It picks the second index from the remaining positions instead of retrying on a collision, so the number of draws per pair is fixed.
The multiple seed pair comparison chose its pairs with Math.random, so the pairs, and the path diversity statistics computed from them, differed on every run. Both copies of the test now draw their pairs from a fixed seeded generator, as the perturbation tests do.
|
🎉 This PR is included in version 1.4.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Fixes #42
The multiple seed pair comparison in
variability-injection.exp.integration.test.tsandthesis-validation.exp.integration.test.tschose its ten pairs withMath.random, so the pairs and the path diversity statistics built from them changed on every run. Both now draw the pairs fromcreateSeededRnginproofs/test-utils, the same source the perturbation tests were moved to in 98a0e71, passed into a newselectSeedPairhelper next tograph-perturbation.ts.selectSeedPairpicks the second index from the remaining n - 1 positions instead of redrawing on a collision, so each pair costs exactly two draws. It has its own unit test (determinism, distinctness, full coverage of ordered pairs, fewer than two nodes).For lesmis with seed 1 the ten pairs are identical across three separate runs (same md5 of the printed pair list; the first is Gavroche to Myriel). Typecheck and eslint are clean on the touched files. The two files plus the new unit test pass under the CI command with coverage thresholds zeroed; two of three full runs had timeouts on the large Facebook and CiteSeer tests while the machine's load average was above 370, and the third passed 81 of 81. The timeouts are on tests that do not use the seed pair code.
The only other
Math.randomuses in the evaluation tests were in the perturbation helpers, already seeded. The remaining uses are insrc/algorithmsandsrc/analyzer, which are production code, not test selection, and are left alone.