MCPcopy Create free account
hub / github.com/ElementsProject/elements / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/test/hash_tests.cpp:15–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13BOOST_AUTO_TEST_SUITE(hash_tests)
14
15BOOST_AUTO_TEST_CASE(murmurhash3)
16{
17
18#define T(expected, seed, data) BOOST_CHECK_EQUAL(MurmurHash3(seed, ParseHex(data)), expected)
19
20 // Test MurmurHash3 with various inputs. Of course this is retested in the
21 // bloom filter tests - they would fail if MurmurHash3() had any problems -
22 // but is useful for those trying to implement Bitcoin libraries as a
23 // source of test data for their MurmurHash3() primitive during
24 // development.
25 //
26 // The magic number 0xFBA4C795 comes from CBloomFilter::Hash()
27
28 T(0x00000000U, 0x00000000, "");
29 T(0x6a396f08U, 0xFBA4C795, "");
30 T(0x81f16f39U, 0xffffffff, "");
31
32 T(0x514e28b7U, 0x00000000, "00");
33 T(0xea3f0b17U, 0xFBA4C795, "00");
34 T(0xfd6cf10dU, 0x00000000, "ff");
35
36 T(0x16c6b7abU, 0x00000000, "0011");
37 T(0x8eb51c3dU, 0x00000000, "001122");
38 T(0xb4471bf8U, 0x00000000, "00112233");
39 T(0xe2301fa8U, 0x00000000, "0011223344");
40 T(0xfc2e4a15U, 0x00000000, "001122334455");
41 T(0xb074502cU, 0x00000000, "00112233445566");
42 T(0x8034d2a0U, 0x00000000, "0011223344556677");
43 T(0xb4698defU, 0x00000000, "001122334455667788");
44
45#undef T
46}
47
48/*
49 SipHash-2-4 output with

Callers

nothing calls this directly

Calls 12

SipHashUint256Function · 0.85
uint256SFunction · 0.85
InsecureRand256Function · 0.85
SipHashUint256ExtraFunction · 0.85
rand64Method · 0.80
rand32Method · 0.80
sizeFunction · 0.50
WriteLE32Function · 0.50
FinalizeMethod · 0.45
WriteMethod · 0.45
GetHashMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected