1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2016, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
9 #include "unicode/utypes.h"
11 #if !UCONFIG_NO_FORMATTING
14 //TODO: define it in compiler flag
15 //#define DTIFMTTS_DEBUG 1
27 #include "simplethread.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"
39 //#define PRINTMESG(msg) { std::cout << "(" << __FILE__ << ":" << __LINE__ << ") " << msg << "\n"; }
40 #define PRINTMESG(msg) { std::cout << msg; }
46 void DateIntervalFormatTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par*/ ) {
47 if (exec
) logln("TestSuite DateIntervalFormat");
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;
64 * Test various generic API methods of DateIntervalFormat for API coverage.
66 void DateIntervalFormatTest::testAPI() {
68 /* ====== Test create interval instance with default locale and skeleton
70 UErrorCode status
= U_ZERO_ERROR
;
71 logln("Testing DateIntervalFormat create instance with default locale and skeleton");
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");
82 /* ====== Test create interval instance with given locale and skeleton
84 status
= U_ZERO_ERROR
;
85 logln("Testing DateIntervalFormat create instance with given locale and skeleton");
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");
96 /* ====== Test create interval instance with dateIntervalInfo and skeleton
98 status
= U_ZERO_ERROR
;
99 logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
101 DateIntervalInfo
* dtitvinf
= new DateIntervalInfo(Locale::getSimplifiedChinese(), status
);
103 dtitvfmt
= DateIntervalFormat::createInstance("EEEdMMMyhms", *dtitvinf
, status
);
106 if(U_FAILURE(status
)) {
107 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + default locale) - exitting");
114 /* ====== Test create interval instance with dateIntervalInfo and skeleton
116 status
= U_ZERO_ERROR
;
117 logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
119 dtitvinf
= new DateIntervalInfo(Locale::getSimplifiedChinese(), status
);
121 dtitvfmt
= DateIntervalFormat::createInstance("EEEdMMMyhms", Locale::getSimplifiedChinese(), *dtitvinf
, status
);
123 if(U_FAILURE(status
)) {
124 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + locale) - exitting");
127 // not deleted, test clone
130 // ====== Test clone()
131 status
= U_ZERO_ERROR
;
132 logln("Testing DateIntervalFormat clone");
134 DateIntervalFormat
* another
= (DateIntervalFormat
*)dtitvfmt
->clone();
135 if ( (*another
) != (*dtitvfmt
) ) {
136 dataerrln("%s:%d ERROR: clone failed", __FILE__
, __LINE__
);
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");
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
));
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
));
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
));
175 LocalPointer
<DateIntervalInfo
> dii(new DateIntervalInfo(Locale::getEnglish(), status
), status
);
176 if (U_FAILURE(status
)) {
177 errln("Failure encountered: %s", u_errorName(status
));
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
));
186 dif
.adoptInstead(DateIntervalFormat::createInstance("yMd", enLocale
, status
));
187 if (U_FAILURE(status
)) {
188 errln("Failure encountered: %s", u_errorName(status
));
191 UnicodeString actual
;
193 dif
->format(*fromTime
, *toTime
, actual
, pos
, status
);
194 if (U_FAILURE(status
)) {
195 errln("Failure encountered: %s", u_errorName(status
));
198 if (expected
!= actual
) {
199 errln("DateIntervalFormat.setIntervalInfo should have no side effects.");
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");
213 // ====== Test getDateFormat, setDateFormat, adoptDateFormat
215 status
= U_ZERO_ERROR
;
216 logln("Testing DateIntervalFormat getDateFormat");
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");
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");
236 // ======= Test getStaticClassID()
238 logln("Testing getStaticClassID()");
241 if(dtitvfmt
->getDynamicClassID() != DateIntervalFormat::getStaticClassID()) {
242 errln("ERROR: getDynamicClassID() didn't return the expected value");
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;
252 DateFormat* constFmt = (constFmt*)dtitvfmt->getDateFormat()->clone();
253 inf = dtitvfmt->getDateIntervalInfo()->clone();
256 DateIntervalFormat* dtifmt = new DateIntervalFormat(fmt, inf, status);
257 if(U_FAILURE(status)) {
258 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
262 DateIntervalFormat* dtifmt2 = new(dtifmt);
263 if ( (*dtifmt) != (*dtifmt2) ) {
264 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
268 DateIntervalFormat dtifmt3 = (*dtifmt);
269 if ( (*dtifmt) != dtifmt3 ) {
270 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
280 //===== test format and parse ==================
281 Formattable formattable
;
282 formattable
.setInt64(10);
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");
292 DateInterval
* dtitv
= new DateInterval(3600*24*365, 3600*24*366);
293 formattable
.adoptObject(dtitv
);
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");
303 const DateFormat
* dfmt
= dtitvfmt
->getDateFormat();
304 Calendar
* fromCal
= dfmt
->getCalendar()->clone();
305 Calendar
* toCal
= dfmt
->getCalendar()->clone();
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");
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");
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
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"));
343 dtitvfmt
->adoptTimeZone(tzCalif
);
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
);
353 errln("ERROR: DateIntervalFormat::format for tzCalif, status %s", u_errorName(status
));
356 dtitvfmt
->setTimeZone(*tzTokyo
);
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
);
366 errln("ERROR: DateIntervalFormat::format for tzTokyo, status %s", u_errorName(status
));
369 if ( dtitvfmt
->getTimeZone() != *tzTokyo
) {
370 errln("ERROR: DateIntervalFormat::getTimeZone returns mismatch.");
373 delete tzTokyo
; // tzCalif was owned by dtitvfmt which should have deleted it
377 errln("ERROR: DateIntervalFormat::createInstance(\"MdHH\", Locale::getEnglish(), ...), status %s", u_errorName(status
));
379 //====== test format in testFormat()
381 //====== test DateInterval class (better coverage)
382 DateInterval
dtitv1(3600*24*365, 3600*24*366);
383 DateInterval
dtitv2(dtitv1
);
385 if (!(dtitv1
== dtitv2
)) {
386 errln("ERROR: Copy constructor failed for DateInterval.");
389 DateInterval
dtitv3(3600*365, 3600*366);
391 if (!(dtitv3
== dtitv1
)) {
392 errln("ERROR: Equal operator failed for DateInterval.");
395 DateInterval
*dtitv4
= dtitv1
.clone();
396 if (*dtitv4
!= dtitv1
) {
397 errln("ERROR: Equal operator failed for DateInterval.");
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
413 "root", "CE 2007 11 10 10:10:10", "CE 2007 12 10 10:10:10", "yM", "2007-11 \\u2013 2007-12",
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",
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",
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",
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",
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",
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",
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",
436 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "MMMMy", "October 2007\\u2009\\u2013\\u2009October 2008",
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",
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",
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",
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",
446 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "MMMy", "Oct 2007\\u2009\\u2013\\u2009Oct 2008",
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",
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",
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",
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",
456 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "My", "10/2007\\u2009\\u2013\\u200910/2008",
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",
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",
462 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "Ed", "10 Wed\\u2009\\u2013\\u200910 Fri",
464 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "y", "2007\\u2009\\u2013\\u20092008",
466 "en", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "M", "10/2007\\u2009\\u2013\\u200910/2008",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
500 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMMy", "October 10\\u2009\\u2013\\u2009November 10, 2007",
502 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMM", "October 10\\u2009\\u2013\\u2009November 10",
504 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMMy", "October\\u2009\\u2013\\u2009November 2007",
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",
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",
510 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMy", "Oct 10\\u2009\\u2013\\u2009Nov 10, 2007",
512 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMM", "Oct 10\\u2009\\u2013\\u2009Nov 10",
514 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMy", "Oct\\u2009\\u2013\\u2009Nov 2007",
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",
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",
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",
523 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "My", "10/2007\\u2009\\u2013\\u200911/2007",
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",
527 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "d", "10/10\\u2009\\u2013\\u200911/10",
529 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "Ed", "10 Wed\\u2009\\u2013\\u200910 Sat",
531 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "y", "2007",
533 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "M", "10\\u2009\\u2013\\u200911",
535 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMM", "Oct\\u2009\\u2013\\u2009Nov",
537 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMM", "October\\u2009\\u2013\\u2009November",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
562 "en", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMMMy", "O 10\\u2009\\u2013\\u2009N 10, 2007",
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",
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",
568 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMMy", "November 10\\u2009\\u2013\\u200920, 2007",
570 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMM", "November 10\\u2009\\u2013\\u200920",
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",
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",
577 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMy", "Nov 10\\u2009\\u2013\\u200920, 2007",
579 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMM", "Nov 10\\u2009\\u2013\\u200920",
581 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMMy", "Nov 2007",
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",
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",
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",
589 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dM", "11/10\\u2009\\u2013\\u200911/20",
591 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "My", "11/2007",
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",
595 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "d", "10\\u2009\\u2013\\u200920",
597 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "Ed", "10 Sat\\u2009\\u2013\\u200920 Tue",
599 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "y", "2007",
601 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "M", "11",
603 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMM", "Nov",
605 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMMM", "November",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
633 "en", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMMMy", "N 10\\u2009\\u2013\\u200920, 2007",
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",
637 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMMMy", "Wednesday, January 10, 2007",
639 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMMMy", "January 10, 2007",
641 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMMM", "January 10",
643 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMMMy", "January 2007",
645 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMMM", "Wednesday, January 10",
647 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EdMMMy", "Wed, Jan 10, 2007",
649 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMMy", "Jan 10, 2007",
651 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMM", "Jan 10",
653 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMMy", "Jan 2007",
655 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EdMMM", "Wed, Jan 10",
658 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMy", "1/10/2007",
660 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dM", "1/10",
662 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "My", "1/2007",
664 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EdM", "Wed, 1/10",
666 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "d", "10",
668 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "Ed", "10 Wed",
670 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "y", "2007",
672 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "M", "1",
674 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMM", "Jan",
676 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMMM", "January",
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",
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",
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",
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",
689 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hz", "10 AM\\u2009\\u2013\\u20092 PM PST",
691 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEddMMyyyy", "Wed, 01/10/2007",
693 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EddMMy", "Wed, 01/10/2007",
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",
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",
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",
703 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMMMMy", "J 10, 2007",
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",
708 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMMM", "January 10",
710 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "MMMMy", "January 2007",
712 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EEEEdMMMM", "Wednesday, January 10",
714 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EdMMMy", "Wed, Jan 10, 2007",
716 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMMy", "Jan 10, 2007",
718 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMM", "Jan 10",
721 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EdMMM", "Wed, Jan 10",
723 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EdMy", "Wed, 1/10/2007",
725 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMy", "1/10/2007",
728 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "My", "1/2007",
730 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EdM", "Wed, 1/10",
732 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "d", "10",
735 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "y", "2007",
737 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "M", "1",
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",
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",
748 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hv", "10 AM PT",
752 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EddMMy", "Wed, 01/10/2007",
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",
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",
760 "en", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "dMMMMMy", "J 10, 2007",
763 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEEEdMMMMy", "Wednesday, January 10, 2007",
765 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMMMMy", "January 10, 2007",
768 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "MMMMy", "January 2007",
770 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEEEdMMMM", "Wednesday, January 10",
773 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMMMy", "Jan 10, 2007",
775 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMMM", "Jan 10",
778 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EdMMM", "Wed, Jan 10",
780 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EdMy", "Wed, 1/10/2007",
782 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMy", "1/10/2007",
785 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "My", "1/2007",
787 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EdM", "Wed, 1/10",
789 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "d", "10",
792 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "y", "2007",
794 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "M", "1",
797 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "MMMM", "January",
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",
803 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hmz", "10:10 AM PST",
805 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "h", "10 AM",
807 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hv", "10 AM PT",
810 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEddMMyyyy", "Wed, 01/10/2007",
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",
816 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hhmmzz", "10:10 AM PST",
819 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "dMMMMMy", "J 10, 2007",
821 "en", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEEEEdM", "W, 1/10",
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",
826 "zh", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u81f311\\u670810\\u65e5",
829 "zh", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMMy", "2007\\u5e7410\\u6708\\u81f311\\u6708",
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",
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",
837 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMM", "11\\u670810\\u65e5\\u81f320\\u65e5",
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:)
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",
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",
847 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dM", "11/10\\u2009\\u2013\\u200911/20",
849 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "My", "2007\\u5E7411\\u6708",
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",
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:)
856 "zh", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "M", "11\\u6708",
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)
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",
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",
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:)
867 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "hm", "\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
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",
872 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "h", "\\u4e0a\\u534810\\u65F6\\u81f3\\u4e0b\\u53482\\u65f6",
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",
876 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hm", "\\u4e0a\\u534810:00\\u81f310:20",
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",
880 "zh", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hz", "GMT-8\\u4e0a\\u534810\\u65f6",
882 "zh", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hm", "\\u4e0a\\u534810:10",
884 "zh", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "h", "\\u4e0a\\u534810\\u65f6",
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",
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",
891 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "MMMy", "Okt. 2007\\u2009\\u2013\\u2009Okt. 2008",
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",
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",
899 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "My", "10.2007\\u2009\\u2013\\u200910.2008",
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",
904 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "y", "2007\\u20132008",
906 "de", "CE 2007 10 10 10:10:10", "CE 2008 10 10 10:10:10", "M", "10.2007\\u2009\\u2013\\u200910.2008",
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",
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",
915 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dMMM", "10. Okt.\\u2009\\u2013\\u200910. Nov.",
917 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMMy", "Okt.\\u2013Nov. 2007",
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.",
922 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "dM", "10.10.\\u2009\\u2013\\u200910.11.",
924 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "My", "10.2007\\u2009\\u2013\\u200911.2007",
927 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "d", "10.10.\\u2009\\u2013\\u200910.11.",
929 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "y", "2007",
932 "de", "CE 2007 10 10 10:10:10", "CE 2007 11 10 10:10:10", "MMM", "Okt.\\u2013Nov.",
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",
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",
940 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dMMMy", "10.\\u201320. Nov. 2007",
943 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "MMMy", "Nov. 2007",
945 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "EEEEdMMM", "Samstag, 10.\\u2009\\u2013\\u2009Dienstag, 20. Nov.",
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",
950 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "dM", "10.11.\\u2009\\u2013\\u200920.11.",
952 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "My", "11.2007",
955 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "d", "10.\\u201320.",
957 "de", "CE 2007 11 10 10:10:10", "CE 2007 11 20 10:10:10", "y", "2007",
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",
962 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMMy", "Mittwoch, 10. Jan. 2007",
965 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "dMMM", "10. Jan.",
967 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "MMMy", "Jan. 2007",
969 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 14:10:10", "EEEEdMMM", "Mittwoch, 10. Jan.",
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",
976 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "EEEEdMMM", "Mittwoch, 10. Jan.",
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",
981 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hmz", "10:00\\u201310:20 AM GMT-8",
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",
987 "de", "CE 2007 01 10 10:00:10", "CE 2007 01 10 10:20:10", "hz", "10 AM GMT-8",
989 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "EEEEdMMMy", "Mittwoch, 10. Jan. 2007",
992 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hmv", "10:10 AM Los Angeles Zeit",
994 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hmz", "10:10 AM GMT-8",
997 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hv", "10 AM Los Angeles Zeit",
999 "de", "CE 2007 01 10 10:10:10", "CE 2007 01 10 10:10:20", "hz", "10 AM GMT-8",
1001 // Thai (default calendar buddhist)
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",
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",
1008 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "MMMy", "\\u0E15.\\u0E04. 2550 \\u2013 \\u0E15.\\u0E04. 2551",
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",
1013 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "dMy", "10/10/2550 \\u2013 10/10/2551",
1016 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "My", "10/2550 \\u2013 10/2551",
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",
1021 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "y", "2550\\u20132551",
1023 "th", "BE 2550 10 10 10:10:10", "BE 2551 10 10 10:10:10", "M", "10/2550 \\u2013 10/2551",
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",
1029 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. \\u2013 10 \\u0E1E.\\u0E22.",
1031 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "MMMy", "\\u0E15.\\u0E04.\\u2013\\u0E1E.\\u0E22. 2550",
1033 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "dM", "10/10 \\u2013 10/11",
1035 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "My", "10/2550 \\u2013 11/2550",
1038 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "d", "10/10 \\u2013 10/11",
1040 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "y", "\\u0E1E.\\u0E28. 2550",
1043 "th", "BE 2550 10 10 10:10:10", "BE 2550 11 10 10:10:10", "MMM", "\\u0E15.\\u0E04.\\u2013\\u0E1E.\\u0E22.",
1045 // Tests for Japanese calendar with eras, including new era in 2019 (Heisei 31 through April 30, then new era)
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",
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",
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",
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",
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
,
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
,
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",
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",
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",
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",
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",
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",
1072 expect(DATA
, UPRV_LENGTHOF(DATA
));
1076 void DateIntervalFormatTest::expect(const char** data
, int32_t data_length
) {
1078 UErrorCode ec
= U_ZERO_ERROR
;
1079 UnicodeString str
, str2
;
1080 const char* pattern
= data
[i
++];
1082 while (i
<data_length
) {
1083 const char* locName
= data
[i
++];
1084 const char* datestr
= data
[i
++];
1085 const char* datestr_2
= data
[i
++];
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
));
1093 const char* calType
= defCal
->getType();
1095 Locale
refLoc("root");
1097 refLoc
.setKeywordValue("calendar", calType
, ec
);
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
));
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
);
1114 const UnicodeString
& oneSkeleton(ctou(data
[i
++]));
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
);
1123 logln("interval date:" + str
+ "\"" + locName
+ "\", "
1124 + "\"" + datestr
+ "\", "
1125 + "\"" + datestr_2
+ "\", " + oneSkeleton
);
1132 * Test format using user defined DateIntervalInfo
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",
1140 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 Oct 10 - Nov 2007",
1142 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Nov 10, 2007 --- Nov 20, 2007",
1144 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Jan 10, 2007",
1146 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "Jan 10, 2007",
1148 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "Jan 10, 2007",
1150 "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "2007\\u5e7410\\u670810\\u65e5 --- 2008\\u5e7410\\u670810\\u65e5",
1152 "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 10\\u6708 10 - 11\\u6708 2007",
1154 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "2007\\u5e7411\\u670810\\u65e5 --- 2007\\u5e7411\\u670820\\u65e5",
1156 "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1158 "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1160 "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1162 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10. Okt. 2007 --- 10. Okt. 2008",
1165 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10. Nov. 2007 --- 20. Nov. 2007",
1167 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10. Jan. 2007",
1169 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10. Jan. 2007",
1172 "es", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10 oct 2007 --- 10 oct 2008",
1174 "es", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 oct 10 - nov 2007",
1176 "es", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10 nov 2007 --- 20 nov 2007",
1178 "es", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10 ene 2007",
1180 "es", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10 ene 2007",
1182 "es", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "10 ene 2007",
1184 expectUserDII(DATA
, UPRV_LENGTHOF(DATA
));
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
));
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
));
1202 dtitvinf
.adoptInsteadAndCheckErrorCode(new DateIntervalInfo(ec
), ec
);
1203 if (U_FAILURE(ec
)) {
1204 errln("Failure encountered: %s", u_errorName(ec
));
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
));
1213 if (expected
!= actual
) {
1214 errln("DateIntervalInfo.setIntervalPattern should have no side effects.");
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
));
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);
1231 toTime
->set(113, 3, 28);
1233 LocalPointer
<DateIntervalFormat
> dif(DateIntervalFormat::createInstance("yyyyMd", enLocale
, status
));
1234 if (U_FAILURE(status
)) {
1235 dataerrln("Failure encountered: %s", u_errorName(status
));
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
));
1246 if (actual
!= expected
) {
1247 errln("Expected " + expected
+ ", got: " + actual
);
1251 LocalPointer
<DateIntervalFormat
> dif(DateIntervalFormat::createInstance("yyMd", enLocale
, status
));
1252 if (U_FAILURE(status
)) {
1253 errln("Failure encountered: %s", u_errorName(status
));
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
));
1264 if (actual
!= expected
) {
1265 errln("Expected " + expected
+ ", got: " + actual
);
1269 LocalPointer
<DateIntervalFormat
> dif(DateIntervalFormat::createInstance("yMd", enLocale
, status
));
1270 if (U_FAILURE(status
)) {
1271 errln("Failure encountered: %s", u_errorName(status
));
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
));
1282 if (actual
!= expected
) {
1283 errln("Expected " + expected
+ ", got: " + actual
);
1288 void DateIntervalFormatTest::expectUserDII(const char** data
,
1289 int32_t data_length
) {
1292 UErrorCode ec
= U_ZERO_ERROR
;
1293 const char* pattern
= data
[0];
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
));
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
);
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
);
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
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
);
1340 void DateIntervalFormatTest::testStress() {
1342 logln("Quick mode: Skipping test");
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",
1355 const char* testLocale
[][3] = {
1397 uint32_t localeIndex
;
1398 for ( localeIndex
= 0; localeIndex
< UPRV_LENGTHOF(testLocale
); ++localeIndex
) {
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
);
1407 void DateIntervalFormatTest::stress(const char** data
, int32_t data_length
,
1408 const Locale
& loc
, const char* locName
) {
1409 UnicodeString skeleton
[] = {
1437 "EEddMMyyyy", // following could be normalized
1441 "hms", // following could not be normalized
1447 UErrorCode ec
= U_ZERO_ERROR
;
1448 UnicodeString str
, str2
;
1449 SimpleDateFormat
ref(data
[i
++], loc
, ec
);
1450 if (!assertSuccess("construct SimpleDateFormat", ec
)) return;
1452 #ifdef DTIFMTTS_DEBUG
1455 sprintf(mesg
, "locale: %s\n", locName
);
1459 while (i
<data_length
) {
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
);
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
);
1474 for ( uint32_t skeletonIndex
= 0;
1475 skeletonIndex
< UPRV_LENGTHOF(skeleton
);
1477 const UnicodeString
& oneSkeleton
= skeleton
[skeletonIndex
];
1478 DateIntervalFormat
* dtitvfmt
= DateIntervalFormat::createInstance(oneSkeleton
, loc
, ec
);
1479 if (!assertSuccess("createInstance(skeleton)", ec
)) return;
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);
1491 if (!assertSuccess("adoptDateFormat()", ec)) return;
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
);
1501 str
.extract(0, str
.length(), result
, "UTF-8");
1502 sprintf(mesg
, "interval date: %s\n", result
);
1508 // test user created DateIntervalInfo
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
);
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
);
1530 // for "th", the default calendar is Budhist,
1532 assertTrue("Default calendar for \"th\" is Budhist", ec
== U_ILLEGAL_ARGUMENT_ERROR
);
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
)) {
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");
1552 expected
.unescape(),
1553 fmt
->format(&interval
, appendTo
, fpos
, status
));
1554 if (!assertSuccess("Error formatting", status
)) {
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
)) {
1567 UnicodeString pattern
;
1568 static_cast<const SimpleDateFormat
*>(fmt
->getDateFormat())->toPattern(pattern
);
1569 assertEquals("Format pattern", "h:mm a", pattern
);
1572 // Ticket 11669 - thread safety of DateIntervalFormat::format(). This test failed before
1573 // the implementation was fixed.
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
;
1579 void DateIntervalFormatTest::threadFunc11669(int32_t 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
));
1590 if (result
!= *gExpectedResult
) {
1591 errln("%s:%d Expected \"%s\", got \"%s\"", __FILE__
, __LINE__
, CStr(*gExpectedResult
)(), CStr(result
)());
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
));
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
));
1619 gInterval
= &interval
;
1620 gIntervalFormatter
= formatter
.getAlias();
1621 gExpectedResult
= &expectedResult
;
1623 ThreadPool
<DateIntervalFormatTest
> threads(this, 4, &DateIntervalFormatTest::threadFunc11669
);
1627 gInterval
= NULL
; // Don't leave dangling pointers lying around. Not strictly necessary.
1628 gIntervalFormatter
= NULL
;
1629 gExpectedResult
= NULL
;
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()");
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__
);
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__
);
1656 if (U_FAILURE(status
)) {
1657 errln("%s:%d %s", __FILE__
, __LINE__
, u_errorName(status
));
1662 #endif /* #if !UCONFIG_NO_FORMATTING */