From 9f9eb7fbc053b38daeb1f4ca4e284d51e07fe50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Sat, 1 Feb 2025 19:01:36 +0100 Subject: [PATCH] test: rename k1/k2 to k0/k1 in `SipHash` consistency tests Aligns test variable naming with the `k0`/`k1` convention used consistently throughout the codebase for `SipHash` keys. Also splits the single-param `SipHash` test from the one with extra, for clarity. --- src/test/hash_tests.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/test/hash_tests.cpp b/src/test/hash_tests.cpp index 2fe44960f46..46901893e9b 100644 --- a/src/test/hash_tests.cpp +++ b/src/test/hash_tests.cpp @@ -133,18 +133,20 @@ BOOST_AUTO_TEST_CASE(siphash) // Check consistency between CSipHasher and SipHashUint256[Extra]. FastRandomContext ctx; for (int i = 0; i < 16; ++i) { + uint64_t k0 = ctx.rand64(); uint64_t k1 = ctx.rand64(); - uint64_t k2 = ctx.rand64(); uint256 x = m_rng.rand256(); + + CSipHasher sip256(k0, k1); + sip256.Write(x); + BOOST_CHECK_EQUAL(SipHashUint256(k0, k1, x), sip256.Finalize()); // TODO modified in follow-up commit + + CSipHasher sip288 = sip256; uint32_t n = ctx.rand32(); uint8_t nb[4]; WriteLE32(nb, n); - CSipHasher sip256(k1, k2); - sip256.Write(x); - CSipHasher sip288 = sip256; sip288.Write(nb); - BOOST_CHECK_EQUAL(SipHashUint256(k1, k2, x), sip256.Finalize()); - BOOST_CHECK_EQUAL(SipHashUint256Extra(k1, k2, x, n), sip288.Finalize()); + BOOST_CHECK_EQUAL(SipHashUint256Extra(k0, k1, x, n), sip288.Finalize()); // TODO modified in follow-up commit } }