From 173d5a41cf2c3f01b6d4731124b62b4c38201d47 Mon Sep 17 00:00:00 2001 From: mxaddict Date: Wed, 3 Jan 2024 19:47:23 +0800 Subject: [PATCH] Replaced BOOST_ASSERT with BOOST_CHECK --- src/test/blsct/wallet/address_tests.cpp | 6 ++-- src/test/blsct/wallet/chain_tests.cpp | 4 +-- src/test/blsct/wallet/txfactory_tests.cpp | 38 +++++++++++----------- src/test/blsct/wallet/validation_tests.cpp | 12 +++---- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/test/blsct/wallet/address_tests.cpp b/src/test/blsct/wallet/address_tests.cpp index 5fbd00738bb2a..8783ab930b4da 100644 --- a/src/test/blsct/wallet/address_tests.cpp +++ b/src/test/blsct/wallet/address_tests.cpp @@ -31,8 +31,8 @@ BOOST_FIXTURE_TEST_CASE(address_test, BasicTestingSetup) blsct::PublicKey viewKey; blsct::PublicKey spendKey; - BOOST_ASSERT(subAddressDoubleKey.GetViewKey(viewKey)); - BOOST_ASSERT(subAddressDoubleKey.GetSpendKey(spendKey)); + BOOST_CHECK(subAddressDoubleKey.GetViewKey(viewKey)); + BOOST_CHECK(subAddressDoubleKey.GetSpendKey(spendKey)); BOOST_CHECK(viewKey.ToString() == "809ad665b3de4e1d44d835f1b8de36aafeea3279871aeceb56dbdda90c0426c022e8a6dda7313dc5e4c1817287805e3b"); @@ -43,4 +43,4 @@ BOOST_FIXTURE_TEST_CASE(address_test, BasicTestingSetup) BOOST_CHECK(subAddress.GetString() == "nv1szddvednme8p63xcxhcm3h3k4tlw5vnesudwe66km0w6jrqyymqz969xmknnz0w9unqczu58sp0rhqjc4tdmgt6hmtn9tpavrzckfdfcuwyx4w0s7dgvjce34377psjen6ug4s2xfg9smrw6qx70xtja6s8wrt28dc"); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/blsct/wallet/chain_tests.cpp b/src/test/blsct/wallet/chain_tests.cpp index aeb0857b0b8fa..abb43a6a903fd 100644 --- a/src/test/blsct/wallet/chain_tests.cpp +++ b/src/test/blsct/wallet/chain_tests.cpp @@ -41,12 +41,12 @@ BOOST_FIXTURE_TEST_CASE(SyncTest, TestBLSCTChain100Setup) auto available_coins = AvailableCoins(*wallet); std::vector coins = available_coins.All(); - BOOST_ASSERT(coins.size() == 1); + BOOST_CHECK(coins.size() == 1); // Create Transaction sending to another address auto tx = blsct::TxFactory::CreateTransaction(wallet.get(), wallet->GetOrCreateBLSCTKeyMan(), blsct::SubAddress(), 1 * COIN, "test"); - BOOST_ASSERT(tx != std::nullopt); + BOOST_CHECK(tx != std::nullopt); auto block = CreateAndProcessBlock({tx.value()}, walletDestination); diff --git a/src/test/blsct/wallet/txfactory_tests.cpp b/src/test/blsct/wallet/txfactory_tests.cpp index 0fc926b891fa9..eb14836d05713 100644 --- a/src/test/blsct/wallet/txfactory_tests.cpp +++ b/src/test/blsct/wallet/txfactory_tests.cpp @@ -30,12 +30,12 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests) // auto recvAddress = std::get(blsct_km->GetNewDestination(0).value()); // // auto out = blsct::CreateOutput(recvAddress, 1000, "test"); -// BOOST_ASSERT(blsct_km->IsMine(out.out)); +// BOOST_CHECK(blsct_km->IsMine(out.out)); // // auto hashId = blsct_km->GetHashId(out.out); // blsct::SubAddress subAddressId; // -// BOOST_ASSERT(blsct_km->GetSubAddress(hashId, subAddressId)); +// BOOST_CHECK(blsct_km->GetSubAddress(hashId, subAddressId)); // // auto result = blsct_km->RecoverOutputs({out.out}); // @@ -77,23 +77,23 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests) // CCoinsViewCache coins_view_cache{&base, /*deterministic=*/true}; // coins_view_cache.SetBestBlock(InsecureRand256()); // coins_view_cache.AddCoin(outpoint, std::move(coin), true); -// BOOST_ASSERT(coins_view_cache.Flush()); +// BOOST_CHECK(coins_view_cache.Flush()); // } // // CCoinsViewCache coins_view_cache{&base, /*deterministic=*/true}; -// BOOST_ASSERT(tx.AddInput(coins_view_cache, outpoint)); +// BOOST_CHECK(tx.AddInput(coins_view_cache, outpoint)); // // tx.AddOutput(recvAddress, 900 * COIN, "test"); // // auto finalTx = tx.BuildTx(); // -// BOOST_ASSERT(finalTx.has_value()); -// BOOST_ASSERT(blsct::VerifyTx(CTransaction(finalTx.value()), coins_view_cache)); +// BOOST_CHECK(finalTx.has_value()); +// BOOST_CHECK(blsct::VerifyTx(CTransaction(finalTx.value()), coins_view_cache)); // // bool fFoundChange = false; // // // Wallet does not have the coins available yet -// BOOST_ASSERT(blsct::TxFactory::CreateTransaction(wallet, wallet->GetOrCreateBLSCTKeyMan(), recvAddress, 900 * COIN, "test") == std::nullopt); +// BOOST_CHECK(blsct::TxFactory::CreateTransaction(wallet, wallet->GetOrCreateBLSCTKeyMan(), recvAddress, 900 * COIN, "test") == std::nullopt); // // auto result = blsct_km->RecoverOutputs(finalTx.value().vout); // @@ -101,12 +101,12 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests) // if (res.message == "Change" && res.amount == (1000 - 900 - 0.006) * COIN) fFoundChange = true; // } // -// BOOST_ASSERT(fFoundChange); +// BOOST_CHECK(fFoundChange); // // wallet->transactionAddedToMempool(MakeTransactionRef(finalTx.value())); // // // Wallet does not have the coins available yet (not confirmed in block) -// BOOST_ASSERT(blsct::TxFactory::CreateTransaction(wallet, wallet->GetOrCreateBLSCTKeyMan(), recvAddress, 900 * COIN, "test") == std::nullopt); +// BOOST_CHECK(blsct::TxFactory::CreateTransaction(wallet, wallet->GetOrCreateBLSCTKeyMan(), recvAddress, 900 * COIN, "test") == std::nullopt); // } // TODO: FIX THIS @@ -140,18 +140,18 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests) // CCoinsViewCache coins_view_cache{&base, /*deterministic=*/true}; // coins_view_cache.SetBestBlock(InsecureRand256()); // coins_view_cache.AddCoin(outpoint, std::move(coin), true); -// BOOST_ASSERT(coins_view_cache.Flush()); +// BOOST_CHECK(coins_view_cache.Flush()); // } // // CCoinsViewCache coins_view_cache{&base, /*deterministic=*/true}; -// BOOST_ASSERT(tx.AddInput(coins_view_cache, outpoint)); +// BOOST_CHECK(tx.AddInput(coins_view_cache, outpoint)); // // tx.AddOutput(recvAddress, 900 * COIN, "test"); // // auto finalTx = tx.BuildTx(); // -// BOOST_ASSERT(finalTx.has_value()); -// BOOST_ASSERT(blsct::VerifyTx(CTransaction(finalTx.value()), coins_view_cache)); +// BOOST_CHECK(finalTx.has_value()); +// BOOST_CHECK(blsct::VerifyTx(CTransaction(finalTx.value()), coins_view_cache)); // // bool fFoundChange = false; // @@ -161,12 +161,12 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests) // if (res.message == "Change" && res.amount == (1000 - 900 - 0.006) * COIN) fFoundChange = true; // } // -// BOOST_ASSERT(fFoundChange); +// BOOST_CHECK(fFoundChange); // // wallet->transactionAddedToMempool(MakeTransactionRef(finalTx.value())); // // auto wtx = wallet->GetWalletTx(finalTx.value().GetHash()); -// BOOST_ASSERT(wtx != nullptr); +// BOOST_CHECK(wtx != nullptr); // // fFoundChange = false; // uint32_t nChangePosition = 0; @@ -179,7 +179,7 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests) // } // } // -// BOOST_ASSERT(fFoundChange); +// BOOST_CHECK(fFoundChange); // // auto tx2 = blsct::TxFactory(blsct_km); // auto outpoint2 = COutPoint(finalTx.value().GetHash(), nChangePosition); @@ -188,7 +188,7 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests) // coin2.out = finalTx.value().vout[nChangePosition]; // coins_view_cache.AddCoin(outpoint2, std::move(coin2), true); // -// BOOST_ASSERT(tx2.AddInput(coins_view_cache, outpoint2)); +// BOOST_CHECK(tx2.AddInput(coins_view_cache, outpoint2)); // // blsct::SubAddress randomAddress(blsct::DoublePublicKey(MclG1Point::MapToPoint("test1"), MclG1Point::MapToPoint("test2"))); // tx2.AddOutput(randomAddress, 50 * COIN, "test"); @@ -196,8 +196,8 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests) // auto finalTx2 = tx2.BuildTx(); // wallet->transactionAddedToMempool(MakeTransactionRef(finalTx2.value())); // -// BOOST_ASSERT(wallet->GetDebit(CTransaction(finalTx2.value()), wallet::ISMINE_SPENDABLE_BLSCT) == (1000 - 900 - 0.006) * COIN); -// BOOST_ASSERT(TxGetCredit(*wallet, CTransaction(finalTx2.value()), wallet::ISMINE_SPENDABLE_BLSCT) == (1000 - 900 - 0.006 - 50 - 0.006) * COIN); +// BOOST_CHECK(wallet->GetDebit(CTransaction(finalTx2.value()), wallet::ISMINE_SPENDABLE_BLSCT) == (1000 - 900 - 0.006) * COIN); +// BOOST_CHECK(TxGetCredit(*wallet, CTransaction(finalTx2.value()), wallet::ISMINE_SPENDABLE_BLSCT) == (1000 - 900 - 0.006 - 50 - 0.006) * COIN); // } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/blsct/wallet/validation_tests.cpp b/src/test/blsct/wallet/validation_tests.cpp index 16f08bd831877..1f857c09de6a5 100644 --- a/src/test/blsct/wallet/validation_tests.cpp +++ b/src/test/blsct/wallet/validation_tests.cpp @@ -46,18 +46,18 @@ BOOST_AUTO_TEST_SUITE(blsct_validation_tests) // CCoinsViewCache coins_view_cache{&base, /*deterministic=*/true}; // coins_view_cache.SetBestBlock(InsecureRand256()); // coins_view_cache.AddCoin(outpoint, std::move(coin), true); -// BOOST_ASSERT(coins_view_cache.Flush()); +// BOOST_CHECK(coins_view_cache.Flush()); // } // // CCoinsViewCache coins_view_cache{&base, /*deterministic=*/true}; -// BOOST_ASSERT(tx.AddInput(coins_view_cache, outpoint)); +// BOOST_CHECK(tx.AddInput(coins_view_cache, outpoint)); // // tx.AddOutput(recvAddress, 900 * COIN, "test"); // // auto finalTx = tx.BuildTx(); // -// BOOST_ASSERT(finalTx.has_value()); -// BOOST_ASSERT(blsct::VerifyTx(CTransaction(finalTx.value()), coins_view_cache)); +// BOOST_CHECK(finalTx.has_value()); +// BOOST_CHECK(blsct::VerifyTx(CTransaction(finalTx.value()), coins_view_cache)); // } BOOST_FIXTURE_TEST_CASE(validation_reward_test, TestingSetup) @@ -71,8 +71,8 @@ BOOST_FIXTURE_TEST_CASE(validation_reward_test, TestingSetup) tx.vout.push_back(out.out); tx.txSig = out.GetSignature(); - BOOST_ASSERT(!blsct::VerifyTx(CTransaction(tx), coins_view_cache)); - BOOST_ASSERT(blsct::VerifyTx(CTransaction(tx), coins_view_cache, 900 * COIN)); + BOOST_CHECK(!blsct::VerifyTx(CTransaction(tx), coins_view_cache)); + BOOST_CHECK(blsct::VerifyTx(CTransaction(tx), coins_view_cache, 900 * COIN)); } BOOST_AUTO_TEST_SUITE_END()