MeasureUnit sourceUnit = MeasureUnit::forIdentifier(testCase.source, status);
MeasureUnit targetUnit = MeasureUnit::forIdentifier(testCase.target, status);
- // TODO(younies): enable this again
+ MeasureUnit baseUnit;
+ auto unitsInfos = getConversionRatesInfo(sourceUnit, targetUnit, &baseUnit, status);
+ UnitConverter converter(sourceUnit, targetUnit, unitsInfos, status);
- // UnitConverter converter(sourceUnit, targetUnit, status);
+ double actual = converter.convert(testCase.inputValue);
- // double actual = converter.convert(testCase.inputValue);
-
- // assertEqualsNear("test Conversion", testCase.expectedValue, actual, 0.0001);
+ assertEqualsNear("test Conversion", testCase.expectedValue, actual, 0.0001);
}
void UnitsTest::testBasic() {
};
for (const auto &testCase : testCases) {
- UErrorCode status = U_ZERO_ERROR;
- MeasureUnit sourceUnit = MeasureUnit::forIdentifier(testCase.source, status);
- MeasureUnit targetUnit = MeasureUnit::forIdentifier(testCase.target, status);
-
- // TODO(younies): enable this again
-
- // UnitConverter converter(sourceUnit, targetUnit, status);
-
- // double actual = converter.convert(testCase.inputValue);
-
- // assertEqualsNear("test Conversion", testCase.expectedValue, actual, 0.0001);
+ verifyTestCase(testCase);
}
}
* Parses the format used by unitPreferencesTest.txt, calling lineFn for each
* line.
*
- * This is a modified version of u_parseDelimitedFile, customised for
+ * This is a modified version of u_parseDelimitedFile, customized for
* unitPreferencesTest.txt, due to it having a variable number of fields per
* line.
*/