Add unit tests for RandomNumberGenerator
#44560
Merged
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.
Salvages #44350 (I added @vinayakmtiwari as co-author but apparently the account is deleted so I don't know... The author is encouraged to get back!)
This covers RNG functionality completely (added
randf
andrandi
tests as well)."Integer 32 bit" test is a sanity check to make sure that we do generate 32 unsigned integers given the same test seed.
The problem whether some tests may fail at some point (such as "Normal distribution" case) is handled by doctest's
may_fail
decorator, for which I addedTEST_CASE_MAY_FAIL
test macro intests/test_macros.h
to be used by other test suites abstracting away implementation detail behind doctest, so such test cases won't block CI, and if they do fail (I believe this won't happen as long as we don't change RNG implementation often, I hope), it's a matter of updating the seed, because current results are deterministic (but only per platform, not necessarily across platforms).