@@ -150,13 +150,15 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
150
150
add_coin (1 * CENT, 1 , actual_selection);
151
151
BOOST_CHECK (SelectCoinsBnB (GroupCoins (utxo_pool), 1 * CENT, 0.5 * CENT, selection, value_ret, not_input_fees));
152
152
BOOST_CHECK (equal_sets (selection, actual_selection));
153
+ BOOST_CHECK_EQUAL (value_ret, 1 * CENT);
153
154
actual_selection.clear ();
154
155
selection.clear ();
155
156
156
157
// Select 2 Cent
157
158
add_coin (2 * CENT, 2 , actual_selection);
158
159
BOOST_CHECK (SelectCoinsBnB (GroupCoins (utxo_pool), 2 * CENT, 0.5 * CENT, selection, value_ret, not_input_fees));
159
160
BOOST_CHECK (equal_sets (selection, actual_selection));
161
+ BOOST_CHECK_EQUAL (value_ret, 2 * CENT);
160
162
actual_selection.clear ();
161
163
selection.clear ();
162
164
@@ -165,6 +167,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
165
167
add_coin (2 * CENT, 2 , actual_selection);
166
168
BOOST_CHECK (SelectCoinsBnB (GroupCoins (utxo_pool), 5 * CENT, 0.5 * CENT, selection, value_ret, not_input_fees));
167
169
BOOST_CHECK (equal_sets (selection, actual_selection));
170
+ BOOST_CHECK_EQUAL (value_ret, 5 * CENT);
168
171
actual_selection.clear ();
169
172
selection.clear ();
170
173
@@ -181,6 +184,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
181
184
add_coin (1 * CENT, 1 , actual_selection);
182
185
BOOST_CHECK (SelectCoinsBnB (GroupCoins (utxo_pool), 10 * CENT, 0.5 * CENT, selection, value_ret, not_input_fees));
183
186
BOOST_CHECK (equal_sets (selection, actual_selection));
187
+ BOOST_CHECK_EQUAL (value_ret, 10 * CENT);
184
188
actual_selection.clear ();
185
189
selection.clear ();
186
190
@@ -190,6 +194,9 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
190
194
add_coin (3 * CENT, 3 , actual_selection);
191
195
add_coin (2 * CENT, 2 , actual_selection);
192
196
BOOST_CHECK (SelectCoinsBnB (GroupCoins (utxo_pool), 10 * CENT, 5000 , selection, value_ret, not_input_fees));
197
+ BOOST_CHECK_EQUAL (value_ret, 10 * CENT);
198
+ // FIXME: this test is redundant with the above, because 1 Cent is selected, not "too small"
199
+ // BOOST_CHECK(equal_sets(selection, actual_selection));
193
200
194
201
// Select 0.25 Cent, not possible
195
202
BOOST_CHECK (!SelectCoinsBnB (GroupCoins (utxo_pool), 0.25 * CENT, 0.5 * CENT, selection, value_ret, not_input_fees));
@@ -203,6 +210,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
203
210
BOOST_CHECK (SelectCoinsBnB (GroupCoins (utxo_pool), target, 0 , selection, value_ret, not_input_fees)); // Should not exhaust
204
211
205
212
// Test same value early bailout optimization
213
+ utxo_pool.clear ();
206
214
add_coin (7 * CENT, 7 , actual_selection);
207
215
add_coin (7 * CENT, 7 , actual_selection);
208
216
add_coin (7 * CENT, 7 , actual_selection);
@@ -217,6 +225,8 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
217
225
add_coin (5 * CENT, 7 , utxo_pool);
218
226
}
219
227
BOOST_CHECK (SelectCoinsBnB (GroupCoins (utxo_pool), 30 * CENT, 5000 , selection, value_ret, not_input_fees));
228
+ BOOST_CHECK_EQUAL (value_ret, 30 * CENT);
229
+ BOOST_CHECK (equal_sets (selection, actual_selection));
220
230
221
231
// //////////////////
222
232
// Behavior tests //
0 commit comments