Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/coinselector_tests.cpp
Show First 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | BOOST_CHECK(m_wallet.SelectCoins(vCoins, 10 * CENT, setCoinsRet, nValueRet, | ||||
coin_control, coin_selection_params_bnb, | coin_control, coin_selection_params_bnb, | ||||
bnb_used)); | bnb_used)); | ||||
BOOST_CHECK(!bnb_used); | BOOST_CHECK(!bnb_used); | ||||
BOOST_CHECK(!coin_selection_params_bnb.use_bnb); | BOOST_CHECK(!coin_selection_params_bnb.use_bnb); | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(knapsack_solver_test) { | BOOST_AUTO_TEST_CASE(knapsack_solver_test) { | ||||
auto testChain = interfaces::MakeChain(); | auto testChain = interfaces::MakeChain(); | ||||
CWallet testWallet(Params(), *testChain, WalletLocation(), | CWallet testWallet(Params(), testChain.get(), WalletLocation(), | ||||
WalletDatabase::CreateDummy()); | WalletDatabase::CreateDummy()); | ||||
CoinSet setCoinsRet, setCoinsRet2; | CoinSet setCoinsRet, setCoinsRet2; | ||||
Amount nValueRet; | Amount nValueRet; | ||||
bool bnb_used; | bool bnb_used; | ||||
LOCK(testWallet.cs_wallet); | LOCK(testWallet.cs_wallet); | ||||
▲ Show 20 Lines • Show All 412 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(ApproximateBestSubset) { | ||||
empty_wallet(); | empty_wallet(); | ||||
} | } | ||||
// Tests that with the ideal conditions, the coin selector will always be able | // Tests that with the ideal conditions, the coin selector will always be able | ||||
// to find a solution that can pay the target value | // to find a solution that can pay the target value | ||||
BOOST_AUTO_TEST_CASE(SelectCoins_test) { | BOOST_AUTO_TEST_CASE(SelectCoins_test) { | ||||
auto testChain = interfaces::MakeChain(); | auto testChain = interfaces::MakeChain(); | ||||
CWallet testWallet(Params(), *testChain, WalletLocation(), | CWallet testWallet(Params(), testChain.get(), WalletLocation(), | ||||
WalletDatabase::CreateDummy()); | WalletDatabase::CreateDummy()); | ||||
// Random generator stuff | // Random generator stuff | ||||
std::default_random_engine generator; | std::default_random_engine generator; | ||||
std::exponential_distribution<double> distribution(100); | std::exponential_distribution<double> distribution(100); | ||||
FastRandomContext rand; | FastRandomContext rand; | ||||
// Run this test 100 times | // Run this test 100 times | ||||
Show All 35 Lines |