2.0 KiB
epic, story, title, status
| epic | story | title | status |
|---|---|---|---|
| 2 | 2.1 | Unit Registry & Base Conversion | draft |
Epic 2 — Unit Conversion System
Goal: Support 200+ units across all major categories with SI prefix support.
Story 2.1: Unit Registry & Base Conversion
As a CalcPad user, I want a comprehensive unit registry covering all major measurement categories with correct base-unit conversions, So that I can convert between any supported units accurately.
Acceptance Criteria:
Given the unit registry is initialized When the list of supported categories is queried Then it includes length, mass, volume, area, speed, temperature, data, angle, time, pressure, energy, power, and force And at least 200 units are registered across all categories
Given a linear unit conversion such as 5 miles in km
When the engine evaluates it
Then it converts via the base unit (meters) using the stored conversion ratio
And the result is 8.04672 km
Given a non-linear unit conversion such as 100 °F in °C
When the engine evaluates it
Then it applies the formula (F - 32) * 5/9 rather than a simple ratio
And the result is 37.777... °C
Given a conversion between units in the same category such as 1 gallon in liters
When the engine evaluates it
Then it converts via the base unit for volume
And the result is 3.78541 liters (US gallon)
Given a conversion between incompatible categories such as 5 kg in meters
When the engine evaluates it
Then it returns a CalcResult::Error indicating that mass and length are incompatible
Given the registry data When the engine is compiled Then the registry is static (built at compile time, not loaded at runtime) And lookup of any unit by name or abbreviation is O(1) or near-O(1)
Given a unit that has multiple common names (e.g., meter, metre, m)
When any of these names is used in an expression
Then they all resolve to the same unit definition