Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: source/test/intltest/measfmttest.cpp

Issue 1621943002: ICU 56 step 4: Apply post-56 fixes for measure/date format (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@56goog
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/test/intltest/itutil.cpp ('k') | source/test/intltest/quantityformattertest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * Copyright (C) 2014-2015, International Business Machines Corporation and * 3 * Copyright (C) 2014-2015, International Business Machines Corporation and *
4 * others. All Rights Reserved. * 4 * others. All Rights Reserved. *
5 ******************************************************************************* 5 *******************************************************************************
6 * 6 *
7 * File MEASFMTTEST.CPP 7 * File MEASFMTTEST.CPP
8 * 8 *
9 ******************************************************************************* 9 *******************************************************************************
10 */ 10 */
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void TestMultiples(); 54 void TestMultiples();
55 void TestGram(); 55 void TestGram();
56 void TestCurrencies(); 56 void TestCurrencies();
57 void TestFieldPosition(); 57 void TestFieldPosition();
58 void TestFieldPositionMultiple(); 58 void TestFieldPositionMultiple();
59 void TestBadArg(); 59 void TestBadArg();
60 void TestEquality(); 60 void TestEquality();
61 void TestGroupingSeparator(); 61 void TestGroupingSeparator();
62 void TestDoubleZero(); 62 void TestDoubleZero();
63 void TestUnitPerUnitResolution(); 63 void TestUnitPerUnitResolution();
64 void TestIndividualPluralFallback();
64 void verifyFormat( 65 void verifyFormat(
65 const char *description, 66 const char *description,
66 const MeasureFormat &fmt, 67 const MeasureFormat &fmt,
67 const Measure *measures, 68 const Measure *measures,
68 int32_t measureCount, 69 int32_t measureCount,
69 const char *expected); 70 const char *expected);
70 void verifyFormatWithPrefix( 71 void verifyFormatWithPrefix(
71 const char *description, 72 const char *description,
72 const MeasureFormat &fmt, 73 const MeasureFormat &fmt,
73 const UnicodeString &prefix, 74 const UnicodeString &prefix,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 TESTCASE_AUTO(TestMultiples); 135 TESTCASE_AUTO(TestMultiples);
135 TESTCASE_AUTO(TestGram); 136 TESTCASE_AUTO(TestGram);
136 TESTCASE_AUTO(TestCurrencies); 137 TESTCASE_AUTO(TestCurrencies);
137 TESTCASE_AUTO(TestFieldPosition); 138 TESTCASE_AUTO(TestFieldPosition);
138 TESTCASE_AUTO(TestFieldPositionMultiple); 139 TESTCASE_AUTO(TestFieldPositionMultiple);
139 TESTCASE_AUTO(TestBadArg); 140 TESTCASE_AUTO(TestBadArg);
140 TESTCASE_AUTO(TestEquality); 141 TESTCASE_AUTO(TestEquality);
141 TESTCASE_AUTO(TestGroupingSeparator); 142 TESTCASE_AUTO(TestGroupingSeparator);
142 TESTCASE_AUTO(TestDoubleZero); 143 TESTCASE_AUTO(TestDoubleZero);
143 TESTCASE_AUTO(TestUnitPerUnitResolution); 144 TESTCASE_AUTO(TestUnitPerUnitResolution);
145 TESTCASE_AUTO(TestIndividualPluralFallback);
144 TESTCASE_AUTO_END; 146 TESTCASE_AUTO_END;
145 } 147 }
146 148
147 void MeasureFormatTest::TestCompatible53_1() { 149 void MeasureFormatTest::TestCompatible53_1() {
148 UErrorCode status = U_ZERO_ERROR; 150 UErrorCode status = U_ZERO_ERROR;
149 LocalPointer<MeasureUnit> measureUnit; 151 LocalPointer<MeasureUnit> measureUnit;
150 measureUnit.adoptInstead(MeasureUnit::createGForce(status)); 152 measureUnit.adoptInstead(MeasureUnit::createGForce(status));
151 measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); 153 measureUnit.adoptInstead(MeasureUnit::createArcMinute(status));
152 measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); 154 measureUnit.adoptInstead(MeasureUnit::createArcSecond(status));
153 measureUnit.adoptInstead(MeasureUnit::createDegree(status)); 155 measureUnit.adoptInstead(MeasureUnit::createDegree(status));
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 UnicodeString actual; 1583 UnicodeString actual;
1582 fmt.formatMeasurePerUnit( 1584 fmt.formatMeasurePerUnit(
1583 measure, 1585 measure,
1584 *sqInch, 1586 *sqInch,
1585 actual, 1587 actual,
1586 pos, 1588 pos,
1587 status); 1589 status);
1588 assertEquals("", "50 psi", actual); 1590 assertEquals("", "50 psi", actual);
1589 } 1591 }
1590 1592
1593 void MeasureFormatTest::TestIndividualPluralFallback() {
1594 // See ticket #11986 "incomplete fallback in MeasureFormat".
1595 // In CLDR 28, fr_CA temperature-generic/short has only the "one" form,
1596 // and falls back to fr for the "other" form.
1597 IcuTestErrorCode errorCode(*this, "TestIndividualPluralFallback");
1598 MeasureFormat mf("fr_CA", UMEASFMT_WIDTH_SHORT, errorCode);
1599 LocalPointer<Measure> twoDeg(
1600 new Measure(2, MeasureUnit::createGenericTemperature(errorCode), errorCo de), errorCode);
1601 UnicodeString expected = UNICODE_STRING_SIMPLE("2\\u00B0").unescape();
1602 UnicodeString actual;
1603 assertEquals("2 deg temp in fr_CA", expected, mf.format(twoDeg.orphan(), act ual, errorCode));
1604 }
1605
1591 void MeasureFormatTest::verifyFieldPosition( 1606 void MeasureFormatTest::verifyFieldPosition(
1592 const char *description, 1607 const char *description,
1593 const MeasureFormat &fmt, 1608 const MeasureFormat &fmt,
1594 const UnicodeString &prefix, 1609 const UnicodeString &prefix,
1595 const Measure *measures, 1610 const Measure *measures,
1596 int32_t measureCount, 1611 int32_t measureCount,
1597 NumberFormat::EAlignmentFields field, 1612 NumberFormat::EAlignmentFields field,
1598 int32_t start, 1613 int32_t start,
1599 int32_t end) { 1614 int32_t end) {
1600 // 8 char lead 1615 // 8 char lead
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 verifyFormat(description, fmt, expectedResults[i].measures, expectedResu lts[i].count, expectedResults[i].expected); 1672 verifyFormat(description, fmt, expectedResults[i].measures, expectedResu lts[i].count, expectedResults[i].expected);
1658 } 1673 }
1659 } 1674 }
1660 1675
1661 extern IntlTest *createMeasureFormatTest() { 1676 extern IntlTest *createMeasureFormatTest() {
1662 return new MeasureFormatTest(); 1677 return new MeasureFormatTest();
1663 } 1678 }
1664 1679
1665 #endif 1680 #endif
1666 1681
OLDNEW
« no previous file with comments | « source/test/intltest/itutil.cpp ('k') | source/test/intltest/quantityformattertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698