Skip to content

Commit fade2ad

Browse files
committed
test: Avoid BOOST_ASSERT macro
The `BOOST_ASSERT` macro is defined in the `boost/assert.hpp` header. This change allows to skip `#include <boost/assert.hpp>`.
1 parent f08bde7 commit fade2ad

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/wallet/test/coinselector_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
432432
CAmount selection_target = 16 * CENT;
433433
const auto& no_res = SelectCoinsBnB(GroupCoins(available_coins.All(), /*subtract_fee_outputs*/true),
434434
selection_target, /*cost_of_change=*/0, MAX_STANDARD_TX_WEIGHT);
435-
BOOST_ASSERT(!no_res);
435+
BOOST_REQUIRE(!no_res);
436436
BOOST_CHECK(util::ErrorString(no_res).original.find("The inputs size exceeds the maximum weight") != std::string::npos);
437437

438438
// Now add same coin value with a good size and check that it gets selected

src/wallet/test/wallet_tests.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,11 +938,10 @@ BOOST_FIXTURE_TEST_CASE(wallet_sync_tx_invalid_state_test, TestingSetup)
938938
}
939939

940940
// Add tx to wallet
941-
const auto& op_dest = wallet.GetNewDestination(OutputType::BECH32M, "");
942-
BOOST_ASSERT(op_dest);
941+
const auto op_dest{*Assert(wallet.GetNewDestination(OutputType::BECH32M, ""))};
943942

944943
CMutableTransaction mtx;
945-
mtx.vout.push_back({COIN, GetScriptForDestination(*op_dest)});
944+
mtx.vout.push_back({COIN, GetScriptForDestination(op_dest)});
946945
mtx.vin.push_back(CTxIn(g_insecure_rand_ctx.rand256(), 0));
947946
const auto& tx_id_to_spend = wallet.AddToWallet(MakeTransactionRef(mtx), TxStateInMempool{})->GetHash();
948947

src/wallet/test/walletdb_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE(walletdb_read_write_deadlock)
3939
DatabaseStatus status;
4040
bilingual_str error_string;
4141
std::unique_ptr<WalletDatabase> db = MakeDatabase(m_path_root / strprintf("wallet_%d_.dat", db_format).c_str(), options, status, error_string);
42-
BOOST_ASSERT(status == DatabaseStatus::SUCCESS);
42+
BOOST_CHECK_EQUAL(status, DatabaseStatus::SUCCESS);
4343

4444
std::shared_ptr<CWallet> wallet(new CWallet(m_node.chain.get(), "", std::move(db)));
4545
wallet->m_keypool_size = 4;

src/wallet/test/walletload_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_load_ckey, TestingSetup)
169169
// Fourth test case:
170170
// Verify that loading up a 'ckey' with an invalid pubkey throws an error
171171
CPubKey invalid_key;
172-
BOOST_ASSERT(!invalid_key.IsValid());
172+
BOOST_CHECK(!invalid_key.IsValid());
173173
SerializeData key = MakeSerializeData(DBKeys::CRYPTED_KEY, invalid_key);
174174
records[key] = ckey_record_value;
175175

0 commit comments

Comments
 (0)