From e625bdb0b4458729a7462ff7289b2b10022f600f Mon Sep 17 00:00:00 2001 From: Hugo van der Merwe <17109322+hugovdm@users.noreply.github.com> Date: Mon, 30 Mar 2020 18:29:39 +0200 Subject: [PATCH] Reorder unit tests, drop unneeded comments. 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 | 3 --- icu4c/source/test/intltest/unitsdatatest.cpp | 23 ++++++++++---------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/icu4c/source/i18n/unitsdata.h b/icu4c/source/i18n/unitsdata.h index cf0f5b76d60..6d6b737250c 100644 --- a/icu4c/source/i18n/unitsdata.h +++ b/icu4c/source/i18n/unitsdata.h @@ -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. diff --git a/icu4c/source/test/intltest/unitsdatatest.cpp b/icu4c/source/test/intltest/unitsdatatest.cpp index cd3e213fd76..f61f85fe822 100644 --- a/icu4c/source/test/intltest/unitsdatatest.cpp +++ b/icu4c/source/test/intltest/unitsdatatest.cpp @@ -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); -- 2.40.0