Skip to content

Commit

Permalink
Replaced BOOST_ASSERT with BOOST_CHECK
Browse files Browse the repository at this point in the history
  • Loading branch information
mxaddict committed Jan 3, 2024
1 parent 0b9f783 commit 173d5a4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/test/blsct/wallet/address_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -43,4 +43,4 @@ BOOST_FIXTURE_TEST_CASE(address_test, BasicTestingSetup)
BOOST_CHECK(subAddress.GetString() == "nv1szddvednme8p63xcxhcm3h3k4tlw5vnesudwe66km0w6jrqyymqz969xmknnz0w9unqczu58sp0rhqjc4tdmgt6hmtn9tpavrzckfdfcuwyx4w0s7dgvjce34377psjen6ug4s2xfg9smrw6qx70xtja6s8wrt28dc");
}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
4 changes: 2 additions & 2 deletions src/test/blsct/wallet/chain_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ BOOST_FIXTURE_TEST_CASE(SyncTest, TestBLSCTChain100Setup)
auto available_coins = AvailableCoins(*wallet);
std::vector<COutput> 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);

Expand Down
38 changes: 19 additions & 19 deletions src/test/blsct/wallet/txfactory_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ BOOST_AUTO_TEST_SUITE(blsct_txfactory_tests)
// auto recvAddress = std::get<blsct::DoublePublicKey>(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});
//
Expand Down Expand Up @@ -77,36 +77,36 @@ 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);
//
// for (auto& res : result.amounts) {
// 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
Expand Down Expand Up @@ -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;
//
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -188,16 +188,16 @@ 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");
//
// 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()
12 changes: 6 additions & 6 deletions src/test/blsct/wallet/validation_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()

0 comments on commit 173d5a4

Please sign in to comment.