summaryrefslogtreecommitdiff
path: root/internal/perc
AgeCommit message (Collapse)Author
2026-05-23docs(internal/perc): fix misleading comments in perc.goPaul Buetow
- ParsingStrategy: clarify that (nil, false, nil) means input not matched, not that an error occurred. Errors only happen when the pattern matches but value parsing fails. - ParseCalculation: remove mention of "formatting options" since callers get raw values and the Format() method, not configurable formatting.
2026-05-23test: add unit tests for ParseCalculation() and Calculation.Format()Paul Buetow
Add tests for ParseCalculation() exported API and Calculation struct: - ParseCalculation returns correct *Calculation for all 3 types (PercentOfY, IsWhatPercentOfY, IsYPercentOfWhat) - Correct field values: Type, Percent, Base, Result, Steps - 'what is' prefix stripping via ParseCalculation - Case insensitivity via ParseCalculation - Division by zero edge cases via ParseCalculation - Invalid input returns error via ParseCalculation - Calculation.Format() for each CalculationType - Calculation.Format() with and without Steps - Decimal and large value handling
2026-03-25code-quality: Various improvements to code quality and thread safetyPaul Buetow
2026-03-25Rename calculator package to percPaul Buetow
Renamed internal/calculator directory to internal/perc, updated package name from 'calculator' to 'perc', and updated all import references.