aboutsummaryrefslogtreecommitdiff
path: root/src/test/crypto_tests.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2023-12-12 18:44:49 +0000
committerCory Fields <cory-nospam-@coryfields.com>2024-02-26 16:13:12 +0000
commit297367b3bb062c57142747719ac9bf2e12717ce9 (patch)
tree8625b675f71a88ce667006473f541709e4a83a7e /src/test/crypto_tests.cpp
parent52f9bba889fd9b50a0543fd9fedc389592cdc7e5 (diff)
downloadbitcoin-297367b3bb062c57142747719ac9bf2e12717ce9.tar.xz
crypto: replace CountBits with std::bit_width
bit_width is a drop-in replacement with an exact meaning in c++, so there is no need to continue testing/fuzzing/benchmarking.
Diffstat (limited to 'src/test/crypto_tests.cpp')
-rw-r--r--src/test/crypto_tests.cpp22
1 files changed, 0 insertions, 22 deletions
diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp
index 0a6378adf4..46acc6fc9f 100644
--- a/src/test/crypto_tests.cpp
+++ b/src/test/crypto_tests.cpp
@@ -1060,28 +1060,6 @@ BOOST_AUTO_TEST_CASE(hkdf_hmac_sha256_l32_tests)
"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d");
}
-BOOST_AUTO_TEST_CASE(countbits_tests)
-{
- FastRandomContext ctx;
- for (unsigned int i = 0; i <= 64; ++i) {
- if (i == 0) {
- // Check handling of zero.
- BOOST_CHECK_EQUAL(CountBits(0), 0U);
- } else if (i < 10) {
- for (uint64_t j = uint64_t{1} << (i - 1); (j >> i) == 0; ++j) {
- // Exhaustively test up to 10 bits
- BOOST_CHECK_EQUAL(CountBits(j), i);
- }
- } else {
- for (int k = 0; k < 1000; k++) {
- // Randomly test 1000 samples of each length above 10 bits.
- uint64_t j = (uint64_t{1}) << (i - 1) | ctx.randbits(i - 1);
- BOOST_CHECK_EQUAL(CountBits(j), i);
- }
- }
- }
-}
-
BOOST_AUTO_TEST_CASE(sha256d64)
{
for (int i = 0; i <= 32; ++i) {