| 745 | } |
| 746 | |
| 747 | static void CheckAddCoin(const CAmount base_value, const MaybeCoin& cache_coin, const CAmount modify_value, const CoinOrError& expected, const bool coinbase) |
| 748 | { |
| 749 | SingleEntryCacheTest test{base_value, cache_coin}; |
| 750 | bool possible_overwrite{coinbase}; |
| 751 | auto add_coin{[&] { test.cache.AddCoin(OUTPOINT, Coin{CTxOut{modify_value, CScript{}}, 1, coinbase}, possible_overwrite); }}; |
| 752 | if (auto* expected_coin{std::get_if<MaybeCoin>(&expected)}) { |
| 753 | add_coin(); |
| 754 | test.cache.SelfTest(); |
| 755 | BOOST_CHECK_EQUAL(GetCoinsMapEntry(test.cache.map()), *expected_coin); |
| 756 | } else { |
| 757 | BOOST_CHECK_EXCEPTION(add_coin(), std::logic_error, HasReason(std::get<std::string>(expected))); |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | BOOST_AUTO_TEST_CASE(ccoins_add) |
| 762 | { |
no test coverage detected