This is an improvement to a test, inspired by #14343 - removing non determinism from a test.
The test descriptor_test
is non-deterministic, as it relies on the MaybeUseHInsteadOfApostrophy
function which randomly either swaps all apostrophes with ‘h’ or doesn’t at all in a descriptor. This fix makes both cases always run, if an apostrophe is found in a test descriptor.
This does not reduce test coverage but removes the non-determinism.
Additionally, the MaybeUseHInsteadOfApostrophy
function removed the checksum if found at the end of a descriptor when the apostrophes are swapped by ‘h’s, since after being swapped the checksum is no longer correct. I instead added re-calculation of the checksum using the DescriptorChecksum
function, which adds coverage for the case of a descriptors having ‘h’s instead of apostrophes and a checksum. This was previously lacking.
To achieve this I had to move DescriptorChecksum
and PolyMod
out of the anonymous namespace in descriptor.cpp to make DescriptorChecksum
accessible in descriptor_tests.cpp.
All tests complete successfully (functional as well as unit tests).