Description
The distribute_with_remainder function in contracts/split/src/calc.rs handles the edge case of a single recipient, but there is no dedicated unit test confirming that 100% of total is returned rather than a rounded-down value. A focused test would lock in this guarantee and catch future regressions.
Acceptance Criteria
Context
- Target file:
contracts/split/src/calc.rs
- No external dependencies needed — use
Env::default() from soroban_sdk::testutils
Description
The
distribute_with_remainderfunction incontracts/split/src/calc.rshandles the edge case of a single recipient, but there is no dedicated unit test confirming that 100% oftotalis returned rather than a rounded-down value. A focused test would lock in this guarantee and catch future regressions.Acceptance Criteria
contracts/split/src/calc.rs(or a newtests/calc_tests.rs) that callsdistribute_with_remainderwith one recipient whose ratio equalsdenomVechas length 1 andresult[0] == totalsingle_recipient_gets_full_amountcargo testpassesContext
contracts/split/src/calc.rsEnv::default()fromsoroban_sdk::testutils