aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-01-07 09:24:28 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-01-07 09:24:34 +0100
commit55415609380009fcc47ba345f467393f9933453f (patch)
tree502865f2cf6b2783b66369f9dadc796874ff9620 /src/wallet/test
parentd964b5bb1a1c3664167819c0632500b924c38347 (diff)
parentfaf538bfdbb4ecebde73e95c80718c2d9ecee1f5 (diff)
Merge pull request #7293
faf538b [trivial] Merge test cases and replace CENT with COIN (MarcoFalke) fa3c7e6 [wallet] Add regression test for vValue sort order (MarcoFalke)
Diffstat (limited to 'src/wallet/test')
-rw-r--r--src/wallet/test/wallet_tests.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index f03cb4896c..e84d588026 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -328,7 +328,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
empty_wallet();
}
-BOOST_AUTO_TEST_CASE(pruning_in_ApproximateBestSet)
+BOOST_AUTO_TEST_CASE(ApproximateBestSubset)
{
CoinSet setCoinsRet;
CAmount nValueRet;
@@ -336,15 +336,28 @@ BOOST_AUTO_TEST_CASE(pruning_in_ApproximateBestSet)
LOCK(wallet.cs_wallet);
empty_wallet();
+
+ // Test vValue sort order
+ for (int i = 0; i < 1000; i++)
+ add_coin(1000 * COIN);
+ add_coin(3 * COIN);
+
+ BOOST_CHECK(wallet.SelectCoinsMinConf(1003 * COIN, 1, 6, vCoins, setCoinsRet, nValueRet));
+ BOOST_CHECK_EQUAL(nValueRet, 1003 * COIN);
+ BOOST_CHECK_EQUAL(setCoinsRet.size(), 2U);
+
+ empty_wallet();
+
+ // Test trimming
for (int i = 0; i < 100; i++)
- add_coin(10 * CENT);
+ add_coin(10 * COIN);
for (int i = 0; i < 100; i++)
- add_coin(1000 * CENT);
+ add_coin(1000 * COIN);
- BOOST_CHECK(wallet.SelectCoinsMinConf(100001 * CENT, 1, 6, vCoins, setCoinsRet, nValueRet));
+ BOOST_CHECK(wallet.SelectCoinsMinConf(100001 * COIN, 1, 6, vCoins, setCoinsRet, nValueRet));
// We need all 100 larger coins and exactly one small coin.
- // Superfluous small coins must be pruned:
- BOOST_CHECK_EQUAL(nValueRet, 100010 * CENT);
+ // Superfluous small coins must be trimmed from the set:
+ BOOST_CHECK_EQUAL(nValueRet, 100010 * COIN);
BOOST_CHECK_EQUAL(setCoinsRet.size(), 101);
}