Skip to content

Test distribute_with_remainder returns full amount for a single recipient #573

Description

@Kingsman-99

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

  • Add a test in contracts/split/src/calc.rs (or a new tests/calc_tests.rs) that calls distribute_with_remainder with one recipient whose ratio equals denom
  • Assert the result Vec has length 1 and result[0] == total
  • Test is named single_recipient_gets_full_amount
  • cargo test passes

Context

  • Target file: contracts/split/src/calc.rs
  • No external dependencies needed — use Env::default() from soroban_sdk::testutils

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptstestingTests — unit, integration, fuzz

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions