Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/UsageTests/ToStringVector.tests.cpp
diff options
context:
space:
mode:
authorJohn Bytheway2020-04-09 20:17:05 -0400
committerMartin Hořeňovský2020-04-14 12:47:36 +0200
commitf696ab836b9c7d9ea2f80b64597541cdc67f6821 (patch)
treea2a50c9662079ca6b48e94a23dad7a368d178da7 /projects/SelfTest/UsageTests/ToStringVector.tests.cpp
parent5d32ce26f4c18588f9eac3342aea122a38b8fed3 (diff)
downloadcatch3-f696ab836b9c7d9ea2f80b64597541cdc67f6821.tar.gz
Change random test shuffling technique
Previously a random test ordering was obtained by applying std::shuffle to the tests in declaration order. This has two problems: - It depends on the declaration order, so the order in which the tests will be run will be platform-specific. - When trying to debug accidental inter-test dependencies, it is helpful to be able to find a minimal subset of tests which exhibits the issue. However, any change to the set of tests being run will completely change the test ordering, making it difficult or impossible to reduce the set of tests being run in any reasonably efficient manner. Therefore, change the randomization approach to resolve both these issues. Generate a random value based on the user-provided RNG seed. Convert every test case to an integer by hashing a combination of that value with the test name. Sort the test cases by this integer. The test names and RNG are platform-independent, so this should be consistent across platforms. Also, removing one test does not change the integer value associated with the remaining tests, so they remain in the same order. To hash, use the FNV-1a hash, except with the basis being our randomly selected value rather than the fixed basis set in the algorithm. Cannot use std::hash, because it is important that the result be platform-independent.
Diffstat (limited to 'projects/SelfTest/UsageTests/ToStringVector.tests.cpp')
0 files changed, 0 insertions, 0 deletions