Skip to content

Add unit tests for the investment share percentage calculator handling floating point correctly using integer arithmetic #204

Description

@Chucks1093

Summary

Share percentages must be calculated using integer arithmetic to avoid floating-point drift (e.g. 1/3 = 33.333…%). Unit tests should confirm the calculator returns correct percentages, that all shares sum to exactly 100%, and that the remainder is assigned to the largest investor.

Scope

  • Test three equal investors of 3000 each (total 9000) each get 33% with 1% remainder assigned to the first investor
  • Test two investors with 2500 and 7500 get 25% and 75% exactly
  • Test a single investor gets 100%
  • Assert the sum of all returned percentages equals exactly 100
  • Assert remainder always assigned to the investor with the largest commitment

Acceptance Criteria

  • Equal three-way split sums to 100% with remainder assigned correctly
  • 25/75 split returns exact percentages
  • Single investor returns 100%
  • All percentages always sum to exactly 100
  • No floating-point arithmetic used in implementation

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions