diff options
| author | Ross Nicoll <[email protected]> | 2014-04-13 00:07:06 +0100 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2014-04-13 00:07:06 +0100 |
| commit | 71532b730d52ea578e947514d21fb5560e15d704 (patch) | |
| tree | 20736bc5a1634aea1f6c6d10acb178f7e5bf96be /src/test/wallet_tests.cpp | |
| parent | Shifted unit in wallet tests from CENT to COIN as a base, to avoid problems w... (diff) | |
| download | discoin-71532b730d52ea578e947514d21fb5560e15d704.tar.xz discoin-71532b730d52ea578e947514d21fb5560e15d704.zip | |
Reworked comment around the code for identifying transactions to spend, to separate explanation of condition, and result.
Corrected comment references to "cent", with "coin" in wallet tests, to match changes to units.
Diffstat (limited to 'src/test/wallet_tests.cpp')
| -rw-r--r-- | src/test/wallet_tests.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/wallet_tests.cpp b/src/test/wallet_tests.cpp index 8a047715d..b32daba99 100644 --- a/src/test/wallet_tests.cpp +++ b/src/test/wallet_tests.cpp @@ -134,32 +134,32 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests) add_coin( 7*COIN); add_coin( 8*COIN); add_coin(20*COIN); - add_coin(30*COIN); // now we have 6+7+8+20+30 = 71 cents total + add_coin(30*COIN); // now we have 6+7+8+20+30 = 71 coins total // check that we have 71 and not 72 BOOST_CHECK( wallet.SelectCoinsMinConf(71 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet)); BOOST_CHECK(!wallet.SelectCoinsMinConf(72 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet)); - // now try making 16 cents. the best smaller coins can do is 6+7+8 = 21; not as good at the next biggest coin, 20 + // now try making 16 coins. the best smaller coins can do is 6+7+8 = 21; not as good at the next biggest coin, 20 BOOST_CHECK( wallet.SelectCoinsMinConf(16 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet)); BOOST_CHECK_EQUAL(nValueRet, 20 * COIN); // we should get 20 in one coin BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U); - add_coin( 5*COIN); // now we have 5+6+7+8+20+30 = 75 cents total + add_coin( 5*COIN); // now we have 5+6+7+8+20+30 = 75 coins total - // now if we try making 16 cents again, the smaller coins can make 5+6+7 = 18 cents, better than the next biggest coin, 20 + // now if we try making 16 coins again, the smaller coins can make 5+6+7 = 18 coins, better than the next biggest coin, 20 BOOST_CHECK( wallet.SelectCoinsMinConf(16 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet)); BOOST_CHECK_EQUAL(nValueRet, 18 * COIN); // we should get 18 in 3 coins BOOST_CHECK_EQUAL(setCoinsRet.size(), 3U); add_coin( 18*COIN); // now we have 5+6+7+8+18+20+30 - // and now if we try making 16 cents again, the smaller coins can make 5+6+7 = 18 cents, the same as the next biggest coin, 18 + // and now if we try making 16 coins again, the smaller coins can make 5+6+7 = 18 coins, the same as the next biggest coin, 18 BOOST_CHECK( wallet.SelectCoinsMinConf(16 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet)); BOOST_CHECK_EQUAL(nValueRet, 18 * COIN); // we should get 18 in 1 coin BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U); // because in the event of a tie, the biggest coin wins - // now try making 11 cents. we should get 5+6 + // now try making 11 coins. we should get 5+6 BOOST_CHECK( wallet.SelectCoinsMinConf(11 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet)); BOOST_CHECK_EQUAL(nValueRet, 11 * COIN); BOOST_CHECK_EQUAL(setCoinsRet.size(), 2U); @@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests) add_coin( 100*COIN); add_coin( 200*COIN); add_coin( 300*COIN); - add_coin( 400*COIN); // now we have 5+6+7+8+18+20+30+100+200+300+400 = 1094 cents + add_coin( 400*COIN); // now we have 5+6+7+8+18+20+30+100+200+300+400 = 1094 coins BOOST_CHECK( wallet.SelectCoinsMinConf(95 * COIN, 1, 1, vCoins, setCoinsRet, nValueRet)); BOOST_CHECK_EQUAL(nValueRet, 100 * COIN); // we should get 200 DOGE in 1 coin. BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U); |