From 6bb2d481ad565a255701e18175959609e31ba7c1 Mon Sep 17 00:00:00 2001 From: macchiati Date: Mon, 13 May 2024 21:16:03 -0700 Subject: [PATCH] CLDR-15216 Add light-speed --- common/main/en.xml | 17 ++++++++++++- common/main/root.xml | 4 ++++ common/supplemental/units.xml | 2 +- common/validity/unit.xml | 1 + .../java/org/unicode/cldr/util/DtdData.java | 1 + .../org/unicode/cldr/unittest/TestUnits.java | 24 ++++++++++++++++--- 6 files changed, 44 insertions(+), 5 deletions(-) diff --git a/common/main/en.xml b/common/main/en.xml index 771ee697ba2..e4027df8360 100644 --- a/common/main/en.xml +++ b/common/main/en.xml @@ -7514,6 +7514,11 @@ annotations. {0} knot {0} knots + + light + {0} light + {0} light + Beaufort Beaufort {0} @@ -8593,6 +8598,11 @@ annotations. {0} kn {0} kn + + light + {0} light + {0} light + Bft B {0} @@ -9669,7 +9679,12 @@ annotations. {0}kn {0}kn - + + light + {0}light + {0}light + + Bft B{0} B{0} diff --git a/common/main/root.xml b/common/main/root.xml index 4ccb65620f0..ce7e2da7d37 100644 --- a/common/main/root.xml +++ b/common/main/root.xml @@ -5615,6 +5615,10 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ kn {0} kn + + light + {0} light + Bft B {0} diff --git a/common/supplemental/units.xml b/common/supplemental/units.xml index 612d6b49e03..4196bfeeb89 100644 --- a/common/supplemental/units.xml +++ b/common/supplemental/units.xml @@ -348,8 +348,8 @@ For terms of use, see http://www.unicode.org/copyright.html + - diff --git a/common/validity/unit.xml b/common/validity/unit.xml index 65cba0bd2cb..a49f1538ee5 100644 --- a/common/validity/unit.xml +++ b/common/validity/unit.xml @@ -241,6 +241,7 @@ For terms of use, see http://www.unicode.org/copyright.html volume-koku mass-fun duration-night + speed-light-speed acceleration-meter-per-second-squared diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdData.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdData.java index 00a52df742b..6b842bd4787 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdData.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/DtdData.java @@ -1869,6 +1869,7 @@ private static final class UnitOrderHolder { "volume-sai", "volume-to-jp", "volume-koku", + "speed-light-speed", "mass-fun", "duration-night")) .freeze(); diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUnits.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUnits.java index dc0931a07b3..ffc85b2c521 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUnits.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUnits.java @@ -3882,7 +3882,7 @@ public void testUnitSystems() { || cldrSystems.contains(UnitSystem.si) && !nistSystems.contains(UnitSystem.si) || cldrSystems.contains(UnitSystem.si_acceptable) && !nistSystems.contains(UnitSystem.si_acceptable)) { - if (unit.equals("100-kilometer")) { + if (unit.equals("100-kilometer") || unit.equals("light-speed")) { continue; } fails.add( @@ -4459,14 +4459,32 @@ public void testFactorsInUnits() { {"item-per-1e9-item", "item-per-item", "1/1000000000"}, {"item-per-1e9", "item", "1/1000000000"}, }; + checkConversionToBase(tests); + } + + public void checkConversionToBase(String[][] tests) { + int count = 0; for (String[] test : tests) { + ++count; Output metric = new Output<>(); final String inputUnit = test[0]; final String expectedTarget = test[1]; final Rational expectedFactor = Rational.of(test[2]); ConversionInfo unitId1 = converter.parseUnitId(inputUnit, metric, DEBUG); - assertEquals(inputUnit, expectedTarget, metric.value); - assertEquals(inputUnit, expectedFactor, unitId1.factor); + assertEquals(count + ")\t" + inputUnit + " to base", expectedTarget, metric.value); + assertEquals(count + ")\t" + inputUnit + " factor", expectedFactor, unitId1.factor); } } + + public void testLightSpeed() { + String[][] tests = { + {"light-speed", "meter-per-second", "299792458"}, + {"light-speed-second", "meter-second-per-second", "299792458"}, + {"light-speed-minute", "meter-second-per-second", "299792458*60"}, + {"light-speed-hour", "meter-second-per-second", "299792458*3600"}, + {"light-speed-day", "meter-second-per-second", "299792458*86400"}, + {"light-speed-week", "meter-second-per-second", "299792458*604800"}, + }; + checkConversionToBase(tests); + } }