Bitcoin Core 28.99.0
P2P Digital Currency
Classes | Functions
cuckoocache_tests.cpp File Reference
#include <cuckoocache.h>
#include <random.h>
#include <script/sigcache.h>
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>
#include <deque>
#include <mutex>
#include <shared_mutex>
#include <thread>
#include <vector>
Include dependency graph for cuckoocache_tests.cpp:

Go to the source code of this file.

Classes

struct  HitRateTest
 
struct  EraseTest
 
struct  EraseParallelTest
 
struct  GenerationsTest
 

Functions

 BOOST_FIXTURE_TEST_SUITE (cuckoocache_tests, BasicTestingSetup)
 Test Suite for CuckooCache. More...
 
 BOOST_AUTO_TEST_CASE (test_cuckoocache_no_fakes)
 
 BOOST_FIXTURE_TEST_CASE (cuckoocache_hit_rate_ok, HitRateTest)
 Check the hit rate on loads ranging from 0.1 to 1.6. More...
 
 BOOST_FIXTURE_TEST_CASE (cuckoocache_erase_ok, EraseTest)
 
 BOOST_FIXTURE_TEST_CASE (cuckoocache_erase_parallel_ok, EraseParallelTest)
 
 BOOST_FIXTURE_TEST_CASE (cuckoocache_generations, GenerationsTest)
 
 BOOST_AUTO_TEST_SUITE_END ()
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( test_cuckoocache_no_fakes  )

Definition at line 38 of file cuckoocache_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE_END ( )

◆ BOOST_FIXTURE_TEST_CASE() [1/4]

BOOST_FIXTURE_TEST_CASE ( cuckoocache_erase_ok  ,
EraseTest   
)

Definition at line 186 of file cuckoocache_tests.cpp.

◆ BOOST_FIXTURE_TEST_CASE() [2/4]

BOOST_FIXTURE_TEST_CASE ( cuckoocache_erase_parallel_ok  ,
EraseParallelTest   
)

Definition at line 278 of file cuckoocache_tests.cpp.

◆ BOOST_FIXTURE_TEST_CASE() [3/4]

BOOST_FIXTURE_TEST_CASE ( cuckoocache_generations  ,
GenerationsTest   
)

Definition at line 377 of file cuckoocache_tests.cpp.

◆ BOOST_FIXTURE_TEST_CASE() [4/4]

BOOST_FIXTURE_TEST_CASE ( cuckoocache_hit_rate_ok  ,
HitRateTest   
)

Check the hit rate on loads ranging from 0.1 to 1.6.

Arbitrarily selected Hit Rate threshold that happens to work for this test as a lower bound on performance.

Definition at line 111 of file cuckoocache_tests.cpp.

◆ BOOST_FIXTURE_TEST_SUITE()

BOOST_FIXTURE_TEST_SUITE ( cuckoocache_tests  ,
BasicTestingSetup   
)

Test Suite for CuckooCache.

  1. All tests should have a deterministic result (using insecure rand with deterministic seeds)
  2. Some test methods are templated to allow for easier testing against new versions / comparing
  3. Results should be treated as a regression test, i.e., did the behavior change significantly from what was expected. This can be OK, depending on the nature of the change, but requires updating the tests to reflect the new expected behavior. For example improving the hit rate may cause some tests using BOOST_CHECK_CLOSE to fail.