ICU-21284 Deal with remaining unit normalization TODOs
See #1580
diff --git a/icu4c/source/i18n/measunit_impl.h b/icu4c/source/i18n/measunit_impl.h
index 0f5aac4..645e821 100644
--- a/icu4c/source/i18n/measunit_impl.h
+++ b/icu4c/source/i18n/measunit_impl.h
@@ -130,8 +130,9 @@ struct U_I18N_API SingleUnitImpl : public UMemory {
if (index > other.index) {
return 1;
}
- // TODO(icu-units#70): revisit when fixing normalization. For now we're
- // sorting binary prefixes before SI prefixes, as per enum values order.
+ // TODO: revisit if the spec dictates prefix sort order - it doesn't
+ // currently. For now we're sorting binary prefixes before SI prefixes,
+ // as per enum values order.
if (unitPrefix < other.unitPrefix) {
return -1;
}
diff --git a/icu4c/source/test/intltest/measfmttest.cpp b/icu4c/source/test/intltest/measfmttest.cpp
index c9f6b42..e5dfcbb 100644
--- a/icu4c/source/test/intltest/measfmttest.cpp
+++ b/icu4c/source/test/intltest/measfmttest.cpp
@@ -4050,7 +4050,7 @@ void MeasureFormatTest::TestIdentifiers() {
{"kilogram-per-meter-per-second", "kilogram-per-meter-second"},
{"kilometer-per-second-per-megaparsec", "kilometer-per-megaparsec-second"},
- // TODO(ICU-21284): Add more test cases once the proper ranking is available.
+ // Correct order of units, as per unitQuantities in CLDR's units.xml
{"newton-meter", "newton-meter"},
{"meter-newton", "newton-meter"},
{"pound-force-foot", "pound-force-foot"},
@@ -4237,11 +4237,6 @@ void MeasureFormatTest::TestParseBuiltIns() {
continue;
}
- // TODO(ICU-21284,icu-units#70): fix normalization. Until then, ignore:
- if (uprv_strcmp(unit.getIdentifier(), "pound-force-foot") == 0) continue;
- if (uprv_strcmp(unit.getIdentifier(), "kilowatt-hour") == 0) continue;
- if (uprv_strcmp(unit.getIdentifier(), "newton-meter") == 0) continue;
-
// Prove that all built-in units are parseable, except "generic" temperature:
MeasureUnit parsed = MeasureUnit::forIdentifier(unit.getIdentifier(), status);
if (unit == MeasureUnit::getGenericTemperature()) {
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/units/SingleUnitImpl.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/units/SingleUnitImpl.java
index dd66d74..dd976cb 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/impl/units/SingleUnitImpl.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/units/SingleUnitImpl.java
@@ -122,8 +122,9 @@ int compareTo(SingleUnitImpl other) {
if (index > other.index) {
return 1;
}
- // TODO(icu-units#70): revisit when fixing normalization. For now we're
- // sorting binary prefixes before SI prefixes, for consistency with ICU4C.
+ // TODO: revisit if the spec dictates prefix sort order - it doesn't
+ // currently. For now we're sorting binary prefixes before SI prefixes,
+ // as per ICU4C's enum values order.
if (this.getPrefix().getBase() < other.getPrefix().getBase()) {
return 1;
}
diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java
index e7e28d1..eda3f75 100644
--- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java
+++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java
@@ -3689,7 +3689,7 @@ class TestCase {
new TestCase("kilogram-per-meter-per-second", "kilogram-per-meter-second"),
new TestCase("kilometer-per-second-per-megaparsec", "kilometer-per-megaparsec-second"),
- // TODO(ICU-21284): Add more test cases once the proper ranking is available.
+ // Correct order of units, as per unitQuantities in CLDR's units.xml
new TestCase("newton-meter", "newton-meter"),
new TestCase("meter-newton", "newton-meter"),
new TestCase("pound-force-foot", "pound-force-foot"),
@@ -3872,11 +3872,6 @@ public void TestParseBuiltIns() {
continue;
}
- // TODO(ICU-21284,icu-units#70): fix normalization. Until then, ignore:
- if (unit.getIdentifier() == "pound-force-foot") continue;
- if (unit.getIdentifier() == "kilowatt-hour") continue;
- if (unit.getIdentifier() == "newton-meter") continue;
-
// Prove that all built-in units are parseable, except "generic" temperature:
if (unit == MeasureUnit.GENERIC_TEMPERATURE) {
try {