]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/dtifmtts.cpp
ICU-62135.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / dtifmtts.cpp
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
4 * COPYRIGHT:
5 * Copyright (c) 1997-2016, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
8
9 #include "unicode/utypes.h"
10
11 #if !UCONFIG_NO_FORMATTING
12
13
14 //TODO: define it in compiler flag
15 //#define DTIFMTTS_DEBUG 1
16
17
18 #ifdef DTIFMTTS_DEBUG
19 #include <iostream>
20 #endif
21
22 #include "dtifmtts.h"
23
24 #include "cmemory.h"
25 #include "cstr.h"
26 #include "cstring.h"
27 #include "simplethread.h"
28 #include "japancal.h"
29 #include "unicode/gregocal.h"
30 #include "unicode/dtintrv.h"
31 #include "unicode/dtitvinf.h"
32 #include "unicode/dtitvfmt.h"
33 #include "unicode/localpointer.h"
34 #include "unicode/timezone.h"
35
36
37
38 #ifdef DTIFMTTS_DEBUG
39 //#define PRINTMESG(msg) { std::cout << "(" << __FILE__ << ":" << __LINE__ << ") " << msg << "\n"; }
40 #define PRINTMESG(msg) { std::cout << msg; }
41 #endif
42
43 #include <stdio.h>
44
45
46 void DateIntervalFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) {
47 if (exec) logln("TestSuite DateIntervalFormat");
48 switch (index) {
49 TESTCASE(0, testAPI);
50 TESTCASE(1, testFormat);
51 TESTCASE(2, testFormatUserDII);
52 TESTCASE(3, testSetIntervalPatternNoSideEffect);
53 TESTCASE(4, testYearFormats);
54 TESTCASE(5, testStress);
55 TESTCASE(6, testTicket11583_2);
56 TESTCASE(7, testTicket11985);
57 TESTCASE(8, testTicket11669);
58 TESTCASE(9, testTicket12065);
59 default: name = ""; break;
60 }
61 }
62
63 /**
64 * Test various generic API methods of DateIntervalFormat for API coverage.
65 */
66 void DateIntervalFormatTest::testAPI() {
67
68 /* ====== Test create interval instance with default locale and skeleton
69 */
70 UErrorCode status = U_ZERO_ERROR;
71 logln("Testing DateIntervalFormat create instance with default locale and skeleton");
72
73 DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, status);
74 if(U_FAILURE(status)) {
75 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + default locale) - exitting");
76 return;
77 } else {
78 delete dtitvfmt;
79 }
80
81
82 /* ====== Test create interval instance with given locale and skeleton
83 */
84 status = U_ZERO_ERROR;
85 logln("Testing DateIntervalFormat create instance with given locale and skeleton");
86
87 dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, Locale::getJapanese(), status);
88 if(U_FAILURE(status)) {
89 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + locale) - exitting");
90 return;
91 } else {
92 delete dtitvfmt;
93 }
94
95
96 /* ====== Test create interval instance with dateIntervalInfo and skeleton
97 */
98 status = U_ZERO_ERROR;
99 logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
100
101 DateIntervalInfo* dtitvinf = new DateIntervalInfo(Locale::getSimplifiedChinese(), status);
102
103 dtitvfmt = DateIntervalFormat::createInstance("EEEdMMMyhms", *dtitvinf, status);
104 delete dtitvinf;
105
106 if(U_FAILURE(status)) {
107 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + default locale) - exitting");
108 return;
109 } else {
110 delete dtitvfmt;
111 }
112
113
114 /* ====== Test create interval instance with dateIntervalInfo and skeleton
115 */
116 status = U_ZERO_ERROR;
117 logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
118
119 dtitvinf = new DateIntervalInfo(Locale::getSimplifiedChinese(), status);
120
121 dtitvfmt = DateIntervalFormat::createInstance("EEEdMMMyhms", Locale::getSimplifiedChinese(), *dtitvinf, status);
122 delete dtitvinf;
123 if(U_FAILURE(status)) {
124 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + locale) - exitting");
125 return;
126 }
127 // not deleted, test clone
128
129
130 // ====== Test clone()
131 status = U_ZERO_ERROR;
132 logln("Testing DateIntervalFormat clone");
133
134 DateIntervalFormat* another = (DateIntervalFormat*)dtitvfmt->clone();
135 if ( (*another) != (*dtitvfmt) ) {
136 dataerrln("%s:%d ERROR: clone failed", __FILE__, __LINE__);
137 }
138
139
140 // ====== Test getDateIntervalInfo, setDateIntervalInfo, adoptDateIntervalInfo
141 status = U_ZERO_ERROR;
142 logln("Testing DateIntervalFormat getDateIntervalInfo");
143 const DateIntervalInfo* inf = another->getDateIntervalInfo();
144 dtitvfmt->setDateIntervalInfo(*inf, status);
145 const DateIntervalInfo* anotherInf = dtitvfmt->getDateIntervalInfo();
146 if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
147 dataerrln("ERROR: getDateIntervalInfo/setDateIntervalInfo failed");
148 }
149
150 {
151 // We make sure that setDateIntervalInfo does not corrupt the cache. See ticket 9919.
152 status = U_ZERO_ERROR;
153 logln("Testing DateIntervalFormat setDateIntervalInfo");
154 const Locale &enLocale = Locale::getEnglish();
155 LocalPointer<DateIntervalFormat> dif(DateIntervalFormat::createInstance("yMd", enLocale, status));
156 if (U_FAILURE(status)) {
157 errln("Failure encountered: %s", u_errorName(status));
158 return;
159 }
160 UnicodeString expected;
161 LocalPointer<Calendar> fromTime(Calendar::createInstance(enLocale, status));
162 LocalPointer<Calendar> toTime(Calendar::createInstance(enLocale, status));
163 if (U_FAILURE(status)) {
164 errln("Failure encountered: %s", u_errorName(status));
165 return;
166 }
167 FieldPosition pos(FieldPosition::DONT_CARE);
168 fromTime->set(2013, 3, 26);
169 toTime->set(2013, 3, 28);
170 dif->format(*fromTime, *toTime, expected, pos, status);
171 if (U_FAILURE(status)) {
172 errln("Failure encountered: %s", u_errorName(status));
173 return;
174 }
175 LocalPointer<DateIntervalInfo> dii(new DateIntervalInfo(Locale::getEnglish(), status), status);
176 if (U_FAILURE(status)) {
177 errln("Failure encountered: %s", u_errorName(status));
178 return;
179 }
180 dii->setIntervalPattern(ctou("yMd"), UCAL_DATE, ctou("M/d/y \\u2013 d"), status);
181 dif->setDateIntervalInfo(*dii, status);
182 if (U_FAILURE(status)) {
183 errln("Failure encountered: %s", u_errorName(status));
184 return;
185 }
186 dif.adoptInstead(DateIntervalFormat::createInstance("yMd", enLocale, status));
187 if (U_FAILURE(status)) {
188 errln("Failure encountered: %s", u_errorName(status));
189 return;
190 }
191 UnicodeString actual;
192 pos = 0;
193 dif->format(*fromTime, *toTime, actual, pos, status);
194 if (U_FAILURE(status)) {
195 errln("Failure encountered: %s", u_errorName(status));
196 return;
197 }
198 if (expected != actual) {
199 errln("DateIntervalFormat.setIntervalInfo should have no side effects.");
200 }
201 }
202
203 /*
204 status = U_ZERO_ERROR;
205 DateIntervalInfo* nonConstInf = inf->clone();
206 dtitvfmt->adoptDateIntervalInfo(nonConstInf, status);
207 anotherInf = dtitvfmt->getDateIntervalInfo();
208 if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
209 dataerrln("ERROR: adoptDateIntervalInfo failed");
210 }
211 */
212
213 // ====== Test getDateFormat, setDateFormat, adoptDateFormat
214
215 status = U_ZERO_ERROR;
216 logln("Testing DateIntervalFormat getDateFormat");
217 /*
218 const DateFormat* fmt = another->getDateFormat();
219 dtitvfmt->setDateFormat(*fmt, status);
220 const DateFormat* anotherFmt = dtitvfmt->getDateFormat();
221 if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
222 dataerrln("ERROR: getDateFormat/setDateFormat failed");
223 }
224
225 status = U_ZERO_ERROR;
226 DateFormat* nonConstFmt = (DateFormat*)fmt->clone();
227 dtitvfmt->adoptDateFormat(nonConstFmt, status);
228 anotherFmt = dtitvfmt->getDateFormat();
229 if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
230 dataerrln("ERROR: adoptDateFormat failed");
231 }
232 delete fmt;
233 */
234
235
236 // ======= Test getStaticClassID()
237
238 logln("Testing getStaticClassID()");
239
240
241 if(dtitvfmt->getDynamicClassID() != DateIntervalFormat::getStaticClassID()) {
242 errln("ERROR: getDynamicClassID() didn't return the expected value");
243 }
244
245 delete another;
246
247 // ====== test constructor/copy constructor and assignment
248 /* they are protected, no test
249 logln("Testing DateIntervalFormat constructor and assigment operator");
250 status = U_ZERO_ERROR;
251
252 DateFormat* constFmt = (constFmt*)dtitvfmt->getDateFormat()->clone();
253 inf = dtitvfmt->getDateIntervalInfo()->clone();
254
255
256 DateIntervalFormat* dtifmt = new DateIntervalFormat(fmt, inf, status);
257 if(U_FAILURE(status)) {
258 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
259 return;
260 }
261
262 DateIntervalFormat* dtifmt2 = new(dtifmt);
263 if ( (*dtifmt) != (*dtifmt2) ) {
264 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
265 return;
266 }
267
268 DateIntervalFormat dtifmt3 = (*dtifmt);
269 if ( (*dtifmt) != dtifmt3 ) {
270 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
271 return;
272 }
273
274 delete dtifmt2;
275 delete dtifmt3;
276 delete dtifmt;
277 */
278
279
280 //===== test format and parse ==================
281 Formattable formattable;
282 formattable.setInt64(10);
283 UnicodeString res;
284 FieldPosition pos(FieldPosition::DONT_CARE);
285 status = U_ZERO_ERROR;
286 dtitvfmt->format(formattable, res, pos, status);
287 if ( status != U_ILLEGAL_ARGUMENT_ERROR ) {
288 dataerrln("ERROR: format non-date-interval object should set U_ILLEGAL_ARGUMENT_ERROR - exitting");
289 return;
290 }
291
292 DateInterval* dtitv = new DateInterval(3600*24*365, 3600*24*366);
293 formattable.adoptObject(dtitv);
294 res.remove();
295 pos = 0;
296 status = U_ZERO_ERROR;
297 dtitvfmt->format(formattable, res, pos, status);
298 if ( U_FAILURE(status) ) {
299 dataerrln("ERROR: format date interval failed - exitting");
300 return;
301 }
302
303 const DateFormat* dfmt = dtitvfmt->getDateFormat();
304 Calendar* fromCal = dfmt->getCalendar()->clone();
305 Calendar* toCal = dfmt->getCalendar()->clone();
306 res.remove();
307 pos = 0;
308 status = U_ZERO_ERROR;
309 dtitvfmt->format(*fromCal, *toCal, res, pos, status);
310 if ( U_FAILURE(status) ) {
311 dataerrln("ERROR: format date interval failed - exitting");
312 return;
313 }
314 delete fromCal;
315 delete toCal;
316
317
318 Formattable fmttable;
319 status = U_ZERO_ERROR;
320 // TODO: why do I need cast?
321 ((Format*)dtitvfmt)->parseObject(res, fmttable, status);
322 if ( status != U_INVALID_FORMAT_ERROR ) {
323 dataerrln("ERROR: parse should set U_INVALID_FORMAT_ERROR - exitting");
324 return;
325 }
326
327 delete dtitvfmt;
328
329 //====== test setting time zone
330 logln("Testing DateIntervalFormat set & format with different time zones, get time zone");
331 status = U_ZERO_ERROR;
332 dtitvfmt = DateIntervalFormat::createInstance("MMMdHHmm", Locale::getEnglish(), status);
333 if ( U_SUCCESS(status) ) {
334 UDate date1 = 1299090600000.0; // 2011-Mar-02 1030 in US/Pacific, 2011-Mar-03 0330 in Asia/Tokyo
335 UDate date2 = 1299115800000.0; // 2011-Mar-02 1730 in US/Pacific, 2011-Mar-03 1030 in Asia/Tokyo
336
337 DateInterval * dtitv12 = new DateInterval(date1, date2);
338 TimeZone * tzCalif = TimeZone::createTimeZone("US/Pacific");
339 TimeZone * tzTokyo = TimeZone::createTimeZone("Asia/Tokyo");
340 UnicodeString fmtCalif = UnicodeString(ctou("Mar 2, 10:30\\u2009\\u2013\\u200917:30"));
341 UnicodeString fmtTokyo = UnicodeString(ctou("Mar 3, 03:30\\u2009\\u2013\\u200910:30"));
342
343 dtitvfmt->adoptTimeZone(tzCalif);
344 res.remove();
345 pos = 0;
346 status = U_ZERO_ERROR;
347 dtitvfmt->format(dtitv12, res, pos, status);
348 if ( U_SUCCESS(status) ) {
349 if ( res.compare(fmtCalif) != 0 ) {
350 errln("ERROR: DateIntervalFormat::format for tzCalif, expect " + fmtCalif + ", get " + res);
351 }
352 } else {
353 errln("ERROR: DateIntervalFormat::format for tzCalif, status %s", u_errorName(status));
354 }
355
356 dtitvfmt->setTimeZone(*tzTokyo);
357 res.remove();
358 pos = 0;
359 status = U_ZERO_ERROR;
360 dtitvfmt->format(dtitv12, res, pos, status);
361 if ( U_SUCCESS(status) ) {
362 if ( res.compare(fmtTokyo) != 0 ) {
363 errln("ERROR: DateIntervalFormat::format for tzTokyo, expect " + fmtTokyo + ", get " + res);
364 }
365 } else {
366 errln("ERROR: DateIntervalFormat::format for tzTokyo, status %s", u_errorName(status));
367 }
368
369 if ( dtitvfmt->getTimeZone() != *tzTokyo ) {
370 errln("ERROR: DateIntervalFormat::getTimeZone returns mismatch.");
371 }
372
373 delete tzTokyo; // tzCalif was owned by dtitvfmt which should have deleted it
374 delete dtitv12;
375 delete dtitvfmt;
376 } else {
377 errln("ERROR: DateIntervalFormat::createInstance(\"MdHH\", Locale::getEnglish(), ...), status %s", u_errorName(status));
378 }
379 //====== test format in testFormat()
380
381 //====== test DateInterval class (better coverage)
382 DateInterval dtitv1(3600*24*365, 3600*24*366);
383 DateInterval dtitv2(dtitv1);
384
385 if (!(dtitv1 == dtitv2)) {
386 errln("ERROR: Copy constructor failed for DateInterval.");
387 }
388
389 DateInterval dtitv3(3600*365, 3600*366);
390 dtitv3 = dtitv1;
391 if (!(dtitv3 == dtitv1)) {
392 errln("ERROR: Equal operator failed for DateInterval.");
393 }
394
395 DateInterval *dtitv4 = dtitv1.clone();
396 if (*dtitv4 != dtitv1) {
397 errln("ERROR: Equal operator failed for DateInterval.");
398 }
399 delete dtitv4;
400 }
401
402
403 /**
404 * Test format
405 */
406 void DateIntervalFormatTest::testFormat() {
407 // first item is date pattern
408 // followed by a group of locale/from_data/to_data/skeleton/interval_data
409 // Note that from_data/to_data are specified using era names from root, for the calendar specified by locale.
410 const char* DATA[] = {
411 "GGGGG y MM dd HH:mm:ss", // pattern for from_data/to_data
412 // test root
413 "root", "CE 2007 11 10 10:10:10", "CE 2007 12 10 10:10:10", "yM", "2007-11 \\u2013 2007-12",
414
415 // test 'H' and 'h', using availableFormat in fallback
416 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 10 15:10:10", "Hms", "10:10:10\\u2009\\u2013\\u200915:10:10",
417 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 10 15:10:10", "hms", "10:10:10 AM\\u2009\\u2013\\u20093:10:10 PM",
418
419 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "MMMM", "October 2007\\u2009\\u2013\\u2009October 2008",
420 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "MMM", "Oct 2007\\u2009\\u2013\\u2009Oct 2008",
421 // test skeleton with both date and time
422 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMyhm", "Nov 10, 2007, 10:10 AM\\u2009\\u2013\\u2009Nov 20, 2007, 10:10 AM",
423
424 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 10 11:10:10", "dMMMyhm", "Nov 10, 2007, 10:10\\u2009\\u2013\\u200911:10 AM",
425
426 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 10 11:10:10", "hms", "10:10:10 AM\\u2009\\u2013\\u200911:10:10 AM",
427 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 10 11:10:10", "Hms", "10:10:10\\u2009\\u2013\\u200911:10:10",
428 "en", "CE 2007 11 10 20:10:10", "CE 2007 11 10 21:10:10", "Hms", "20:10:10\\u2009\\u2013\\u200921:10:10",
429
430 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10, 2007\\u2009\\u2013\\u2009Friday, October 10, 2008",
431
432 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dMMMMy", "October 10, 2007\\u2009\\u2013\\u2009October 10, 2008",
433
434 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dMMMM", "October 10, 2007\\u2009\\u2013\\u2009October 10, 2008",
435
436 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "MMMMy", "October 2007\\u2009\\u2013\\u2009October 2008",
437
438 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10, 2007\\u2009\\u2013\\u2009Friday, October 10, 2008",
439
440 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EdMMMy", "Wed, Oct 10, 2007\\u2009\\u2013\\u2009Fri, Oct 10, 2008",
441
442 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dMMMy", "Oct 10, 2007\\u2009\\u2013\\u2009Oct 10, 2008",
443
444 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dMMM", "Oct 10, 2007\\u2009\\u2013\\u2009Oct 10, 2008",
445
446 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "MMMy", "Oct 2007\\u2009\\u2013\\u2009Oct 2008",
447
448 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EdMMM", "Wed, Oct 10, 2007\\u2009\\u2013\\u2009Fri, Oct 10, 2008",
449
450 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EdMy", "Wed, 10/10/2007\\u2009\\u2013\\u2009Fri, 10/10/2008",
451
452 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dMy", "10/10/2007\\u2009\\u2013\\u200910/10/2008",
453
454 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dM", "10/10/2007\\u2009\\u2013\\u200910/10/2008",
455
456 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "My", "10/2007\\u2009\\u2013\\u200910/2008",
457
458 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EdM", "Wed, 10/10/2007\\u2009\\u2013\\u2009Fri, 10/10/2008",
459
460 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "d", "10/10/2007\\u2009\\u2013\\u200910/10/2008",
461
462 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "Ed", "10 Wed\\u2009\\u2013\\u200910 Fri",
463
464 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "y", "2007\\u2009\\u2013\\u20092008",
465
466 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "M", "10/2007\\u2009\\u2013\\u200910/2008",
467
468
469
470 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hm", "10/10/2007, 10:10 AM\\u2009\\u2013\\u200910/10/2008, 10:10 AM",
471 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "Hm", "10/10/2007, 10:10\\u2009\\u2013\\u200910/10/2008, 10:10",
472 "en", "CE 2007 10 10 20:10:10", "CE 2008 10 10 20:10:10", "Hm", "10/10/2007, 20:10\\u2009\\u2013\\u200910/10/2008, 20:10",
473
474 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hmv", "10/10/2007, 10:10 AM PT\\u2009\\u2013\\u200910/10/2008, 10:10 AM PT",
475
476 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hmz", "10/10/2007, 10:10 AM PDT\\u2009\\u2013\\u200910/10/2008, 10:10 AM PDT",
477
478 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "h", "10/10/2007, 10 AM\\u2009\\u2013\\u200910/10/2008, 10 AM",
479
480 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hv", "10/10/2007, 10 AM PT\\u2009\\u2013\\u200910/10/2008, 10 AM PT",
481
482 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hz", "10/10/2007, 10 AM PDT\\u2009\\u2013\\u200910/10/2008, 10 AM PDT",
483
484 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/2007\\u2009\\u2013\\u2009Fri, 10/10/2008",
485
486 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EddMMy", "Wed, 10/10/2007\\u2009\\u2013\\u2009Fri, 10/10/2008",
487
488 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hhmm", "10/10/2007, 10:10 AM\\u2009\\u2013\\u200910/10/2008, 10:10 AM",
489
490 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hhmmzz", "10/10/2007, 10:10 AM PDT\\u2009\\u2013\\u200910/10/2008, 10:10 AM PDT",
491
492 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hms", "10/10/2007, 10:10:10 AM\\u2009\\u2013\\u200910/10/2008, 10:10:10 AM",
493
494 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dMMMMMy", "O 10, 2007\\u2009\\u2013\\u2009O 10, 2008",
495
496 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EEEEEdM", "W, 10/10/2007\\u2009\\u2013\\u2009F, 10/10/2008",
497
498 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10\\u2009\\u2013\\u2009Saturday, November 10, 2007",
499
500 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMMy", "October 10\\u2009\\u2013\\u2009November 10, 2007",
501
502 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMM", "October 10\\u2009\\u2013\\u2009November 10",
503
504 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMMy", "October\\u2009\\u2013\\u2009November 2007",
505
506 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10\\u2009\\u2013\\u2009Saturday, November 10",
507
508 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EdMMMy", "Wed, Oct 10\\u2009\\u2013\\u2009Sat, Nov 10, 2007",
509
510 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMy", "Oct 10\\u2009\\u2013\\u2009Nov 10, 2007",
511
512 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMM", "Oct 10\\u2009\\u2013\\u2009Nov 10",
513
514 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMy", "Oct\\u2009\\u2013\\u2009Nov 2007",
515
516 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EdMMM", "Wed, Oct 10\\u2009\\u2013\\u2009Sat, Nov 10",
517
518 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EdMy", "Wed, 10/10/2007\\u2009\\u2013\\u2009Sat, 11/10/2007",
519
520 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMy", "10/10/2007\\u2009\\u2013\\u200911/10/2007",
521
522
523 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "My", "10/2007\\u2009\\u2013\\u200911/2007",
524
525 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EdM", "Wed, 10/10\\u2009\\u2013\\u2009Sat, 11/10",
526
527 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "d", "10/10\\u2009\\u2013\\u200911/10",
528
529 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "Ed", "10 Wed\\u2009\\u2013\\u200910 Sat",
530
531 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "y", "2007",
532
533 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "M", "10\\u2009\\u2013\\u200911",
534
535 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMM", "Oct\\u2009\\u2013\\u2009Nov",
536
537 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMM", "October\\u2009\\u2013\\u2009November",
538
539 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hm", "10/10/2007, 10:10 AM\\u2009\\u2013\\u200911/10/2007, 10:10 AM",
540 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "Hm", "10/10/2007, 10:10\\u2009\\u2013\\u200911/10/2007, 10:10",
541 "en", "CE 2007 10 10 20:10:10", "CE 2007 11 10 20:10:10", "Hm", "10/10/2007, 20:10\\u2009\\u2013\\u200911/10/2007, 20:10",
542
543 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hmv", "10/10/2007, 10:10 AM PT\\u2009\\u2013\\u200911/10/2007, 10:10 AM PT",
544
545 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hmz", "10/10/2007, 10:10 AM PDT\\u2009\\u2013\\u200911/10/2007, 10:10 AM PST",
546
547 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "h", "10/10/2007, 10 AM\\u2009\\u2013\\u200911/10/2007, 10 AM",
548
549 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hv", "10/10/2007, 10 AM PT\\u2009\\u2013\\u200911/10/2007, 10 AM PT",
550
551 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hz", "10/10/2007, 10 AM PDT\\u2009\\u2013\\u200911/10/2007, 10 AM PST",
552
553 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/2007\\u2009\\u2013\\u2009Sat, 11/10/2007",
554
555 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EddMMy", "Wed, 10/10/2007\\u2009\\u2013\\u2009Sat, 11/10/2007",
556
557
558 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hhmmzz", "10/10/2007, 10:10 AM PDT\\u2009\\u2013\\u200911/10/2007, 10:10 AM PST",
559
560 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hms", "10/10/2007, 10:10:10 AM\\u2009\\u2013\\u200911/10/2007, 10:10:10 AM",
561
562 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMMMy", "O 10\\u2009\\u2013\\u2009N 10, 2007",
563
564 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EEEEEdM", "W, 10/10\\u2009\\u2013\\u2009S, 11/10",
565
566 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEEEdMMMMy", "Saturday, November 10\\u2009\\u2013\\u2009Tuesday, November 20, 2007",
567
568 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMMy", "November 10\\u2009\\u2013\\u200920, 2007",
569
570 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMM", "November 10\\u2009\\u2013\\u200920",
571
572
573 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEEEdMMMM", "Saturday, November 10\\u2009\\u2013\\u2009Tuesday, November 20",
574
575 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EdMMMy", "Sat, Nov 10\\u2009\\u2013\\u2009Tue, Nov 20, 2007",
576
577 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMy", "Nov 10\\u2009\\u2013\\u200920, 2007",
578
579 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMM", "Nov 10\\u2009\\u2013\\u200920",
580
581 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMMy", "Nov 2007",
582
583 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EdMMM", "Sat, Nov 10\\u2009\\u2013\\u2009Tue, Nov 20",
584
585 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EdMy", "Sat, 11/10/2007\\u2009\\u2013\\u2009Tue, 11/20/2007",
586
587 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMy", "11/10/2007\\u2009\\u2013\\u200911/20/2007",
588
589 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dM", "11/10\\u2009\\u2013\\u200911/20",
590
591 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "My", "11/2007",
592
593 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EdM", "Sat, 11/10\\u2009\\u2013\\u2009Tue, 11/20",
594
595 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "d", "10\\u2009\\u2013\\u200920",
596
597 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "Ed", "10 Sat\\u2009\\u2013\\u200920 Tue",
598
599 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "y", "2007",
600
601 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "M", "11",
602
603 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMM", "Nov",
604
605 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMMM", "November",
606
607 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hm", "11/10/2007, 10:10 AM\\u2009\\u2013\\u200911/20/2007, 10:10 AM",
608 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "Hm", "11/10/2007, 10:10\\u2009\\u2013\\u200911/20/2007, 10:10",
609 "en", "CE 2007 11 10 20:10:10", "CE 2007 11 20 20:10:10", "Hm", "11/10/2007, 20:10\\u2009\\u2013\\u200911/20/2007, 20:10",
610
611 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hmv", "11/10/2007, 10:10 AM PT\\u2009\\u2013\\u200911/20/2007, 10:10 AM PT",
612
613 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hmz", "11/10/2007, 10:10 AM PST\\u2009\\u2013\\u200911/20/2007, 10:10 AM PST",
614
615 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "h", "11/10/2007, 10 AM\\u2009\\u2013\\u200911/20/2007, 10 AM",
616
617 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hv", "11/10/2007, 10 AM PT\\u2009\\u2013\\u200911/20/2007, 10 AM PT",
618
619 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hz", "11/10/2007, 10 AM PST\\u2009\\u2013\\u200911/20/2007, 10 AM PST",
620
621 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEddMMyyyy", "Sat, 11/10/2007\\u2009\\u2013\\u2009Tue, 11/20/2007",
622
623 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EddMMy", "Sat, 11/10/2007\\u2009\\u2013\\u2009Tue, 11/20/2007",
624
625 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hhmm", "11/10/2007, 10:10 AM\\u2009\\u2013\\u200911/20/2007, 10:10 AM",
626
627 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hhmmzz", "11/10/2007, 10:10 AM PST\\u2009\\u2013\\u200911/20/2007, 10:10 AM PST",
628
629 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hms", "11/10/2007, 10:10:10 AM\\u2009\\u2013\\u200911/20/2007, 10:10:10 AM",
630 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "Hms", "11/10/2007, 10:10:10\\u2009\\u2013\\u200911/20/2007, 10:10:10",
631 "en", "CE 2007 11 10 20:10:10", "CE 2007 11 20 20:10:10", "Hms", "11/10/2007, 20:10:10\\u2009\\u2013\\u200911/20/2007, 20:10:10",
632
633 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMMMy", "N 10\\u2009\\u2013\\u200920, 2007",
634
635 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEEEEdM", "S, 11/10\\u2009\\u2013\\u2009T, 11/20",
636
637 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMMMy", "Wednesday, January 10, 2007",
638
639 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMMMy", "January 10, 2007",
640
641 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMMM", "January 10",
642
643 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMMMy", "January 2007",
644
645 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMMM", "Wednesday, January 10",
646
647 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EdMMMy", "Wed, Jan 10, 2007",
648
649 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMMy", "Jan 10, 2007",
650
651 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMM", "Jan 10",
652
653 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMMy", "Jan 2007",
654
655 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EdMMM", "Wed, Jan 10",
656
657
658 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMy", "1/10/2007",
659
660 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dM", "1/10",
661
662 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "My", "1/2007",
663
664 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EdM", "Wed, 1/10",
665
666 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "d", "10",
667
668 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "Ed", "10 Wed",
669
670 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "y", "2007",
671
672 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "M", "1",
673
674 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMM", "Jan",
675
676 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMMM", "January",
677
678 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hm", "10:00 AM\\u2009\\u2013\\u20092:10 PM",
679 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "Hm", "10:00\\u2009\\u2013\\u200914:10",
680
681 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hmv", "10:00 AM\\u2009\\u2013\\u20092:10 PM PT",
682
683 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hmz", "10:00 AM\\u2009\\u2013\\u20092:10 PM PST",
684
685 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "h", "10 AM\\u2009\\u2013\\u20092 PM",
686 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "H", "10\\u2009\\u2013\\u200914",
687
688
689 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hz", "10 AM\\u2009\\u2013\\u20092 PM PST",
690
691 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEddMMyyyy", "Wed, 01/10/2007",
692
693 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EddMMy", "Wed, 01/10/2007",
694
695 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hhmm", "10:00 AM\\u2009\\u2013\\u20092:10 PM",
696 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "HHmm", "10:00\\u2009\\u2013\\u200914:10",
697
698 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hhmmzz", "10:00 AM\\u2009\\u2013\\u20092:10 PM PST",
699
700 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hms", "10:00:10 AM\\u2009\\u2013\\u20092:10:10 PM",
701 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "Hms", "10:00:10\\u2009\\u2013\\u200914:10:10",
702
703 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMMMMy", "J 10, 2007",
704
705 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEEdM", "W, 1/10",
706 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMMMy", "January 10, 2007",
707
708 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMMM", "January 10",
709
710 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "MMMMy", "January 2007",
711
712 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EEEEdMMMM", "Wednesday, January 10",
713
714 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EdMMMy", "Wed, Jan 10, 2007",
715
716 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMMy", "Jan 10, 2007",
717
718 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMM", "Jan 10",
719
720
721 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EdMMM", "Wed, Jan 10",
722
723 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EdMy", "Wed, 1/10/2007",
724
725 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMy", "1/10/2007",
726
727
728 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "My", "1/2007",
729
730 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EdM", "Wed, 1/10",
731
732 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "d", "10",
733
734
735 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "y", "2007",
736
737 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "M", "1",
738
739
740
741 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hm", "10:00\\u2009\\u2013\\u200910:20 AM",
742 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "Hm", "10:00\\u2009\\u2013\\u200910:20",
743
744
745 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hmz", "10:00\\u2009\\u2013\\u200910:20 AM PST",
746
747
748 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hv", "10 AM PT",
749
750
751
752 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EddMMy", "Wed, 01/10/2007",
753
754 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hhmm", "10:00\\u2009\\u2013\\u200910:20 AM",
755 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "HHmm", "10:00\\u2009\\u2013\\u200910:20",
756
757 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hhmmzz", "10:00\\u2009\\u2013\\u200910:20 AM PST",
758
759
760 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMMMMy", "J 10, 2007",
761
762
763 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEEEdMMMMy", "Wednesday, January 10, 2007",
764
765 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMMMMy", "January 10, 2007",
766
767
768 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "MMMMy", "January 2007",
769
770 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEEEdMMMM", "Wednesday, January 10",
771
772
773 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMMMy", "Jan 10, 2007",
774
775 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMMM", "Jan 10",
776
777
778 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EdMMM", "Wed, Jan 10",
779
780 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EdMy", "Wed, 1/10/2007",
781
782 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMy", "1/10/2007",
783
784
785 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "My", "1/2007",
786
787 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EdM", "Wed, 1/10",
788
789 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "d", "10",
790
791
792 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "y", "2007",
793
794 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "M", "1",
795
796
797 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "MMMM", "January",
798
799 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hm", "10:10 AM",
800 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "Hm", "10:10",
801
802
803 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hmz", "10:10 AM PST",
804
805 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "h", "10 AM",
806
807 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hv", "10 AM PT",
808
809
810 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEddMMyyyy", "Wed, 01/10/2007",
811
812
813 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hhmm", "10:10 AM",
814 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "HHmm", "10:10",
815
816 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hhmmzz", "10:10 AM PST",
817
818
819 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMMMMMy", "J 10, 2007",
820
821 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEEEEdM", "W, 1/10",
822
823 "zh", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EEEEdMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e09\\u81f32008\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e94",
824
825
826 "zh", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u81f311\\u670810\\u65e5",
827
828
829 "zh", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMMy", "2007\\u5e7410\\u6708\\u81f311\\u6708",
830
831
832 "zh", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hmv", "2007/10/10 \\u6D1B\\u6749\\u77F6\\u65F6\\u95F4 \\u4E0A\\u534810:10\\u2009\\u2013\\u20092007/11/10 \\u6D1B\\u6749\\u77F6\\u65F6\\u95F4 \\u4E0A\\u534810:10",
833
834 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEEEdMMMMy", "2007\\u5e7411\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
835
836
837 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMM", "11\\u670810\\u65e5\\u81f320\\u65e5",
838
839 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMMMy", "2007\\u5E7411\\u6708", // (fixed expected result per ticket:6626:)
840
841 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEEEdMMMM", "11\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
842
843
844 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EdMy", "2007/11/10\\u5468\\u516d\\u81f32007/11/20\\u5468\\u4e8c",
845
846
847 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dM", "11/10\\u2009\\u2013\\u200911/20",
848
849 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "My", "2007\\u5E7411\\u6708",
850
851 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EdM", "11/10\\u5468\\u516d\\u81f311/20\\u5468\\u4e8c",
852
853
854 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "y", "2007\\u5E74", // (fixed expected result per ticket:6626:)
855
856 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "M", "11\\u6708",
857
858 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMM", "11\\u6708", // (fixed expected result per ticket:6626: and others)
859
860
861 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hmz", "2007/11/10 GMT-8 \\u4e0a\\u534810:10\\u2009\\u2013\\u20092007/11/20 GMT-8 \\u4e0a\\u534810:10",
862
863 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "h", "2007/11/10 \\u4e0a\\u534810\\u65f6\\u2009\\u2013\\u20092007/11/20 \\u4e0a\\u534810\\u65f6",
864
865 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMMMy", "2007\\u5e741\\u670810\\u65e5 \\u661f\\u671f\\u4e09", // (fixed expected result per ticket:6626:)
866
867 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hm", "\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
868
869
870 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hmz", "GMT-8\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
871
872 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "h", "\\u4e0a\\u534810\\u65F6\\u81f3\\u4e0b\\u53482\\u65f6",
873
874 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hv", "\\u6D1B\\u6749\\u77F6\\u65F6\\u95F4\\u4E0A\\u534810\\u65F6\\u81F3\\u4E0B\\u53482\\u65F6",
875
876 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hm", "\\u4e0a\\u534810:00\\u81f310:20",
877
878 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hmv", "\\u6D1B\\u6749\\u77F6\\u65F6\\u95F4\\u4E0A\\u534810:00\\u81F310:20",
879
880 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hz", "GMT-8\\u4e0a\\u534810\\u65f6",
881
882 "zh", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hm", "\\u4e0a\\u534810:10",
883
884 "zh", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "h", "\\u4e0a\\u534810\\u65f6",
885
886 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt. 2007\\u2009\\u2013\\u2009Freitag, 10. Okt. 2008",
887
888
889 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dMMM", "10. Okt. 2007\\u2009\\u2013\\u200910. Okt. 2008",
890
891 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "MMMy", "Okt. 2007\\u2009\\u2013\\u2009Okt. 2008",
892
893
894 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EdMy", "Mi. 10.10.2007\\u2009\\u2013\\u2009Fr. 10.10.2008",
895
896 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "dMy", "10.10.2007\\u2009\\u2013\\u200910.10.2008",
897
898
899 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "My", "10.2007\\u2009\\u2013\\u200910.2008",
900
901 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "EdM", "Mi. 10.10.2007\\u2009\\u2013\\u2009Fr. 10.10.2008",
902
903
904 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "y", "2007\\u20132008",
905
906 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "M", "10.2007\\u2009\\u2013\\u200910.2008",
907
908
909 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "hm", "10.10.2007, 10:10 AM\\u2009\\u2013\\u200910.10.2008, 10:10 AM",
910 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "Hm", "10.10.2007, 10:10\\u2009\\u2013\\u200910.10.2008, 10:10",
911
912 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt.\\u2009\\u2013\\u2009Samstag, 10. Nov. 2007",
913
914
915 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMM", "10. Okt.\\u2009\\u2013\\u200910. Nov.",
916
917 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMy", "Okt.\\u2013Nov. 2007",
918
919 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "EEEEdMMM", "Mittwoch, 10. Okt.\\u2009\\u2013\\u2009Samstag, 10. Nov.",
920
921
922 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dM", "10.10.\\u2009\\u2013\\u200910.11.",
923
924 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "My", "10.2007\\u2009\\u2013\\u200911.2007",
925
926
927 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "d", "10.10.\\u2009\\u2013\\u200910.11.",
928
929 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "y", "2007",
930
931
932 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMM", "Okt.\\u2013Nov.",
933
934
935 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "hms", "10.10.2007, 10:10:10 AM\\u2009\\u2013\\u200910.11.2007, 10:10:10 AM",
936 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "Hms", "10.10.2007, 10:10:10\\u2009\\u2013\\u200910.11.2007, 10:10:10",
937
938 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEEEdMMMy", "Samstag, 10.\\u2009\\u2013\\u2009Dienstag, 20. Nov. 2007",
939
940 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMy", "10.\\u201320. Nov. 2007",
941
942
943 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMMy", "Nov. 2007",
944
945 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEEEdMMM", "Samstag, 10.\\u2009\\u2013\\u2009Dienstag, 20. Nov.",
946
947 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EdMy", "Sa. 10.11.2007\\u2009\\u2013\\u2009Di. 20.11.2007",
948
949
950 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dM", "10.11.\\u2009\\u2013\\u200920.11.",
951
952 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "My", "11.2007",
953
954
955 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "d", "10.\\u201320.",
956
957 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "y", "2007",
958
959
960 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "hmv", "10.11.2007, 10:10 AM Los Angeles Zeit\\u2009\\u2013\\u200920.11.2007, 10:10 AM Los Angeles Zeit",
961
962 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMMy", "Mittwoch, 10. Jan. 2007",
963
964
965 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMM", "10. Jan.",
966
967 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMMy", "Jan. 2007",
968
969 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMM", "Mittwoch, 10. Jan.",
970
971 /* Following is an important test, because the 'h' in 'Uhr' is interpreted as a pattern
972 if not escaped properly. */
973 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "h", "10 AM\\u2009\\u2013\\u20092 PM",
974 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "H", "10\\u201314 Uhr",
975
976 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EEEEdMMM", "Mittwoch, 10. Jan.",
977
978
979 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hmv", "10:00\\u201310:20 AM Los Angeles Zeit",
980
981 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hmz", "10:00\\u201310:20 AM GMT-8",
982
983 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "h", "10 AM",
984 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "H", "10 Uhr",
985
986
987 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hz", "10 AM GMT-8",
988
989 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEEEdMMMy", "Mittwoch, 10. Jan. 2007",
990
991
992 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hmv", "10:10 AM Los Angeles Zeit",
993
994 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hmz", "10:10 AM GMT-8",
995
996
997 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hv", "10 AM Los Angeles Zeit",
998
999 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hz", "10 AM GMT-8",
1000
1001 // Thai (default calendar buddhist)
1002
1003 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E1E\\u0E38\\u0E18\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. 2550 \\u2013 \\u0E27\\u0E31\\u0E19\\u0E28\\u0E38\\u0E01\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. 2551",
1004
1005
1006 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. 2550 \\u2013 10 \\u0E15.\\u0E04. 2551",
1007
1008 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "MMMy", "\\u0E15.\\u0E04. 2550 \\u2013 \\u0E15.\\u0E04. 2551",
1009
1010
1011 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "EdMy", "\\u0E1E. 10/10/2550 \\u2013 \\u0E28. 10/10/2551",
1012
1013 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "dMy", "10/10/2550 \\u2013 10/10/2551",
1014
1015
1016 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "My", "10/2550 \\u2013 10/2551",
1017
1018 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "EdM", "\\u0E1E. 10/10/2550 \\u2013 \\u0E28. 10/10/2551",
1019
1020
1021 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "y", "2550\\u20132551",
1022
1023 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "M", "10/2550 \\u2013 10/2551",
1024
1025
1026 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E1E\\u0E38\\u0E18\\u0E17\\u0E35\\u0E48 10 \\u0E15.\\u0E04. \\u2013 \\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48 10 \\u0E1E.\\u0E22. 2550",
1027
1028
1029 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. \\u2013 10 \\u0E1E.\\u0E22.",
1030
1031 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "MMMy", "\\u0E15.\\u0E04.\\u2013\\u0E1E.\\u0E22. 2550",
1032
1033 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "dM", "10/10 \\u2013 10/11",
1034
1035 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "My", "10/2550 \\u2013 11/2550",
1036
1037
1038 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "d", "10/10 \\u2013 10/11",
1039
1040 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "y", "\\u0E1E.\\u0E28. 2550",
1041
1042
1043 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "MMM", "\\u0E15.\\u0E04.\\u2013\\u0E1E.\\u0E22.",
1044
1045 // Tests for Japanese calendar with eras, including new era in 2019 (Heisei 31 through April 30, then new era)
1046
1047 "en-u-ca-japanese", "H 31 03 15 09:00:00", "H 31 04 15 09:00:00", "GyMMMd", "Mar 15\\u2009\\u2013\\u2009Apr 15, 31 Heisei",
1048
1049 "en-u-ca-japanese", "H 31 03 15 09:00:00", "H 31 04 15 09:00:00", "GGGGGyMd", "3/15/31\\u2009\\u2013\\u20094/15/31 H",
1050
1051 "en-u-ca-japanese", "S 64 01 05 09:00:00", "H 1 01 15 09:00:00", "GyMMMd", "Jan 5, 64 Sh\\u014Dwa\\u2009\\u2013\\u2009Jan 15, 1 Heisei",
1052
1053 "en-u-ca-japanese", "S 64 01 05 09:00:00", "H 1 01 15 09:00:00", "GGGGGyMd", "1/5/64 S\\u2009\\u2013\\u20091/15/1 H",
1054
1055 "en-u-ca-japanese", "H 31 04 15 09:00:00", JP_ERA_2019_NARROW " 1 05 15 09:00:00", "GyMMMd", "Apr 15, 31 Heisei\\u2009\\u2013\\u2009May 15, 1 " JP_ERA_2019_ROOT,
1056
1057 "en-u-ca-japanese", "H 31 04 15 09:00:00", JP_ERA_2019_NARROW " 1 05 15 09:00:00", "GGGGGyMd", "4/15/31 H\\u2009\\u2013\\u20095/15/1 " JP_ERA_2019_NARROW,
1058
1059
1060 "ja-u-ca-japanese", "H 31 03 15 09:00:00", "H 31 04 15 09:00:00", "GyMMMd", "\\u5E73\\u621031\\u5E743\\u670815\\u65E5\\uFF5E4\\u670815\\u65E5",
1061
1062 "ja-u-ca-japanese", "H 31 03 15 09:00:00", "H 31 04 15 09:00:00", "GGGGGyMd", "H31/03/15\\uFF5E31/04/15",
1063
1064 "ja-u-ca-japanese", "S 64 01 05 09:00:00", "H 1 01 15 09:00:00", "GyMMMd", "\\u662D\\u548C64\\u5E741\\u67085\\u65E5\\uFF5E\\u5E73\\u6210\\u5143\\u5E741\\u670815\\u65E5",
1065
1066 "ja-u-ca-japanese", "S 64 01 05 09:00:00", "H 1 01 15 09:00:00", "GGGGGyMd", "S64/01/05\\uFF5EH1/01/15",
1067
1068 "ja-u-ca-japanese", "H 31 04 15 09:00:00", JP_ERA_2019_NARROW " 1 05 15 09:00:00", "GGGGGyMd", "H31/04/15\\uFF5E" JP_ERA_2019_NARROW "1/05/15",
1069
1070 "ar@calendar=islamic", "1438 10 10 10:10:10", "1438 10 20 10:10:10", "MMMd", "\\u0661\\u0660\\u2013\\u0662\\u0660 \\u0634\\u0648\\u0627\\u0644",
1071 };
1072 expect(DATA, UPRV_LENGTHOF(DATA));
1073 }
1074
1075
1076 void DateIntervalFormatTest::expect(const char** data, int32_t data_length) {
1077 int32_t i = 0;
1078 UErrorCode ec = U_ZERO_ERROR;
1079 UnicodeString str, str2;
1080 const char* pattern = data[i++];
1081
1082 while (i<data_length) {
1083 const char* locName = data[i++];
1084 const char* datestr = data[i++];
1085 const char* datestr_2 = data[i++];
1086
1087 Locale loc(locName);
1088 LocalPointer<Calendar> defCal(Calendar::createInstance(loc, ec));
1089 if (U_FAILURE(ec)) {
1090 dataerrln("Calendar::createInstance fails for loc %s with: %s", locName, u_errorName(ec));
1091 return;
1092 }
1093 const char* calType = defCal->getType();
1094
1095 Locale refLoc("root");
1096 if (calType) {
1097 refLoc.setKeywordValue("calendar", calType, ec);
1098 }
1099 SimpleDateFormat ref(pattern, refLoc, ec);
1100 logln( "case %d, locale: %s\n", (i-1)/5, locName);
1101 if (U_FAILURE(ec)) {
1102 dataerrln("contruct SimpleDateFormat in expect failed: %s", u_errorName(ec));
1103 return;
1104 }
1105
1106 // 'f'
1107 logln("original date: %s - %s\n", datestr, datestr_2);
1108 UDate date = ref.parse(ctou(datestr), ec);
1109 if (!assertSuccess("parse 1st data in expect", ec)) return;
1110 UDate date_2 = ref.parse(ctou(datestr_2), ec);
1111 if (!assertSuccess("parse 2nd data in expect", ec)) return;
1112 DateInterval dtitv(date, date_2);
1113
1114 const UnicodeString& oneSkeleton(ctou(data[i++]));
1115
1116 DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
1117 if (!assertSuccess("createInstance(skeleton) in expect", ec)) return;
1118 FieldPosition pos(FieldPosition::DONT_CARE);
1119 dtitvfmt->format(&dtitv, str.remove(), pos, ec);
1120 if (!assertSuccess("format in expect", ec)) return;
1121 assertEquals((UnicodeString)"\"" + locName + "\\" + oneSkeleton + "\\" + ctou(datestr) + "\\" + ctou(datestr_2) + "\"", ctou(data[i++]), str);
1122
1123 logln("interval date:" + str + "\"" + locName + "\", "
1124 + "\"" + datestr + "\", "
1125 + "\"" + datestr_2 + "\", " + oneSkeleton);
1126 delete dtitvfmt;
1127 }
1128 }
1129
1130
1131 /*
1132 * Test format using user defined DateIntervalInfo
1133 */
1134 void DateIntervalFormatTest::testFormatUserDII() {
1135 // first item is date pattern
1136 const char* DATA[] = {
1137 "yyyy MM dd HH:mm:ss",
1138 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Oct 10, 2007 --- Oct 10, 2008",
1139
1140 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 Oct 10 - Nov 2007",
1141
1142 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Nov 10, 2007 --- Nov 20, 2007",
1143
1144 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Jan 10, 2007",
1145
1146 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "Jan 10, 2007",
1147
1148 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "Jan 10, 2007",
1149
1150 "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "2007\\u5e7410\\u670810\\u65e5 --- 2008\\u5e7410\\u670810\\u65e5",
1151
1152 "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 10\\u6708 10 - 11\\u6708 2007",
1153
1154 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "2007\\u5e7411\\u670810\\u65e5 --- 2007\\u5e7411\\u670820\\u65e5",
1155
1156 "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1157
1158 "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1159
1160 "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1161
1162 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10. Okt. 2007 --- 10. Okt. 2008",
1163
1164
1165 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10. Nov. 2007 --- 20. Nov. 2007",
1166
1167 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10. Jan. 2007",
1168
1169 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10. Jan. 2007",
1170
1171
1172 "es", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10 oct 2007 --- 10 oct 2008",
1173
1174 "es", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 oct 10 - nov 2007",
1175
1176 "es", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10 nov 2007 --- 20 nov 2007",
1177
1178 "es", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10 ene 2007",
1179
1180 "es", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10 ene 2007",
1181
1182 "es", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "10 ene 2007",
1183 };
1184 expectUserDII(DATA, UPRV_LENGTHOF(DATA));
1185 }
1186
1187
1188 void DateIntervalFormatTest::testSetIntervalPatternNoSideEffect() {
1189 UErrorCode ec = U_ZERO_ERROR;
1190 LocalPointer<DateIntervalInfo> dtitvinf(new DateIntervalInfo(ec), ec);
1191 if (U_FAILURE(ec)) {
1192 errln("Failure encountered: %s", u_errorName(ec));
1193 return;
1194 }
1195 UnicodeString expected;
1196 dtitvinf->getIntervalPattern(ctou("yMd"), UCAL_DATE, expected, ec);
1197 dtitvinf->setIntervalPattern(ctou("yMd"), UCAL_DATE, ctou("M/d/y \\u2013 d"), ec);
1198 if (U_FAILURE(ec)) {
1199 errln("Failure encountered: %s", u_errorName(ec));
1200 return;
1201 }
1202 dtitvinf.adoptInsteadAndCheckErrorCode(new DateIntervalInfo(ec), ec);
1203 if (U_FAILURE(ec)) {
1204 errln("Failure encountered: %s", u_errorName(ec));
1205 return;
1206 }
1207 UnicodeString actual;
1208 dtitvinf->getIntervalPattern(ctou("yMd"), UCAL_DATE, actual, ec);
1209 if (U_FAILURE(ec)) {
1210 errln("Failure encountered: %s", u_errorName(ec));
1211 return;
1212 }
1213 if (expected != actual) {
1214 errln("DateIntervalInfo.setIntervalPattern should have no side effects.");
1215 }
1216 }
1217
1218 void DateIntervalFormatTest::testYearFormats() {
1219 const Locale &enLocale = Locale::getEnglish();
1220 UErrorCode status = U_ZERO_ERROR;
1221 LocalPointer<Calendar> fromTime(Calendar::createInstance(enLocale, status));
1222 LocalPointer<Calendar> toTime(Calendar::createInstance(enLocale, status));
1223 if (U_FAILURE(status)) {
1224 errln("Failure encountered: %s", u_errorName(status));
1225 return;
1226 }
1227 // April 26, 113. Three digit year so that we can test 2 digit years;
1228 // 4 digit years with padded 0's and full years.
1229 fromTime->set(113, 3, 26);
1230 // April 28, 113.
1231 toTime->set(113, 3, 28);
1232 {
1233 LocalPointer<DateIntervalFormat> dif(DateIntervalFormat::createInstance("yyyyMd", enLocale, status));
1234 if (U_FAILURE(status)) {
1235 dataerrln("Failure encountered: %s", u_errorName(status));
1236 return;
1237 }
1238 UnicodeString actual;
1239 UnicodeString expected(ctou("4/26/0113\\u2009\\u2013\\u20094/28/0113"));
1240 FieldPosition pos = 0;
1241 dif->format(*fromTime, *toTime, actual, pos, status);
1242 if (U_FAILURE(status)) {
1243 errln("Failure encountered: %s", u_errorName(status));
1244 return;
1245 }
1246 if (actual != expected) {
1247 errln("Expected " + expected + ", got: " + actual);
1248 }
1249 }
1250 {
1251 LocalPointer<DateIntervalFormat> dif(DateIntervalFormat::createInstance("yyMd", enLocale, status));
1252 if (U_FAILURE(status)) {
1253 errln("Failure encountered: %s", u_errorName(status));
1254 return;
1255 }
1256 UnicodeString actual;
1257 UnicodeString expected(ctou("4/26/13\\u2009\\u2013\\u20094/28/13"));
1258 FieldPosition pos(FieldPosition::DONT_CARE);
1259 dif->format(*fromTime, *toTime, actual, pos, status);
1260 if (U_FAILURE(status)) {
1261 errln("Failure encountered: %s", u_errorName(status));
1262 return;
1263 }
1264 if (actual != expected) {
1265 errln("Expected " + expected + ", got: " + actual);
1266 }
1267 }
1268 {
1269 LocalPointer<DateIntervalFormat> dif(DateIntervalFormat::createInstance("yMd", enLocale, status));
1270 if (U_FAILURE(status)) {
1271 errln("Failure encountered: %s", u_errorName(status));
1272 return;
1273 }
1274 UnicodeString actual;
1275 UnicodeString expected(ctou("4/26/113\\u2009\\u2013\\u20094/28/113"));
1276 FieldPosition pos(FieldPosition::DONT_CARE);
1277 dif->format(*fromTime, *toTime, actual, pos, status);
1278 if (U_FAILURE(status)) {
1279 errln("Failure encountered: %s", u_errorName(status));
1280 return;
1281 }
1282 if (actual != expected) {
1283 errln("Expected " + expected + ", got: " + actual);
1284 }
1285 }
1286 }
1287
1288 void DateIntervalFormatTest::expectUserDII(const char** data,
1289 int32_t data_length) {
1290 int32_t i = 0;
1291 UnicodeString str;
1292 UErrorCode ec = U_ZERO_ERROR;
1293 const char* pattern = data[0];
1294 i++;
1295
1296 while ( i < data_length ) {
1297 const char* locName = data[i++];
1298 Locale loc(locName);
1299 SimpleDateFormat ref(pattern, loc, ec);
1300 if (U_FAILURE(ec)) {
1301 dataerrln("contruct SimpleDateFormat in expectUserDII failed: %s", u_errorName(ec));
1302 return;
1303 }
1304 const char* datestr = data[i++];
1305 const char* datestr_2 = data[i++];
1306 UDate date = ref.parse(ctou(datestr), ec);
1307 if (!assertSuccess("parse in expectUserDII", ec)) return;
1308 UDate date_2 = ref.parse(ctou(datestr_2), ec);
1309 if (!assertSuccess("parse in expectUserDII", ec)) return;
1310 DateInterval dtitv(date, date_2);
1311
1312 ec = U_ZERO_ERROR;
1313 // test user created DateIntervalInfo
1314 DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
1315 dtitvinf->setFallbackIntervalPattern("{0} --- {1}", ec);
1316 dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_MONTH, "yyyy MMM d - MMM y",ec);
1317 if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
1318 dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_HOUR_OF_DAY, "yyyy MMM d HH:mm - HH:mm", ec);
1319 if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
1320 DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
1321 delete dtitvinf;
1322 if (!assertSuccess("createInstance(skeleton,dtitvinf) in expectUserDII", ec)) return;
1323 FieldPosition pos(FieldPosition::DONT_CARE);
1324 dtitvfmt->format(&dtitv, str.remove(), pos, ec);
1325 if (!assertSuccess("format in expectUserDII", ec)) return;
1326 assertEquals((UnicodeString)"\"" + locName + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
1327 #ifdef DTIFMTTS_DEBUG
1328 char result[1000];
1329 char mesg[1000];
1330 PRINTMESG("interval format using user defined DateIntervalInfo\n");
1331 str.extract(0, str.length(), result, "UTF-8");
1332 sprintf(mesg, "interval date: %s\n", result);
1333 PRINTMESG(mesg);
1334 #endif
1335 delete dtitvfmt;
1336 }
1337 }
1338
1339
1340 void DateIntervalFormatTest::testStress() {
1341 if(quick){
1342 logln("Quick mode: Skipping test");
1343 return;
1344 }
1345 const char* DATA[] = {
1346 "yyyy MM dd HH:mm:ss",
1347 "2007 10 10 10:10:10", "2008 10 10 10:10:10",
1348 "2007 10 10 10:10:10", "2007 11 10 10:10:10",
1349 "2007 11 10 10:10:10", "2007 11 20 10:10:10",
1350 "2007 01 10 10:00:10", "2007 01 10 14:10:10",
1351 "2007 01 10 10:00:10", "2007 01 10 10:20:10",
1352 "2007 01 10 10:10:10", "2007 01 10 10:10:20",
1353 };
1354
1355 const char* testLocale[][3] = {
1356 //{"th", "", ""},
1357 {"en", "", ""},
1358 {"zh", "", ""},
1359 {"de", "", ""},
1360 {"ar", "", ""},
1361 {"en", "GB", ""},
1362 {"fr", "", ""},
1363 {"it", "", ""},
1364 {"nl", "", ""},
1365 {"zh", "TW", ""},
1366 {"ja", "", ""},
1367 {"pt", "BR", ""},
1368 {"ru", "", ""},
1369 {"pl", "", ""},
1370 {"tr", "", ""},
1371 {"es", "", ""},
1372 {"ko", "", ""},
1373 {"sv", "", ""},
1374 {"fi", "", ""},
1375 {"da", "", ""},
1376 {"pt", "PT", ""},
1377 {"ro", "", ""},
1378 {"hu", "", ""},
1379 {"he", "", ""},
1380 {"in", "", ""},
1381 {"cs", "", ""},
1382 {"el", "", ""},
1383 {"no", "", ""},
1384 {"vi", "", ""},
1385 {"bg", "", ""},
1386 {"hr", "", ""},
1387 {"lt", "", ""},
1388 {"sk", "", ""},
1389 {"sl", "", ""},
1390 {"sr", "", ""},
1391 {"ca", "", ""},
1392 {"lv", "", ""},
1393 {"uk", "", ""},
1394 {"hi", "", ""},
1395 };
1396
1397 uint32_t localeIndex;
1398 for ( localeIndex = 0; localeIndex < UPRV_LENGTHOF(testLocale); ++localeIndex ) {
1399 char locName[32];
1400 uprv_strcpy(locName, testLocale[localeIndex][0]);
1401 uprv_strcat(locName, testLocale[localeIndex][1]);
1402 stress(DATA, UPRV_LENGTHOF(DATA), Locale(testLocale[localeIndex][0], testLocale[localeIndex][1], testLocale[localeIndex][2]), locName);
1403 }
1404 }
1405
1406
1407 void DateIntervalFormatTest::stress(const char** data, int32_t data_length,
1408 const Locale& loc, const char* locName) {
1409 UnicodeString skeleton[] = {
1410 "EEEEdMMMMy",
1411 "dMMMMy",
1412 "dMMMM",
1413 "MMMMy",
1414 "EEEEdMMMM",
1415 "EdMMMy",
1416 "dMMMy",
1417 "dMMM",
1418 "MMMy",
1419 "EdMMM",
1420 "EdMy",
1421 "dMy",
1422 "dM",
1423 "My",
1424 "EdM",
1425 "d",
1426 "Ed",
1427 "y",
1428 "M",
1429 "MMM",
1430 "MMMM",
1431 "hm",
1432 "hmv",
1433 "hmz",
1434 "h",
1435 "hv",
1436 "hz",
1437 "EEddMMyyyy", // following could be normalized
1438 "EddMMy",
1439 "hhmm",
1440 "hhmmzz",
1441 "hms", // following could not be normalized
1442 "dMMMMMy",
1443 "EEEEEdM",
1444 };
1445
1446 int32_t i = 0;
1447 UErrorCode ec = U_ZERO_ERROR;
1448 UnicodeString str, str2;
1449 SimpleDateFormat ref(data[i++], loc, ec);
1450 if (!assertSuccess("construct SimpleDateFormat", ec)) return;
1451
1452 #ifdef DTIFMTTS_DEBUG
1453 char result[1000];
1454 char mesg[1000];
1455 sprintf(mesg, "locale: %s\n", locName);
1456 PRINTMESG(mesg);
1457 #endif
1458
1459 while (i<data_length) {
1460
1461 // 'f'
1462 const char* datestr = data[i++];
1463 const char* datestr_2 = data[i++];
1464 #ifdef DTIFMTTS_DEBUG
1465 sprintf(mesg, "original date: %s - %s\n", datestr, datestr_2);
1466 PRINTMESG(mesg)
1467 #endif
1468 UDate date = ref.parse(ctou(datestr), ec);
1469 if (!assertSuccess("parse", ec)) return;
1470 UDate date_2 = ref.parse(ctou(datestr_2), ec);
1471 if (!assertSuccess("parse", ec)) return;
1472 DateInterval dtitv(date, date_2);
1473
1474 for ( uint32_t skeletonIndex = 0;
1475 skeletonIndex < UPRV_LENGTHOF(skeleton);
1476 ++skeletonIndex ) {
1477 const UnicodeString& oneSkeleton = skeleton[skeletonIndex];
1478 DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
1479 if (!assertSuccess("createInstance(skeleton)", ec)) return;
1480 /*
1481 // reset the calendar to be Gregorian calendar for "th"
1482 if ( uprv_strcmp(locName, "th") == 0 ) {
1483 GregorianCalendar* gregCal = new GregorianCalendar(loc, ec);
1484 if (!assertSuccess("GregorianCalendar()", ec)) return;
1485 const DateFormat* dformat = dtitvfmt->getDateFormat();
1486 DateFormat* newOne = (DateFormat*)dformat->clone();
1487 newOne->adoptCalendar(gregCal);
1488 //dtitvfmt->adoptDateFormat(newOne, ec);
1489 dtitvfmt->setDateFormat(*newOne, ec);
1490 delete newOne;
1491 if (!assertSuccess("adoptDateFormat()", ec)) return;
1492 }
1493 */
1494 FieldPosition pos(FieldPosition::DONT_CARE);
1495 dtitvfmt->format(&dtitv, str.remove(), pos, ec);
1496 if (!assertSuccess("format", ec)) return;
1497 #ifdef DTIFMTTS_DEBUG
1498 oneSkeleton.extract(0, oneSkeleton.length(), result, "UTF-8");
1499 sprintf(mesg, "interval by skeleton: %s\n", result);
1500 PRINTMESG(mesg)
1501 str.extract(0, str.length(), result, "UTF-8");
1502 sprintf(mesg, "interval date: %s\n", result);
1503 PRINTMESG(mesg)
1504 #endif
1505 delete dtitvfmt;
1506 }
1507
1508 // test user created DateIntervalInfo
1509 ec = U_ZERO_ERROR;
1510 DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
1511 dtitvinf->setFallbackIntervalPattern("{0} --- {1}", ec);
1512 dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_MONTH, "yyyy MMM d - MMM y",ec);
1513 if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
1514 dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_HOUR_OF_DAY, "yyyy MMM d HH:mm - HH:mm", ec);
1515 if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
1516 DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
1517 delete dtitvinf;
1518 if (!assertSuccess("createInstance(skeleton,dtitvinf)", ec)) return;
1519 FieldPosition pos(FieldPosition::DONT_CARE);
1520 dtitvfmt->format(&dtitv, str.remove(), pos, ec);
1521 if ( uprv_strcmp(locName, "th") ) {
1522 if (!assertSuccess("format", ec)) return;
1523 #ifdef DTIFMTTS_DEBUG
1524 PRINTMESG("interval format using user defined DateIntervalInfo\n");
1525 str.extract(0, str.length(), result, "UTF-8");
1526 sprintf(mesg, "interval date: %s\n", result);
1527 PRINTMESG(mesg)
1528 #endif
1529 } else {
1530 // for "th", the default calendar is Budhist,
1531 // not Gregorian.
1532 assertTrue("Default calendar for \"th\" is Budhist", ec == U_ILLEGAL_ARGUMENT_ERROR);
1533 ec = U_ZERO_ERROR;
1534 }
1535 delete dtitvfmt;
1536 }
1537 }
1538
1539 void DateIntervalFormatTest::testTicket11583_2() {
1540 UErrorCode status = U_ZERO_ERROR;
1541 LocalPointer<DateIntervalFormat> fmt(
1542 DateIntervalFormat::createInstance("yMMM", "es-US", status));
1543 if (!assertSuccess("Error create format object", status)) {
1544 return;
1545 }
1546 DateInterval interval((UDate) 1232364615000.0, (UDate) 1328787015000.0);
1547 UnicodeString appendTo;
1548 FieldPosition fpos(FieldPosition::DONT_CARE);
1549 UnicodeString expected("ene. 2009\\u2009\\u2013\\u2009feb. 2012");
1550 assertEquals(
1551 "",
1552 expected.unescape(),
1553 fmt->format(&interval, appendTo, fpos, status));
1554 if (!assertSuccess("Error formatting", status)) {
1555 return;
1556 }
1557 }
1558
1559
1560 void DateIntervalFormatTest::testTicket11985() {
1561 UErrorCode status = U_ZERO_ERROR;
1562 LocalPointer<DateIntervalFormat> fmt(
1563 DateIntervalFormat::createInstance(UDAT_HOUR_MINUTE, Locale::getEnglish(), status));
1564 if (!assertSuccess("createInstance", status)) {
1565 return;
1566 }
1567 UnicodeString pattern;
1568 static_cast<const SimpleDateFormat*>(fmt->getDateFormat())->toPattern(pattern);
1569 assertEquals("Format pattern", "h:mm a", pattern);
1570 }
1571
1572 // Ticket 11669 - thread safety of DateIntervalFormat::format(). This test failed before
1573 // the implementation was fixed.
1574
1575 static const DateIntervalFormat *gIntervalFormatter = NULL; // The Formatter to be used concurrently by test threads.
1576 static const DateInterval *gInterval = NULL; // The date interval to be formatted concurrently.
1577 static const UnicodeString *gExpectedResult = NULL;
1578
1579 void DateIntervalFormatTest::threadFunc11669(int32_t threadNum) {
1580 (void)threadNum;
1581 for (int loop=0; loop<1000; ++loop) {
1582 UErrorCode status = U_ZERO_ERROR;
1583 FieldPosition pos(FieldPosition::DONT_CARE);
1584 UnicodeString result;
1585 gIntervalFormatter->format(gInterval, result, pos, status);
1586 if (U_FAILURE(status)) {
1587 errln("%s:%d %s", __FILE__, __LINE__, u_errorName(status));
1588 return;
1589 }
1590 if (result != *gExpectedResult) {
1591 errln("%s:%d Expected \"%s\", got \"%s\"", __FILE__, __LINE__, CStr(*gExpectedResult)(), CStr(result)());
1592 return;
1593 }
1594 }
1595 }
1596
1597 void DateIntervalFormatTest::testTicket11669() {
1598 UErrorCode status = U_ZERO_ERROR;
1599 LocalPointer<DateIntervalFormat> formatter(DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, Locale::getEnglish(), status), status);
1600 LocalPointer<TimeZone> tz(TimeZone::createTimeZone("America/Los_Angleles"), status);
1601 LocalPointer<Calendar> intervalStart(Calendar::createInstance(*tz, Locale::getEnglish(), status), status);
1602 LocalPointer<Calendar> intervalEnd(Calendar::createInstance(*tz, Locale::getEnglish(), status), status);
1603 if (U_FAILURE(status)) {
1604 errcheckln(status, "%s:%d %s", __FILE__, __LINE__, u_errorName(status));
1605 return;
1606 }
1607
1608 intervalStart->set(2009, 6, 1, 14, 0);
1609 intervalEnd->set(2009, 6, 2, 14, 0);
1610 DateInterval interval(intervalStart->getTime(status), intervalEnd->getTime(status));
1611 FieldPosition pos(FieldPosition::DONT_CARE);
1612 UnicodeString expectedResult;
1613 formatter->format(&interval, expectedResult, pos, status);
1614 if (U_FAILURE(status)) {
1615 errln("%s:%d %s", __FILE__, __LINE__, u_errorName(status));
1616 return;
1617 }
1618
1619 gInterval = &interval;
1620 gIntervalFormatter = formatter.getAlias();
1621 gExpectedResult = &expectedResult;
1622
1623 ThreadPool<DateIntervalFormatTest> threads(this, 4, &DateIntervalFormatTest::threadFunc11669);
1624 threads.start();
1625 threads.join();
1626
1627 gInterval = NULL; // Don't leave dangling pointers lying around. Not strictly necessary.
1628 gIntervalFormatter = NULL;
1629 gExpectedResult = NULL;
1630 }
1631
1632
1633 // testTicket12065
1634 // Using a DateIntervalFormat to format shouldn't change its state in any way
1635 // that changes how the behavior of operator ==.
1636 void DateIntervalFormatTest::testTicket12065() {
1637 UErrorCode status = U_ZERO_ERROR;
1638 LocalPointer<DateIntervalFormat> formatter(DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, Locale::getEnglish(), status), status);
1639 if (formatter.isNull()) {
1640 dataerrln("FAIL: DateIntervalFormat::createInstance failed for Locale::getEnglish()");
1641 return;
1642 }
1643 LocalPointer<DateIntervalFormat> clone(dynamic_cast<DateIntervalFormat *>(formatter->clone()));
1644 if (*formatter != *clone) {
1645 errln("%s:%d DateIntervalFormat and clone are not equal.", __FILE__, __LINE__);
1646 return;
1647 }
1648 DateInterval interval((UDate) 1232364615000.0, (UDate) 1328787015000.0);
1649 UnicodeString appendTo;
1650 FieldPosition fpos(FieldPosition::DONT_CARE);
1651 formatter->format(&interval, appendTo, fpos, status);
1652 if (*formatter != *clone) {
1653 errln("%s:%d DateIntervalFormat and clone are not equal after formatting.", __FILE__, __LINE__);
1654 return;
1655 }
1656 if (U_FAILURE(status)) {
1657 errln("%s:%d %s", __FILE__, __LINE__, u_errorName(status));
1658 }
1659 }
1660
1661
1662 #endif /* #if !UCONFIG_NO_FORMATTING */