@@ -1177,6 +1177,34 @@ TEST(carrot_impl, multi_account_transfer_over_transaction_16)
1177
1177
subtest_multi_account_transfer_over_transaction (tx_proposal);
1178
1178
}
1179
1179
// ----------------------------------------------------------------------------------------------------------------------
1180
+ TEST (carrot_impl, get_input_count_for_max_usable_money_1)
1181
+ {
1182
+ const std::vector<rct::xmr_amount> amounts{17 , 7 , 11 , 8 , 9 };
1183
+
1184
+ const std::map<std::size_t , rct::xmr_amount> fee_by_input_count{
1185
+ {1 , 10 },
1186
+ {2 , 20 },
1187
+ {3 , 30 },
1188
+ {4 , 40 },
1189
+ {5 , 50 },
1190
+ {6 , 60 },
1191
+ {7 , 70 },
1192
+ {8 , 80 }
1193
+ };
1194
+
1195
+ const auto input_count_for_max_usable_money = carrot::get_input_count_for_max_usable_money (
1196
+ amounts.cbegin (),
1197
+ amounts.cend (),
1198
+ fee_by_input_count.size (),
1199
+ fee_by_input_count);
1200
+
1201
+ const std::pair<std::size_t , boost::multiprecision::uint128_t > expected_input_count_for_max_usable_money{
1202
+ 2 , 17 + 11
1203
+ };
1204
+
1205
+ EXPECT_EQ (expected_input_count_for_max_usable_money, input_count_for_max_usable_money);
1206
+ }
1207
+ // ----------------------------------------------------------------------------------------------------------------------
1180
1208
TEST (carrot_impl, make_single_transfer_input_selector_not_enough_money_1)
1181
1209
{
1182
1210
// no input candidates, should throw `not_enough_money`
@@ -1603,6 +1631,13 @@ TEST(carrot_impl, make_multiple_carrot_transaction_proposals_sweep_1)
1603
1631
ASSERT_EQ (1 , tx_proposal.selfsend_payment_proposals .size ());
1604
1632
ASSERT_TRUE (tx_proposal.extra .empty ());
1605
1633
1634
+ const carrot::CarrotPaymentProposalVerifiableSelfSendV1 &selfsend_payment_proposal
1635
+ = tx_proposal.selfsend_payment_proposals .at (0 );
1636
+ ASSERT_EQ (0 , selfsend_payment_proposal.proposal .amount );
1637
+ ASSERT_EQ (0 , selfsend_payment_proposal.subaddr_index .index .major );
1638
+ ASSERT_EQ (0 , selfsend_payment_proposal.subaddr_index .index .minor );
1639
+ ASSERT_EQ (carrot::AddressDeriveType::Auto, selfsend_payment_proposal.subaddr_index .derive_type );
1640
+
1606
1641
carrot::CarrotPaymentProposalV1 modified_normal_payment_proposal = normal_payment_proposal;
1607
1642
modified_normal_payment_proposal.amount = tx_proposal.normal_payment_proposals .at (0 ).amount ;
1608
1643
ASSERT_EQ (modified_normal_payment_proposal, tx_proposal.normal_payment_proposals .at (0 ));
@@ -1622,4 +1657,4 @@ TEST(carrot_impl, make_multiple_carrot_transaction_proposals_sweep_1)
1622
1657
EXPECT_EQ (n_input_enote_amounts, seen_ota.size ());
1623
1658
}
1624
1659
}
1625
- // ----------------------------------------------------------------------------------------------------------------------
1660
+ // ----------------------------------------------------------------------------------------------------------------------
0 commit comments