ICU-21284 Deal with remaining unit normalization TODOs

See #1580
This commit is contained in:
Hugo van der Merwe 2021-02-16 13:04:59 +00:00
parent 9c73e15d02
commit dcfa2a7874
4 changed files with 8 additions and 16 deletions

View file

@ -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;
}

View file

@ -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()) {

View file

@ -122,8 +122,9 @@ public class SingleUnitImpl {
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;
}

View file

@ -3689,7 +3689,7 @@ public class MeasureUnitTest extends TestFmwk {
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 class MeasureUnitTest extends TestFmwk {
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 {