void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = NULL);
void testBasic();
+ void testSiPrefixes();
void testMass();
void testTemperature();
- void testSiPrefixes();
+ void testArea();
};
extern IntlTest *createUnitsTest()
}
TESTCASE_AUTO_BEGIN;
TESTCASE_AUTO(testBasic);
+ TESTCASE_AUTO(testSiPrefixes);
TESTCASE_AUTO(testMass);
TESTCASE_AUTO(testTemperature);
- TESTCASE_AUTO(testSiPrefixes);
+ TESTCASE_AUTO(testArea);
TESTCASE_AUTO_END;
}
}
}
+void UnitsTest::testArea()
+{
+ IcuTestErrorCode status(*this, "Units Area");
+
+ // Test Cases
+ struct TestCase
+ {
+ const char16_t *source;
+ const char16_t *target;
+ const double inputValue;
+ const double expectedValue;
+ } testCases[]{
+ {u"square-meter", u"square-yard", 10.0, 11.9599},
+ {u"hectare", u"square-yard", 1.0, 11959.9},
+ {u"square-mile", u"square-foot", 0.0001, 2787.84}};
+
+ for (const auto &testCase : testCases)
+ {
+ assertEquals("test convert", testConvert(testCase.source, testCase.target, testCase.inputValue), testCase.expectedValue);
+ }
+}
+
#endif /* #if !UCONFIG_NO_FORMATTING */