test: characterize legacy totals and conversion arithmetic; add internal/totals (#20) #86
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!86
Loading…
Reference in a new issue
No description provided.
Delete branch "test/legacy-characterization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #20.
What
Before building checkout (#26), the legacy money arithmetic was run and the new calculator was held to its numbers.
api/testdata/legacy/Characterize.cs(run withmake legacy-golden, needs the .NET 10 SDK; output committed so CI does not need it): the legacy formulas copied verbatim, each block citing its source file, run on 34 scenarios and 195 price conversions with .NETdecimal. It writesgolden.json. The expected numbers come from .NET, not from my arithmetic.internal/totals: a pure calculation core (no database, no HTTP) for ticket checkout, overstay, upgrades, wallet top-ups and tour-operator itineraries. Its tests read the golden file and compare every field, every ticket, every scenario.What running the legacy code revealed
.5and above goes up), after adding the unrounded tax. A customer pays KES 593 or USD 116, never cents; the printed parts need not add up. This is legacy behaviour and is kept.ToString("F")): 2 decimals under en-US or in a container, 3 under en-MY, which is this team's own machines. The new exact conversion matches legacy in all 195 cases under the invariant culture.MinimumOrderandIsAutoApplyare stored and never enforced anywhere (for the promo module, #28).Deliberate differences (each pinned by a test that also asserts the recorded legacy value)
fixed discount stops at the ticket's price; a stay is sold only if priced on every day; amounts are stored in cents (
numeric(18,2)).Questions for the project owner (also in ADR 0005)
Standards review (docs/development-standards.md)
totalsis pure, depends only onmoney, and defines its own small request and result types; no database, HTTP or other module.make lint0 issues. Security scans run onmainafter merge.Known limits
make legacy-goldenand commit the result.🤖 Generated with Claude Code