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

Function CheckWriteCoins

src/test/coins_tests.cpp:793–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

791}
792
793static void CheckWriteCoins(const MaybeCoin& parent, const MaybeCoin& child, const CoinOrError& expected)
794{
795 SingleEntryCacheTest test{ABSENT, parent};
796 auto write_coins{[&] { WriteCoinsViewEntry(test.cache, child); }};
797 if (auto* expected_coin{std::get_if<MaybeCoin>(&expected)}) {
798 write_coins();
799 test.cache.SelfTest(/*sanity_check=*/false);
800 BOOST_CHECK_EQUAL(GetCoinsMapEntry(test.cache.map()), *expected_coin);
801 } else {
802 BOOST_CHECK_EXCEPTION(write_coins(), std::logic_error, HasReason(std::get<std::string>(expected)));
803 }
804}
805
806BOOST_AUTO_TEST_CASE(ccoins_write)
807{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 4

WriteCoinsViewEntryFunction · 0.85
GetCoinsMapEntryFunction · 0.85
HasReasonClass · 0.85
SelfTestMethod · 0.80

Tested by

no test coverage detected