MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SelfTest

Method SelfTest

src/test/coins_tests.cpp:82–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 explicit CCoinsViewCacheTest(CCoinsView* _base) : CCoinsViewCache(_base) {}
81
82 void SelfTest(bool sanity_check = true) const
83 {
84 // Manually recompute the dynamic usage of the whole data, and compare it.
85 size_t ret = memusage::DynamicUsage(cacheCoins);
86 size_t count = 0;
87 for (const auto& entry : cacheCoins) {
88 ret += entry.second.coin.DynamicMemoryUsage();
89 ++count;
90 }
91 BOOST_CHECK_EQUAL(GetCacheSize(), count);
92 BOOST_CHECK_EQUAL(DynamicMemoryUsage(), ret);
93 if (sanity_check) {
94 SanityCheck();
95 }
96 }
97
98 CCoinsMap& map() const { return cacheCoins; }
99 CoinsCachePair& sentinel() const { return m_sentinel; }

Callers 6

SimulationTestMethod · 0.80
CheckAccessCoinFunction · 0.80
CheckSpendCoinsFunction · 0.80
CheckAddCoinFunction · 0.80
CheckWriteCoinsFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 3

DynamicUsageFunction · 0.85
SanityCheckFunction · 0.85
DynamicMemoryUsageMethod · 0.45

Tested by

no test coverage detected