Skip to content

Commit c72a11a

Browse files
committed
test: Add cost_of_change parameter assertions to bnb_search_test
1 parent eb3c6b0 commit c72a11a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/wallet/test/coinselector_tests.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,19 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
189189
actual_selection.clear();
190190
selection.clear();
191191

192+
// Cost of change is greater than the difference between target value and utxo sum
193+
add_coin(1 * CENT, 1, actual_selection);
194+
BOOST_CHECK(SelectCoinsBnB(GroupCoins(utxo_pool), 0.9 * CENT, 0.5 * CENT, selection, value_ret, not_input_fees));
195+
BOOST_CHECK_EQUAL(value_ret, 1 * CENT);
196+
BOOST_CHECK(equal_sets(selection, actual_selection));
197+
actual_selection.clear();
198+
selection.clear();
199+
200+
// Cost of change is less than the difference between target value and utxo sum
201+
BOOST_CHECK(!SelectCoinsBnB(GroupCoins(utxo_pool), 0.9 * CENT, 0, selection, value_ret, not_input_fees));
202+
actual_selection.clear();
203+
selection.clear();
204+
192205
// Select 10 Cent
193206
add_coin(5 * CENT, 5, utxo_pool);
194207
add_coin(4 * CENT, 4, actual_selection);

0 commit comments

Comments
 (0)