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

Side by Side Diff: source/test/intltest/quantityformattertest.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/measfmttest.cpp ('k') | source/test/intltest/reldatefmttest.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, 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 QUANTITYFORMATTERTEST.CPP 7 * File QUANTITYFORMATTERTEST.CPP
8 * 8 *
9 ******************************************************************************** 9 ********************************************************************************
10 */ 10 */
11 #include "cstring.h" 11 #include "cstring.h"
12 #include "intltest.h" 12 #include "intltest.h"
13 #include "quantityformatter.h" 13 #include "quantityformatter.h"
14 #include "simplepatternformatter.h" 14 #include "simplepatternformatter.h"
(...skipping 15 matching lines...) Expand all
30 TESTCASE_AUTO(TestBasic); 30 TESTCASE_AUTO(TestBasic);
31 TESTCASE_AUTO_END; 31 TESTCASE_AUTO_END;
32 } 32 }
33 33
34 void QuantityFormatterTest::TestBasic() { 34 void QuantityFormatterTest::TestBasic() {
35 UErrorCode status = U_ZERO_ERROR; 35 UErrorCode status = U_ZERO_ERROR;
36 #if !UCONFIG_NO_FORMATTING 36 #if !UCONFIG_NO_FORMATTING
37 QuantityFormatter fmt; 37 QuantityFormatter fmt;
38 assertFalse( 38 assertFalse(
39 "adding bad variant", 39 "adding bad variant",
40 fmt.add("a bad variant", "{0} pounds", status)); 40 fmt.addIfAbsent("a bad variant", "{0} pounds", status));
41 assertEquals("adding bad variant status", U_ILLEGAL_ARGUMENT_ERROR, status); 41 assertEquals("adding bad variant status", U_ILLEGAL_ARGUMENT_ERROR, status);
42 status = U_ZERO_ERROR; 42 status = U_ZERO_ERROR;
43 assertFalse( 43 assertFalse(
44 "Adding bad pattern", 44 "Adding bad pattern",
45 fmt.add("other", "{0} {1} too many placeholders", status)); 45 fmt.addIfAbsent("other", "{0} {1} too many placeholders", status));
46 assertEquals("adding bad pattern status", U_ILLEGAL_ARGUMENT_ERROR, status); 46 assertEquals("adding bad pattern status", U_ILLEGAL_ARGUMENT_ERROR, status);
47 status = U_ZERO_ERROR; 47 status = U_ZERO_ERROR;
48 assertFalse("isValid with no patterns", fmt.isValid()); 48 assertFalse("isValid with no patterns", fmt.isValid());
49 assertTrue( 49 assertTrue(
50 "Adding good pattern with no placeholders", 50 "Adding good pattern with no placeholders",
51 fmt.add("other", "no placeholder", status)); 51 fmt.addIfAbsent("zero", "no placeholder", status));
52 assertTrue( 52 assertTrue(
53 "Adding good pattern", 53 "Adding good pattern",
54 fmt.add("other", "{0} pounds", status)); 54 fmt.addIfAbsent("other", "{0} pounds", status));
55 assertTrue("isValid with other", fmt.isValid()); 55 assertTrue("isValid with other", fmt.isValid());
56 assertTrue( 56 assertTrue(
57 "Adding good pattern", 57 "Adding good pattern",
58 fmt.add("one", "{0} pound", status)); 58 fmt.addIfAbsent("one", "{0} pound", status));
59 59
60 assertEquals( 60 assertEquals(
61 "getByVariant", 61 "getByVariant",
62 fmt.getByVariant("bad variant")->getPatternWithNoPlaceholders(), 62 fmt.getByVariant("bad variant")->getPatternWithNoPlaceholders(),
63 " pounds"); 63 " pounds");
64 assertEquals( 64 assertEquals(
65 "getByVariant", 65 "getByVariant",
66 fmt.getByVariant("other")->getPatternWithNoPlaceholders(), 66 fmt.getByVariant("other")->getPatternWithNoPlaceholders(),
67 " pounds"); 67 " pounds");
68 assertEquals( 68 assertEquals(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 fmt.reset(); 142 fmt.reset();
143 assertFalse("isValid after reset", fmt.isValid()); 143 assertFalse("isValid after reset", fmt.isValid());
144 #endif 144 #endif
145 assertSuccess("", status); 145 assertSuccess("", status);
146 } 146 }
147 147
148 extern IntlTest *createQuantityFormatterTest() { 148 extern IntlTest *createQuantityFormatterTest() {
149 return new QuantityFormatterTest(); 149 return new QuantityFormatterTest();
150 } 150 }
OLDNEW
« no previous file with comments | « source/test/intltest/measfmttest.cpp ('k') | source/test/intltest/reldatefmttest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698