fix: consolidate essence formatting into single shared function (Closes #80) #122

Merged
shahondin1624 merged 1 commits from feature/issue-80-essence-float-precision-formatting into main 2026-04-04 22:28:55 +02:00
Owner

Summary

  • Consolidated two separate essence formatting functions (in CharacterDataEditDialog.kt and ResourcePanel.kt) into a single shared formatEssence() function in lib/functions/Formatting.kt
  • The old formatEssenceForEdit() used imprecise + 0.5f rounding that could produce different results than the roundToInt-based approach in ResourcePanel
  • Added comprehensive unit tests for the shared function covering edge cases and floating-point precision

Closes #80

Test plan

  • FormatEssenceTest passes all 10 tests including floating-point precision edge cases
  • Existing tests unaffected (pre-existing ExposedDropdownMenuBox failures are unrelated)
## Summary - Consolidated two separate essence formatting functions (in `CharacterDataEditDialog.kt` and `ResourcePanel.kt`) into a single shared `formatEssence()` function in `lib/functions/Formatting.kt` - The old `formatEssenceForEdit()` used imprecise `+ 0.5f` rounding that could produce different results than the `roundToInt`-based approach in `ResourcePanel` - Added comprehensive unit tests for the shared function covering edge cases and floating-point precision Closes #80 ## Test plan - [x] `FormatEssenceTest` passes all 10 tests including floating-point precision edge cases - [x] Existing tests unaffected (pre-existing ExposedDropdownMenuBox failures are unrelated)
shahondin1624 added 1 commit 2026-04-04 22:28:50 +02:00
shahondin1624 merged commit ca0e17c89d into main 2026-04-04 22:28:55 +02:00
shahondin1624 deleted branch feature/issue-80-essence-float-precision-formatting 2026-04-04 22:28:56 +02:00
Sign in to join this conversation.