OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2013, International Business Machines | 3 * Copyright (c) 1997-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 | 6 |
7 /** | 7 /** |
8 * IntlTestFormat is the medium level test class for everything in the directory
"format". | 8 * IntlTestFormat is the medium level test class for everything in the directory
"format". |
9 */ | 9 */ |
10 | 10 |
11 #include "unicode/utypes.h" | 11 #include "unicode/utypes.h" |
12 #include "unicode/localpointer.h" | 12 #include "unicode/localpointer.h" |
13 | 13 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "selfmts.h" // PluralFormatTest | 54 #include "selfmts.h" // PluralFormatTest |
55 #include "dtifmtts.h" // DateIntervalFormatTest | 55 #include "dtifmtts.h" // DateIntervalFormatTest |
56 #include "tufmtts.h" // TimeUnitTest | 56 #include "tufmtts.h" // TimeUnitTest |
57 #include "locnmtst.h" // LocaleDisplayNamesTest | 57 #include "locnmtst.h" // LocaleDisplayNamesTest |
58 #include "dcfmtest.h" // DecimalFormatTest | 58 #include "dcfmtest.h" // DecimalFormatTest |
59 #include "listformattertest.h" // ListFormatterTest | 59 #include "listformattertest.h" // ListFormatterTest |
60 #include "regiontst.h" // RegionTest | 60 #include "regiontst.h" // RegionTest |
61 | 61 |
62 extern IntlTest *createCompactDecimalFormatTest(); | 62 extern IntlTest *createCompactDecimalFormatTest(); |
63 extern IntlTest *createGenderInfoTest(); | 63 extern IntlTest *createGenderInfoTest(); |
| 64 #if !UCONFIG_NO_BREAK_ITERATION |
| 65 extern IntlTest *createRelativeDateTimeFormatterTest(); |
| 66 #endif |
| 67 extern IntlTest *createMeasureFormatTest(); |
| 68 extern IntlTest *createScientificFormatHelperTest(); |
| 69 extern IntlTest *createNumberFormatSpecificationTest(); |
64 | 70 |
65 #define TESTCLASS(id, TestClass) \ | 71 #define TESTCLASS(id, TestClass) \ |
66 case id: \ | 72 case id: \ |
67 name = #TestClass; \ | 73 name = #TestClass; \ |
68 if (exec) { \ | 74 if (exec) { \ |
69 logln(#TestClass " test---"); \ | 75 logln(#TestClass " test---"); \ |
70 logln((UnicodeString)""); \ | 76 logln((UnicodeString)""); \ |
71 TestClass test; \ | 77 TestClass test; \ |
72 callTest(test, par); \ | 78 callTest(test, par); \ |
73 } \ | 79 } \ |
74 break | 80 break |
75 | 81 |
76 void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &nam
e, char* par ) | 82 void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &nam
e, char* par ) |
77 { | 83 { |
78 // for all format tests, always set default Locale and TimeZone to ENGLISH a
nd PST. | 84 // for all format tests, always set default Locale and TimeZone to ENGLISH a
nd PST. |
79 TimeZone* saveDefaultTimeZone = NULL; | 85 TimeZone* saveDefaultTimeZone = NULL; |
80 Locale saveDefaultLocale = Locale::getDefault(); | 86 Locale saveDefaultLocale = Locale::getDefault(); |
81 if (exec) { | 87 if (exec) { |
82 saveDefaultTimeZone = TimeZone::createDefault(); | 88 saveDefaultTimeZone = TimeZone::createDefault(); |
83 TimeZone *tz = TimeZone::createTimeZone("PST"); | 89 TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles"); |
84 TimeZone::setDefault(*tz); | 90 TimeZone::setDefault(*tz); |
85 delete tz; | 91 delete tz; |
86 UErrorCode status = U_ZERO_ERROR; | 92 UErrorCode status = U_ZERO_ERROR; |
87 Locale::setDefault( Locale::getEnglish(), status ); | 93 Locale::setDefault( Locale::getEnglish(), status ); |
88 if (U_FAILURE(status)) { | 94 if (U_FAILURE(status)) { |
89 errln("itformat: couldn't set default Locale to ENGLISH!"); | 95 errln("itformat: couldn't set default Locale to ENGLISH!"); |
90 } | 96 } |
91 } | 97 } |
92 if (exec) logln("TestSuite Format: "); | 98 if (exec) logln("TestSuite Format: "); |
93 switch (index) { | 99 switch (index) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 case 44: | 156 case 44: |
151 name = "CompactDecimalFormatTest"; | 157 name = "CompactDecimalFormatTest"; |
152 if (exec) { | 158 if (exec) { |
153 logln("CompactDecimalFormatTest test---"); | 159 logln("CompactDecimalFormatTest test---"); |
154 logln((UnicodeString)""); | 160 logln((UnicodeString)""); |
155 LocalPointer<IntlTest> test(createCompactDecimalFormatTest()); | 161 LocalPointer<IntlTest> test(createCompactDecimalFormatTest()); |
156 callTest(*test, par); | 162 callTest(*test, par); |
157 } | 163 } |
158 break; | 164 break; |
159 TESTCLASS(45,RegionTest); | 165 TESTCLASS(45,RegionTest); |
| 166 case 46: |
| 167 #if !UCONFIG_NO_BREAK_ITERATION |
| 168 name = "RelativeDateTimeFormatterTest"; |
| 169 if (exec) { |
| 170 logln("RelativeDateTimeFormatterTest test---"); |
| 171 logln((UnicodeString)""); |
| 172 LocalPointer<IntlTest> test(createRelativeDateTimeFormatterTest()); |
| 173 callTest(*test, par); |
| 174 } |
| 175 #endif |
| 176 break; |
| 177 case 47: |
| 178 name = "MeasureFormatTest"; |
| 179 if (exec) { |
| 180 logln("MeasureFormatTest test---"); |
| 181 logln((UnicodeString)""); |
| 182 LocalPointer<IntlTest> test(createMeasureFormatTest()); |
| 183 callTest(*test, par); |
| 184 } |
| 185 break; |
| 186 case 48: |
| 187 name = "ScientificFormatHelperTest"; |
| 188 if (exec) { |
| 189 logln("ScientificFormatHelperTest test---"); |
| 190 logln((UnicodeString)""); |
| 191 LocalPointer<IntlTest> test(createScientificFormatHelperTest()); |
| 192 callTest(*test, par); |
| 193 } |
| 194 break; |
| 195 case 49: |
| 196 name = "NumberFormatSpecificationTest"; |
| 197 if (exec) { |
| 198 logln("NumberFormatSpecificationTest test---"); |
| 199 logln((UnicodeString)""); |
| 200 LocalPointer<IntlTest> test(createNumberFormatSpecificationTest()); |
| 201 callTest(*test, par); |
| 202 } |
| 203 break; |
160 default: name = ""; break; //needed to end loop | 204 default: name = ""; break; //needed to end loop |
161 } | 205 } |
162 if (exec) { | 206 if (exec) { |
163 // restore saved Locale and TimeZone | 207 // restore saved Locale and TimeZone |
164 TimeZone::adoptDefault(saveDefaultTimeZone); | 208 TimeZone::adoptDefault(saveDefaultTimeZone); |
165 UErrorCode status = U_ZERO_ERROR; | 209 UErrorCode status = U_ZERO_ERROR; |
166 Locale::setDefault( saveDefaultLocale, status ); | 210 Locale::setDefault( saveDefaultLocale, status ); |
167 if (U_FAILURE(status)) { | 211 if (U_FAILURE(status)) { |
168 errln("itformat: couldn't re-set default Locale!"); | 212 errln("itformat: couldn't re-set default Locale!"); |
169 } | 213 } |
170 } | 214 } |
171 } | 215 } |
172 | 216 |
173 #endif /* #if !UCONFIG_NO_FORMATTING */ | 217 #endif /* #if !UCONFIG_NO_FORMATTING */ |
OLD | NEW |