aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test/coinselector_tests.cpp
diff options
context:
space:
mode:
authorYancy Ribbens <yancy.ribbens@gmail.com>2020-02-20 14:59:22 -0600
committerYancy Ribbens <yancy.ribbens@gmail.com>2020-02-22 11:11:09 -0600
commitc72a11a1a030036eb1fe4472086a9733731961ce (patch)
tree4983ed7d873b3b55f29ba9817b04b8204585fd12 /src/wallet/test/coinselector_tests.cpp
parenteb3c6b0912349873113bfd49baf1c505bb48d9cf (diff)
test: Add cost_of_change parameter assertions to bnb_search_test
Diffstat (limited to 'src/wallet/test/coinselector_tests.cpp')
-rw-r--r--src/wallet/test/coinselector_tests.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet/test/coinselector_tests.cpp b/src/wallet/test/coinselector_tests.cpp
index d65a0e9075..21d57cb898 100644
--- a/src/wallet/test/coinselector_tests.cpp
+++ b/src/wallet/test/coinselector_tests.cpp
@@ -189,6 +189,19 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
actual_selection.clear();
selection.clear();
+ // Cost of change is greater than the difference between target value and utxo sum
+ add_coin(1 * CENT, 1, actual_selection);
+ BOOST_CHECK(SelectCoinsBnB(GroupCoins(utxo_pool), 0.9 * CENT, 0.5 * CENT, selection, value_ret, not_input_fees));
+ BOOST_CHECK_EQUAL(value_ret, 1 * CENT);
+ BOOST_CHECK(equal_sets(selection, actual_selection));
+ actual_selection.clear();
+ selection.clear();
+
+ // Cost of change is less than the difference between target value and utxo sum
+ BOOST_CHECK(!SelectCoinsBnB(GroupCoins(utxo_pool), 0.9 * CENT, 0, selection, value_ret, not_input_fees));
+ actual_selection.clear();
+ selection.clear();
+
// Select 10 Cent
add_coin(5 * CENT, 5, utxo_pool);
add_coin(4 * CENT, 4, actual_selection);