aboutsummaryrefslogtreecommitdiff
path: root/src/test/gen
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2019-08-23 07:50:15 +0800
committerfanquake <fanquake@gmail.com>2019-08-23 08:02:35 +0800
commit12f7147c891491a4f0780744bbd0f3aa7f733d32 (patch)
tree4d75623e1f8ba01b8cf78fbb983455d3a9852a06 /src/test/gen
parent52b9797119d5ee20b255efc68931ac7e158e325d (diff)
parentb9ee63c71b751fd67da777774ea8c0b27e7db2f8 (diff)
downloadbitcoin-12f7147c891491a4f0780744bbd0f3aa7f733d32.tar.xz
Merge #16570: tests: Make descriptor tests deterministic
b9ee63c71b751fd67da777774ea8c0b27e7db2f8 Make descriptor test deterministic (David Reikher) Pull request description: 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). ACKs for top commit: achow101: Code Review ACK b9ee63c71b751fd67da777774ea8c0b27e7db2f8 Tree-SHA512: 992c73a6644a07bfe7c72301ee2666f3c4845a012aaedd7a099a05cea8bdac84fa8280b28e44a7856260c00c0be1a6f1b6768f5694c2a22edf4c489e53fec424
Diffstat (limited to 'src/test/gen')
0 files changed, 0 insertions, 0 deletions