icu-units / icu

This is a staging repository for work on Units handling in ICU, and tracks some ongoing development. Jira remains the primary Issue Tracker for ICU though! For the ICU project proper, see https://github.com/unicode-org/icu.
0 stars 0 forks source link

Reliably test manual Java unit-constant code, or replace with run-time data parsing #128

Open hugovdm opened 3 years ago

hugovdm commented 3 years ago

We currently have manual implementations of "unitConstants" - for example in3_to_m3, ft3_to_m3, etc - rather than parsing and calculating constants from the units resources.

In ICU4C we have unit tests that at least ensure the code and the constants are in sync. In ICU4J, we currently rely on code review helping ensure the same changes are made.

ICU4J requires more changes than ICU4C though, so I think it worthwhile to add unitConstant freshness unit tests to Java too, as well as to try to have tests that would fail if any of the changes needed for a new constant is missing.

An alternative: more work, but more resilient / less work in the event of CLDR data changes: writing parsing code to pull constants out of the units resource file.

sffc commented 3 years ago