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

Function CheckAddCoinBase

src/test/coins_tests.cpp:734–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732}
733
734static void CheckAddCoinBase(CAmount base_value, CAmount cache_value, CAmount modify_value, CAmount expected_value, char cache_flags, char expected_flags, bool coinbase)
735{
736 SingleEntryCacheTest test(base_value, cache_value, cache_flags);
737
738 CAmount result_value;
739 char result_flags;
740 try {
741 CTxOut output;
742 output.nValue = modify_value;
743 test.cache.AddCoin(OUTPOINT.second, Coin(std::move(output), 1, coinbase), coinbase);
744 test.cache.SelfTest();
745 GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
746 } catch (std::logic_error&) {
747 result_value = FAIL;
748 result_flags = NO_ENTRY;
749 }
750
751 BOOST_CHECK_EQUAL(result_value, expected_value);
752 BOOST_CHECK_EQUAL(result_flags, expected_flags);
753}
754
755// Simple wrapper for CheckAddCoinBase function above that loops through
756// different possible base_values, making sure each one gives the same results.

Callers 1

CheckAddCoinFunction · 0.85

Calls 4

GetCoinsMapEntryFunction · 0.85
AddCoinMethod · 0.80
SelfTestMethod · 0.80
CoinClass · 0.50

Tested by

no test coverage detected