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

Function BOOST_AUTO_TEST_CASE

src/test/cuckoocache_tests.cpp:36–48  ·  view source on GitHub ↗

Test that no values not inserted into the cache are read out of it. * * There are no repeats in the first 200000 insecure_GetRandHash calls */

Source from the content-addressed store, hash-verified

34 * There are no repeats in the first 200000 insecure_GetRandHash calls
35 */
36BOOST_AUTO_TEST_CASE(test_cuckoocache_no_fakes)
37{
38 SeedInsecureRand(SeedRand::ZEROS);
39 CuckooCache::cache<uint256, SignatureCacheHasher> cc{};
40 size_t megabytes = 4;
41 cc.setup_bytes(megabytes << 20);
42 for (int x = 0; x < 100000; ++x) {
43 cc.insert(InsecureRand256());
44 }
45 for (int x = 0; x < 100000; ++x) {
46 BOOST_CHECK(!cc.contains(InsecureRand256(), false));
47 }
48};
49
50/** This helper returns the hit rate when megabytes*load worth of entries are
51 * inserted into a megabytes sized cache

Callers

nothing calls this directly

Calls 6

SeedInsecureRandFunction · 0.85
InsecureRand256Function · 0.85
normalize_hit_rateFunction · 0.85
setup_bytesMethod · 0.45
insertMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected