Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/coinselector_tests.cpp
Show First 20 Lines • Show All 522 Lines • ▼ Show 20 Lines | for (int i = 0; i < RUN_TESTS; i++) { | ||||
add_coin(testWallet, 1 * COIN); | add_coin(testWallet, 1 * COIN); | ||||
add_coin(testWallet, 2 * COIN); | add_coin(testWallet, 2 * COIN); | ||||
add_coin(testWallet, 3 * COIN); | add_coin(testWallet, 3 * COIN); | ||||
// now we have 5+6+7+8+18+20+30+100+200+300+400 = 1094 cents | // now we have 5+6+7+8+18+20+30+100+200+300+400 = 1094 cents | ||||
add_coin(testWallet, 4 * COIN); | add_coin(testWallet, 4 * COIN); | ||||
BOOST_CHECK(testWallet.SelectCoinsMinConf( | BOOST_CHECK(testWallet.SelectCoinsMinConf( | ||||
95 * CENT, filter_confirmed, GroupCoins(vCoins), setCoinsRet, | 95 * CENT, filter_confirmed, GroupCoins(vCoins), setCoinsRet, | ||||
nValueRet, coin_selection_params, bnb_used)); | nValueRet, coin_selection_params, bnb_used)); | ||||
// we should get 1 BCH in 1 coin | // we should get 1,000,000 XEC in 1 coin | ||||
BOOST_CHECK_EQUAL(nValueRet, 1 * COIN); | BOOST_CHECK_EQUAL(nValueRet, 1 * COIN); | ||||
BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U); | BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U); | ||||
BOOST_CHECK(testWallet.SelectCoinsMinConf( | BOOST_CHECK(testWallet.SelectCoinsMinConf( | ||||
195 * CENT, filter_confirmed, GroupCoins(vCoins), setCoinsRet, | 195 * CENT, filter_confirmed, GroupCoins(vCoins), setCoinsRet, | ||||
nValueRet, coin_selection_params, bnb_used)); | nValueRet, coin_selection_params, bnb_used)); | ||||
// we should get 2 BCH in 1 coin | // we should get 2,000,000 XEC in 1 coin | ||||
BOOST_CHECK_EQUAL(nValueRet, 2 * COIN); | BOOST_CHECK_EQUAL(nValueRet, 2 * COIN); | ||||
BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U); | BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U); | ||||
// empty the wallet and start again, now with fractions of a cent, to | // empty the wallet and start again, now with fractions of a cent, to | ||||
// test small change avoidance | // test small change avoidance | ||||
empty_wallet(); | empty_wallet(); | ||||
add_coin(testWallet, 1 * MIN_CHANGE / 10); | add_coin(testWallet, 1 * MIN_CHANGE / 10); | ||||
▲ Show 20 Lines • Show All 281 Lines • Show Last 20 Lines |