"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "source/test/intltest/numbertest_skeletons.cpp" between
icu4c-67rc-src.tgz and icu4c-67_1-src.tgz

About: ICU (International Components for Unicode) is a set of C/C++ and Java libraries providing Unicode and Globalization support for software applications on a wide variety of platforms.

numbertest_skeletons.cpp  (icu4c-67rc-src.tgz):numbertest_skeletons.cpp  (icu4c-67_1-src.tgz)
skipping to change at line 32 skipping to change at line 32
TESTCASE_AUTO_BEGIN; TESTCASE_AUTO_BEGIN;
TESTCASE_AUTO(validTokens); TESTCASE_AUTO(validTokens);
TESTCASE_AUTO(invalidTokens); TESTCASE_AUTO(invalidTokens);
TESTCASE_AUTO(unknownTokens); TESTCASE_AUTO(unknownTokens);
TESTCASE_AUTO(unexpectedTokens); TESTCASE_AUTO(unexpectedTokens);
TESTCASE_AUTO(duplicateValues); TESTCASE_AUTO(duplicateValues);
TESTCASE_AUTO(stemsRequiringOption); TESTCASE_AUTO(stemsRequiringOption);
TESTCASE_AUTO(defaultTokens); TESTCASE_AUTO(defaultTokens);
TESTCASE_AUTO(flexibleSeparators); TESTCASE_AUTO(flexibleSeparators);
TESTCASE_AUTO(wildcardCharacters); TESTCASE_AUTO(wildcardCharacters);
TESTCASE_AUTO(perUnitInArabic);
TESTCASE_AUTO_END; TESTCASE_AUTO_END;
} }
void NumberSkeletonTest::validTokens() { void NumberSkeletonTest::validTokens() {
IcuTestErrorCode status(*this, "validTokens"); IcuTestErrorCode status(*this, "validTokens");
// This tests only if the tokens are valid, not their behavior. // This tests only if the tokens are valid, not their behavior.
// Most of these are from the design doc. // Most of these are from the design doc.
static const char16_t* cases[] = { static const char16_t* cases[] = {
u"precision-integer", u"precision-integer",
skipping to change at line 364 skipping to change at line 365
// In C++, there is no distinguishing between "invalid", "unknown", and "unexpec ted" tokens. // In C++, there is no distinguishing between "invalid", "unknown", and "unexpec ted" tokens.
void NumberSkeletonTest::expectedErrorSkeleton(const char16_t** cases, int32_t c asesLen) { void NumberSkeletonTest::expectedErrorSkeleton(const char16_t** cases, int32_t c asesLen) {
for (int32_t i = 0; i < casesLen; i++) { for (int32_t i = 0; i < casesLen; i++) {
UnicodeString skeletonString(cases[i]); UnicodeString skeletonString(cases[i]);
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
NumberFormatter::forSkeleton(skeletonString, status); NumberFormatter::forSkeleton(skeletonString, status);
assertEquals(skeletonString, U_NUMBER_SKELETON_SYNTAX_ERROR, status); assertEquals(skeletonString, U_NUMBER_SKELETON_SYNTAX_ERROR, status);
} }
} }
void NumberSkeletonTest::perUnitInArabic() {
IcuTestErrorCode status(*this, "perUnitInArabic");
struct TestCase {
const char16_t* type;
const char16_t* subtype;
} cases[] = {
{u"area", u"acre"},
{u"digital", u"bit"},
{u"digital", u"byte"},
{u"temperature", u"celsius"},
{u"length", u"centimeter"},
{u"duration", u"day"},
{u"angle", u"degree"},
{u"temperature", u"fahrenheit"},
{u"volume", u"fluid-ounce"},
{u"length", u"foot"},
{u"volume", u"gallon"},
{u"digital", u"gigabit"},
{u"digital", u"gigabyte"},
{u"mass", u"gram"},
{u"area", u"hectare"},
{u"duration", u"hour"},
{u"length", u"inch"},
{u"digital", u"kilobit"},
{u"digital", u"kilobyte"},
{u"mass", u"kilogram"},
{u"length", u"kilometer"},
{u"volume", u"liter"},
{u"digital", u"megabit"},
{u"digital", u"megabyte"},
{u"length", u"meter"},
{u"length", u"mile"},
{u"length", u"mile-scandinavian"},
{u"volume", u"milliliter"},
{u"length", u"millimeter"},
{u"duration", u"millisecond"},
{u"duration", u"minute"},
{u"duration", u"month"},
{u"mass", u"ounce"},
{u"concentr", u"percent"},
{u"digital", u"petabyte"},
{u"mass", u"pound"},
{u"duration", u"second"},
{u"mass", u"stone"},
{u"digital", u"terabit"},
{u"digital", u"terabyte"},
{u"duration", u"week"},
{u"length", u"yard"},
{u"duration", u"year"},
};
for (const auto& cas1 : cases) {
for (const auto& cas2 : cases) {
UnicodeString skeleton(u"measure-unit/");
skeleton += cas1.type;
skeleton += u"-";
skeleton += cas1.subtype;
skeleton += u" ";
skeleton += u"per-measure-unit/";
skeleton += cas2.type;
skeleton += u"-";
skeleton += cas2.subtype;
status.setScope(skeleton);
UnicodeString actual = NumberFormatter::forSkeleton(skeleton, status
).locale("ar")
.formatDouble(5142.3, status)
.toString(status);
status.errIfFailureAndReset();
}
}
}
#endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* #if !UCONFIG_NO_FORMATTING */
 End of changes. 2 change blocks. 
0 lines changed or deleted 75 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)