]> granicus.if.org Git - icu/commitdiff
Reorder unit tests, drop unneeded comments.
authorHugo van der Merwe <17109322+hugovdm@users.noreply.github.com>
Mon, 30 Mar 2020 16:29:39 +0000 (18:29 +0200)
committerHugo van der Merwe <17109322+hugovdm@users.noreply.github.com>
Tue, 31 Mar 2020 16:39:38 +0000 (18:39 +0200)
This code and these tests have become quite a bit simpler since
we're no longer trying to calculate the 'compound base unit'
here.

icu4c/source/i18n/unitsdata.h
icu4c/source/test/intltest/unitsdatatest.cpp

index cf0f5b76d60073922ffca6781c16ddefb1b9fda7..6d6b737250ce70c65d50f262e7b57b6d0d224193 100644 (file)
@@ -51,9 +51,6 @@ struct U_I18N_API UnitPreference {
  * Collects and returns ConversionRateInfo needed for conversions from source
  * and to target.
  *
- * If source and target are not compatible for conversion, status will be set to
- * U_ILLEGAL_ARGUMENT_ERROR.
- *
  * @param source The source unit (the unit type converted from).
  * @param target The target unit (the unit type converted to).
  * @param status Receives status.
index cd3e213fd760923ebe091cce2eea217a8cb9c728..f61f85fe822f5f8385ddbe253e1fcf2a182cb50a 100644 (file)
@@ -34,27 +34,26 @@ void UnitsDataTest::testGetConversionRateInfo() {
         // Expected: units whose conversion rates are expected in the results.
         const char *expectedOutputs[MAX_NUM_RATES];
     } testCases[]{
-        {"centimeter-per-square-milligram",
-         "inch-per-square-ounce",
-         {"meter", "gram", "inch", "ounce", NULL}},
-
+        {"meter", "kilometer", {"meter", NULL, NULL, NULL, NULL}},
         {"liter", "gallon", {"liter", "gallon", NULL, NULL, NULL}},
+        {"watt", "horsepower", {"watt", "horsepower", NULL, NULL, NULL}},
+        {"mile-per-hour", "dekameter-per-hour", {"mile", "hour", "meter", NULL, NULL}},
 
         // Sequence
         {"stone-and-pound", "ton", {"pound", "stone", "ton", NULL, NULL}},
 
-        {"mile-per-hour", "dekameter-per-hour", {"mile", "hour", "meter", NULL, NULL}},
-
-        // Power: watt
-        {"watt", "horsepower", {"watt", "horsepower", NULL, NULL, NULL}},
-
-        // Energy: joule
+        // Compound
+        {"centimeter-per-square-milligram",
+         "inch-per-square-ounce",
+         {"meter", "gram", "inch", "ounce", NULL}},
         {"therm-us",
          "kilogram-square-meter-per-square-second",
          {"therm-us", "kilogram", "meter", "second", NULL}},
 
-        // Add "reciprocal" example: consumption and consumption-inverse
-        {"liter-per-100-kilometer", "mile-per-gallon", {"liter", "100-kilometer", "mile", "gallon", NULL}},
+        // "Reciprocal" example: consumption and consumption-inverse
+        {"liter-per-100-kilometer",
+         "mile-per-gallon",
+         {"liter", "100-kilometer", "mile", "gallon", NULL}},
     };
     for (const auto &t : testCases) {
         logln("---testing: source=\"%s\", target=\"%s\"", t.sourceUnit, t.targetUnit);