2 /********************************************************************
4 * Copyright (c) 1997-2013, International Business Machines Corporation and
5 * others. All Rights Reserved.
6 ********************************************************************/
8 #include "unicode/utypes.h"
10 #if !UCONFIG_NO_FORMATTING
13 //TODO: define it in compiler flag
14 //#define DTIFMTTS_DEBUG 1
24 #include "unicode/gregocal.h"
25 #include "unicode/dtintrv.h"
26 #include "unicode/dtitvinf.h"
27 #include "unicode/dtitvfmt.h"
28 #include "unicode/localpointer.h"
29 #include "unicode/timezone.h"
34 //#define PRINTMESG(msg) { std::cout << "(" << __FILE__ << ":" << __LINE__ << ") " << msg << "\n"; }
35 #define PRINTMESG(msg) { std::cout << msg; }
38 #define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
43 void DateIntervalFormatTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par*/ ) {
44 if (exec
) logln("TestSuite DateIntervalFormat");
47 TESTCASE(1, testFormat
);
48 TESTCASE(2, testFormatUserDII
);
49 TESTCASE(3, testSetIntervalPatternNoSideEffect
);
50 TESTCASE(4, testStress
);
51 default: name
= ""; break;
56 * Test various generic API methods of DateIntervalFormat for API coverage.
58 void DateIntervalFormatTest::testAPI() {
60 /* ====== Test create interval instance with default locale and skeleton
62 UErrorCode status
= U_ZERO_ERROR
;
63 logln("Testing DateIntervalFormat create instance with default locale and skeleton");
65 DateIntervalFormat
* dtitvfmt
= DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY
, status
);
66 if(U_FAILURE(status
)) {
67 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + default locale) - exitting");
74 /* ====== Test create interval instance with given locale and skeleton
76 status
= U_ZERO_ERROR
;
77 logln("Testing DateIntervalFormat create instance with given locale and skeleton");
79 dtitvfmt
= DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY
, Locale::getJapanese(), status
);
80 if(U_FAILURE(status
)) {
81 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + locale) - exitting");
88 /* ====== Test create interval instance with dateIntervalInfo and skeleton
90 status
= U_ZERO_ERROR
;
91 logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
93 DateIntervalInfo
* dtitvinf
= new DateIntervalInfo(Locale::getSimplifiedChinese(), status
);
95 dtitvfmt
= DateIntervalFormat::createInstance("EEEdMMMyhms", *dtitvinf
, status
);
98 if(U_FAILURE(status
)) {
99 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + default locale) - exitting");
106 /* ====== Test create interval instance with dateIntervalInfo and skeleton
108 status
= U_ZERO_ERROR
;
109 logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
111 dtitvinf
= new DateIntervalInfo(Locale::getSimplifiedChinese(), status
);
113 dtitvfmt
= DateIntervalFormat::createInstance("EEEdMMMyhms", Locale::getSimplifiedChinese(), *dtitvinf
, status
);
115 if(U_FAILURE(status
)) {
116 dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + locale) - exitting");
119 // not deleted, test clone
122 // ====== Test clone()
123 status
= U_ZERO_ERROR
;
124 logln("Testing DateIntervalFormat clone");
126 DateIntervalFormat
* another
= (DateIntervalFormat
*)dtitvfmt
->clone();
127 if ( (*another
) != (*dtitvfmt
) ) {
128 dataerrln("ERROR: clone failed");
132 // ====== Test getDateIntervalInfo, setDateIntervalInfo, adoptDateIntervalInfo
133 status
= U_ZERO_ERROR
;
134 logln("Testing DateIntervalFormat getDateIntervalInfo");
135 const DateIntervalInfo
* inf
= another
->getDateIntervalInfo();
136 dtitvfmt
->setDateIntervalInfo(*inf
, status
);
137 const DateIntervalInfo
* anotherInf
= dtitvfmt
->getDateIntervalInfo();
138 if ( (*inf
) != (*anotherInf
) || U_FAILURE(status
) ) {
139 dataerrln("ERROR: getDateIntervalInfo/setDateIntervalInfo failed");
143 // We make sure that setDateIntervalInfo does not corrupt the cache. See ticket 9919.
144 status
= U_ZERO_ERROR
;
145 logln("Testing DateIntervalFormat setDateIntervalInfo");
146 const Locale
&enLocale
= Locale::getEnglish();
147 LocalPointer
<DateIntervalFormat
> dif(DateIntervalFormat::createInstance("yMd", enLocale
, status
));
148 if (U_FAILURE(status
)) {
149 errln("Failure encountered: %s", u_errorName(status
));
152 UnicodeString expected
;
153 LocalPointer
<Calendar
> fromTime(Calendar::createInstance(enLocale
, status
));
154 LocalPointer
<Calendar
> toTime(Calendar::createInstance(enLocale
, status
));
155 if (U_FAILURE(status
)) {
156 errln("Failure encountered: %s", u_errorName(status
));
159 FieldPosition pos
= 0;
160 fromTime
->set(2013, 3, 26);
161 toTime
->set(2013, 3, 28);
162 dif
->format(*fromTime
, *toTime
, expected
, pos
, status
);
163 if (U_FAILURE(status
)) {
164 errln("Failure encountered: %s", u_errorName(status
));
167 LocalPointer
<DateIntervalInfo
> dii(new DateIntervalInfo(Locale::getEnglish(), status
));
168 if (U_FAILURE(status
)) {
169 errln("Failure encountered: %s", u_errorName(status
));
172 dii
->setIntervalPattern(ctou("yMd"), UCAL_DATE
, ctou("M/d/y \\u2013 d"), status
);
173 dif
->setDateIntervalInfo(*dii
, status
);
174 if (U_FAILURE(status
)) {
175 errln("Failure encountered: %s", u_errorName(status
));
178 dif
.adoptInstead(DateIntervalFormat::createInstance("yMd", enLocale
, status
));
179 if (U_FAILURE(status
)) {
180 errln("Failure encountered: %s", u_errorName(status
));
183 UnicodeString actual
;
185 dif
->format(*fromTime
, *toTime
, actual
, pos
, status
);
186 if (U_FAILURE(status
)) {
187 errln("Failure encountered: %s", u_errorName(status
));
190 if (expected
!= actual
) {
191 errln("DateIntervalFormat.setIntervalInfo should have no side effects.");
196 status = U_ZERO_ERROR;
197 DateIntervalInfo* nonConstInf = inf->clone();
198 dtitvfmt->adoptDateIntervalInfo(nonConstInf, status);
199 anotherInf = dtitvfmt->getDateIntervalInfo();
200 if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
201 dataerrln("ERROR: adoptDateIntervalInfo failed");
205 // ====== Test getDateFormat, setDateFormat, adoptDateFormat
207 status
= U_ZERO_ERROR
;
208 logln("Testing DateIntervalFormat getDateFormat");
210 const DateFormat* fmt = another->getDateFormat();
211 dtitvfmt->setDateFormat(*fmt, status);
212 const DateFormat* anotherFmt = dtitvfmt->getDateFormat();
213 if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
214 dataerrln("ERROR: getDateFormat/setDateFormat failed");
217 status = U_ZERO_ERROR;
218 DateFormat* nonConstFmt = (DateFormat*)fmt->clone();
219 dtitvfmt->adoptDateFormat(nonConstFmt, status);
220 anotherFmt = dtitvfmt->getDateFormat();
221 if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
222 dataerrln("ERROR: adoptDateFormat failed");
228 // ======= Test getStaticClassID()
230 logln("Testing getStaticClassID()");
233 if(dtitvfmt
->getDynamicClassID() != DateIntervalFormat::getStaticClassID()) {
234 errln("ERROR: getDynamicClassID() didn't return the expected value");
239 // ====== test constructor/copy constructor and assignment
240 /* they are protected, no test
241 logln("Testing DateIntervalFormat constructor and assigment operator");
242 status = U_ZERO_ERROR;
244 DateFormat* constFmt = (constFmt*)dtitvfmt->getDateFormat()->clone();
245 inf = dtitvfmt->getDateIntervalInfo()->clone();
248 DateIntervalFormat* dtifmt = new DateIntervalFormat(fmt, inf, status);
249 if(U_FAILURE(status)) {
250 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
254 DateIntervalFormat* dtifmt2 = new(dtifmt);
255 if ( (*dtifmt) != (*dtifmt2) ) {
256 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
260 DateIntervalFormat dtifmt3 = (*dtifmt);
261 if ( (*dtifmt) != dtifmt3 ) {
262 dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
272 //===== test format and parse ==================
273 Formattable formattable
;
274 formattable
.setInt64(10);
276 FieldPosition pos
= 0;
277 status
= U_ZERO_ERROR
;
278 dtitvfmt
->format(formattable
, res
, pos
, status
);
279 if ( status
!= U_ILLEGAL_ARGUMENT_ERROR
) {
280 dataerrln("ERROR: format non-date-interval object should set U_ILLEGAL_ARGUMENT_ERROR - exitting");
284 DateInterval
* dtitv
= new DateInterval(3600*24*365, 3600*24*366);
285 formattable
.adoptObject(dtitv
);
288 status
= U_ZERO_ERROR
;
289 dtitvfmt
->format(formattable
, res
, pos
, status
);
290 if ( U_FAILURE(status
) ) {
291 dataerrln("ERROR: format date interval failed - exitting");
295 const DateFormat
* dfmt
= dtitvfmt
->getDateFormat();
296 Calendar
* fromCal
= dfmt
->getCalendar()->clone();
297 Calendar
* toCal
= dfmt
->getCalendar()->clone();
300 status
= U_ZERO_ERROR
;
301 dtitvfmt
->format(*fromCal
, *toCal
, res
, pos
, status
);
302 if ( U_FAILURE(status
) ) {
303 dataerrln("ERROR: format date interval failed - exitting");
310 Formattable fmttable
;
311 status
= U_ZERO_ERROR
;
312 // TODO: why do I need cast?
313 ((Format
*)dtitvfmt
)->parseObject(res
, fmttable
, status
);
314 if ( status
!= U_INVALID_FORMAT_ERROR
) {
315 dataerrln("ERROR: parse should set U_INVALID_FORMAT_ERROR - exitting");
321 //====== test setting time zone
322 logln("Testing DateIntervalFormat set & format with different time zones, get time zone");
323 status
= U_ZERO_ERROR
;
324 dtitvfmt
= DateIntervalFormat::createInstance("MMMdHHmm", Locale::getEnglish(), status
);
325 if ( U_SUCCESS(status
) ) {
326 UDate date1
= 1299090600000.0; // 2011-Mar-02 1030 in US/Pacific, 2011-Mar-03 0330 in Asia/Tokyo
327 UDate date2
= 1299115800000.0; // 2011-Mar-02 1730 in US/Pacific, 2011-Mar-03 1030 in Asia/Tokyo
329 DateInterval
* dtitv12
= new DateInterval(date1
, date2
);
330 TimeZone
* tzCalif
= TimeZone::createTimeZone("US/Pacific");
331 TimeZone
* tzTokyo
= TimeZone::createTimeZone("Asia/Tokyo");
332 UnicodeString fmtCalif
= UnicodeString(ctou("Mar 2, 10:30 - 17:30"));
333 UnicodeString fmtTokyo
= UnicodeString(ctou("Mar 3, 03:30 - 10:30"));
335 dtitvfmt
->adoptTimeZone(tzCalif
);
338 status
= U_ZERO_ERROR
;
339 dtitvfmt
->format(dtitv12
, res
, pos
, status
);
340 if ( U_SUCCESS(status
) ) {
341 if ( res
.compare(fmtCalif
) != 0 ) {
342 errln("ERROR: DateIntervalFormat::format for tzCalif, expect " + fmtCalif
+ ", get " + res
);
345 errln("ERROR: DateIntervalFormat::format for tzCalif, status %s", u_errorName(status
));
348 dtitvfmt
->setTimeZone(*tzTokyo
);
351 status
= U_ZERO_ERROR
;
352 dtitvfmt
->format(dtitv12
, res
, pos
, status
);
353 if ( U_SUCCESS(status
) ) {
354 if ( res
.compare(fmtTokyo
) != 0 ) {
355 errln("ERROR: DateIntervalFormat::format for fmtTokyo, expect " + fmtTokyo
+ ", get " + res
);
358 errln("ERROR: DateIntervalFormat::format for tzTokyo, status %s", u_errorName(status
));
361 if ( dtitvfmt
->getTimeZone() != *tzTokyo
) {
362 errln("ERROR: DateIntervalFormat::getTimeZone returns mismatch.");
365 delete tzTokyo
; // tzCalif was owned by dtitvfmt which should have deleted it
369 errln("ERROR: DateIntervalFormat::createInstance(\"MdHH\", Locale::getEnglish(), ...), status %s", u_errorName(status
));
371 //====== test format in testFormat()
373 //====== test DateInterval class (better coverage)
374 DateInterval
dtitv1(3600*24*365, 3600*24*366);
375 DateInterval
dtitv2(dtitv1
);
377 if (!(dtitv1
== dtitv2
)) {
378 errln("ERROR: Copy constructor failed for DateInterval.");
381 DateInterval
dtitv3(3600*365, 3600*366);
383 if (!(dtitv3
== dtitv1
)) {
384 errln("ERROR: Equal operator failed for DateInterval.");
387 DateInterval
*dtitv4
= dtitv1
.clone();
388 if (*dtitv4
!= dtitv1
) {
389 errln("ERROR: Equal operator failed for DateInterval.");
398 void DateIntervalFormatTest::testFormat() {
399 // first item is date pattern
400 // followed by a group of locale/from_data/to_data/skeleton/interval_data
401 const char* DATA
[] = {
402 "yyyy MM dd HH:mm:ss",
404 "root", "2007 11 10 10:10:10", "2007 12 10 10:10:10", "yM", "2007-11 \\u2013 2007-12",
406 // test 'H' and 'h', using availableFormat in fallback
407 "en", "2007 11 10 10:10:10", "2007 11 10 15:10:10", "Hms", "10:10:10 - 15:10:10",
408 "en", "2007 11 10 10:10:10", "2007 11 10 15:10:10", "hms", "10:10:10 AM - 3:10:10 PM",
410 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMM", "October 2007 - October 2008",
411 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMM", "Oct 2007 - Oct 2008",
412 // test skeleton with both date and time
413 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMyhm", "Nov 10, 2007, 10:10 AM - Nov 20, 2007, 10:10 AM",
415 "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "dMMMyhm", "Nov 10, 2007, 10:10 - 11:10 AM",
417 "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "hms", "10:10:10 AM - 11:10:10 AM",
418 "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "Hms", "10:10:10 - 11:10:10",
419 "en", "2007 11 10 20:10:10", "2007 11 10 21:10:10", "Hms", "20:10:10 - 21:10:10",
421 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10, 2007 - Friday, October 10, 2008",
423 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMMy", "October 10, 2007 - October 10, 2008",
425 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMM", "October 10, 2007 - October 10, 2008",
427 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMMy", "October 2007 - October 2008",
429 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10, 2007 - Friday, October 10, 2008",
431 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMMMy", "Wed, Oct 10, 2007 - Fri, Oct 10, 2008",
433 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMy", "Oct 10, 2007 - Oct 10, 2008",
435 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMM", "Oct 10, 2007 - Oct 10, 2008",
437 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMy", "Oct 2007 - Oct 2008",
439 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMMM", "Wed, Oct 10, 2007 - Fri, Oct 10, 2008",
441 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMy", "Wed, 10/10/2007 - Fri, 10/10/2008",
443 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMy", "10/10/2007 - 10/10/2008",
445 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dM", "10/10/2007 - 10/10/2008",
447 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "My", "10/2007 - 10/2008",
449 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdM", "Wed, 10/10/2007 - Fri, 10/10/2008",
451 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "d", "10/10/2007 - 10/10/2008",
453 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Ed", "10 Wed - 10 Fri",
455 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "y", "2007 - 2008",
457 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "M", "10/2007 - 10/2008",
461 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hm", "10/10/2007, 10:10 AM - 10/10/2008, 10:10 AM",
462 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Hm", "10/10/2007, 10:10 - 10/10/2008, 10:10",
463 "en", "2007 10 10 20:10:10", "2008 10 10 20:10:10", "Hm", "10/10/2007, 20:10 - 10/10/2008, 20:10",
465 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hmv", "10/10/2007, 10:10 AM PT - 10/10/2008, 10:10 AM PT",
467 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hmz", "10/10/2007, 10:10 AM PDT - 10/10/2008, 10:10 AM PDT",
469 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "h", "10/10/2007, 10 AM - 10/10/2008, 10 AM",
471 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hv", "10/10/2007, 10 AM PT - 10/10/2008, 10 AM PT",
473 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hz", "10/10/2007, 10 AM PDT - 10/10/2008, 10 AM PDT",
475 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/2007 - Fri, 10/10/2008",
477 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EddMMy", "Wed, 10/10/2007 - Fri, 10/10/2008",
479 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hhmm", "10/10/2007, 10:10 AM - 10/10/2008, 10:10 AM",
481 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hhmmzz", "10/10/2007, 10:10 AM PDT - 10/10/2008, 10:10 AM PDT",
483 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hms", "10/10/2007, 10:10:10 AM - 10/10/2008, 10:10:10 AM",
485 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMMMy", "O 10, 2007 - O 10, 2008",
487 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEEdM", "W, 10/10/2007 - F, 10/10/2008",
489 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10 - Saturday, November 10, 2007",
491 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMy", "October 10 - November 10, 2007",
493 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMM", "October 10 - November 10",
495 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMMy", "October - November 2007",
497 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10 - Saturday, November 10",
499 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMMMy", "Wed, Oct 10 - Sat, Nov 10, 2007",
501 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMy", "Oct 10 - Nov 10, 2007",
503 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMM", "Oct 10 - Nov 10",
505 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMy", "Oct - Nov 2007",
507 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMMM", "Wed, Oct 10 - Sat, Nov 10",
509 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMy", "Wed, 10/10/2007 - Sat, 11/10/2007",
511 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMy", "10/10/2007 - 11/10/2007",
514 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "My", "10/2007 - 11/2007",
516 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdM", "Wed, 10/10 - Sat, 11/10",
518 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "d", "10/10 - 11/10",
520 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "Ed", "10 Wed - 10 Sat",
522 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "y", "2007",
524 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "M", "10 - 11",
526 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Oct - Nov",
528 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMM", "October - November",
530 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hm", "10/10/2007, 10:10 AM - 11/10/2007, 10:10 AM",
531 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "Hm", "10/10/2007, 10:10 - 11/10/2007, 10:10",
532 "en", "2007 10 10 20:10:10", "2007 11 10 20:10:10", "Hm", "10/10/2007, 20:10 - 11/10/2007, 20:10",
534 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "10/10/2007, 10:10 AM PT - 11/10/2007, 10:10 AM PT",
536 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmz", "10/10/2007, 10:10 AM PDT - 11/10/2007, 10:10 AM PST",
538 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "h", "10/10/2007, 10 AM - 11/10/2007, 10 AM",
540 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hv", "10/10/2007, 10 AM PT - 11/10/2007, 10 AM PT",
542 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hz", "10/10/2007, 10 AM PDT - 11/10/2007, 10 AM PST",
544 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/2007 - Sat, 11/10/2007",
546 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EddMMy", "Wed, 10/10/2007 - Sat, 11/10/2007",
549 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hhmmzz", "10/10/2007, 10:10 AM PDT - 11/10/2007, 10:10 AM PST",
551 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10/10/2007, 10:10:10 AM - 11/10/2007, 10:10:10 AM",
553 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMMy", "O 10 - N 10, 2007",
555 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEEdM", "W, 10/10 - S, 11/10",
557 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "Saturday, November 10 - Tuesday, November 20, 2007",
559 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMMy", "November 10 - 20, 2007",
561 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMM", "November 10 - 20",
564 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMM", "Saturday, November 10 - Tuesday, November 20",
566 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMMMy", "Sat, Nov 10 - Tue, Nov 20, 2007",
568 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMy", "Nov 10 - 20, 2007",
570 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMM", "Nov 10 - 20",
572 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMy", "Nov 2007",
574 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMMM", "Sat, Nov 10 - Tue, Nov 20",
576 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "Sat, 11/10/2007 - Tue, 11/20/2007",
578 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMy", "11/10/2007 - 11/20/2007",
580 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "11/10 - 11/20",
582 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "11/2007",
584 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdM", "Sat, 11/10 - Tue, 11/20",
586 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "d", "10 - 20",
588 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Ed", "10 Sat - 20 Tue",
590 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007",
592 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11",
594 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "Nov",
596 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMM", "November",
598 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hm", "11/10/2007, 10:10 AM - 11/20/2007, 10:10 AM",
599 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Hm", "11/10/2007, 10:10 - 11/20/2007, 10:10",
600 "en", "2007 11 10 20:10:10", "2007 11 20 20:10:10", "Hm", "11/10/2007, 20:10 - 11/20/2007, 20:10",
602 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "11/10/2007, 10:10 AM PT - 11/20/2007, 10:10 AM PT",
604 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "11/10/2007, 10:10 AM PST - 11/20/2007, 10:10 AM PST",
606 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "11/10/2007, 10 AM - 11/20/2007, 10 AM",
608 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hv", "11/10/2007, 10 AM PT - 11/20/2007, 10 AM PT",
610 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hz", "11/10/2007, 10 AM PST - 11/20/2007, 10 AM PST",
612 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEddMMyyyy", "Sat, 11/10/2007 - Tue, 11/20/2007",
614 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EddMMy", "Sat, 11/10/2007 - Tue, 11/20/2007",
616 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hhmm", "11/10/2007, 10:10 AM - 11/20/2007, 10:10 AM",
618 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hhmmzz", "11/10/2007, 10:10 AM PST - 11/20/2007, 10:10 AM PST",
620 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hms", "11/10/2007, 10:10:10 AM - 11/20/2007, 10:10:10 AM",
621 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Hms", "11/10/2007, 10:10:10 - 11/20/2007, 10:10:10",
622 "en", "2007 11 10 20:10:10", "2007 11 20 20:10:10", "Hms", "11/10/2007, 20:10:10 - 11/20/2007, 20:10:10",
624 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMMMy", "N 10 - 20, 2007",
626 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEEdM", "S, 11/10 - T, 11/20",
628 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMMy", "Wednesday, January 10, 2007",
630 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMMy", "January 10, 2007",
632 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMM", "January 10",
634 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMMy", "January 2007",
636 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMM", "Wednesday, January 10",
638 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdMMMy", "Wed, Jan 10, 2007",
640 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMy", "Jan 10, 2007",
642 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMM", "Jan 10",
644 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMy", "Jan 2007",
646 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdMMM", "Wed, Jan 10",
649 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMy", "1/10/2007",
651 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dM", "1/10",
653 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "My", "1/2007",
655 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdM", "Wed, 1/10",
657 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "d", "10",
659 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Ed", "10 Wed",
661 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "y", "2007",
663 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "M", "1",
665 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMM", "Jan",
667 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMM", "January",
669 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "10:00 AM - 2:10 PM",
670 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Hm", "10:00 - 14:10",
672 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmv", "10:00 AM - 2:10 PM PT",
674 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "10:00 AM - 2:10 PM PST",
676 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10 AM - 2 PM",
677 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "H", "10 - 14",
680 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hz", "10 AM - 2 PM PST",
682 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEddMMyyyy", "Wed, 01/10/2007",
684 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EddMMy", "Wed, 01/10/2007",
686 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hhmm", "10:00 AM - 2:10 PM",
687 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "HHmm", "10:00 - 14:10",
689 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hhmmzz", "10:00 AM - 2:10 PM PST",
691 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hms", "10:00:10 AM - 2:10:10 PM",
692 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Hms", "10:00:10 - 14:10:10",
694 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMMMy", "J 10, 2007",
696 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEEdM", "W, 1/10",
697 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMMy", "January 10, 2007",
699 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMM", "January 10",
701 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "MMMMy", "January 2007",
703 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EEEEdMMMM", "Wednesday, January 10",
705 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMMMy", "Wed, Jan 10, 2007",
707 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMy", "Jan 10, 2007",
709 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMM", "Jan 10",
712 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMMM", "Wed, Jan 10",
714 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMy", "Wed, 1/10/2007",
716 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMy", "1/10/2007",
719 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "My", "1/2007",
721 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdM", "Wed, 1/10",
723 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "d", "10",
726 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "y", "2007",
728 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "M", "1",
732 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "10:00 - 10:20 AM",
733 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "Hm", "10:00 - 10:20",
736 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00 - 10:20 AM PST",
739 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hv", "10 AM PT",
743 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EddMMy", "Wed, 01/10/2007",
745 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hhmm", "10:00 - 10:20 AM",
746 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "HHmm", "10:00 - 10:20",
748 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hhmmzz", "10:00 - 10:20 AM PST",
751 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMMMy", "J 10, 2007",
754 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMMy", "Wednesday, January 10, 2007",
756 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMMy", "January 10, 2007",
759 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "MMMMy", "January 2007",
761 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMM", "Wednesday, January 10",
764 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMy", "Jan 10, 2007",
766 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMM", "Jan 10",
769 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdMMM", "Wed, Jan 10",
771 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdMy", "Wed, 1/10/2007",
773 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMy", "1/10/2007",
776 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "My", "1/2007",
778 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdM", "Wed, 1/10",
780 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "d", "10",
783 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "y", "2007",
785 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "M", "1",
788 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "MMMM", "January",
790 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hm", "10:10 AM",
791 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "Hm", "10:10",
794 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 AM PST",
796 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "10 AM",
798 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "10 AM PT",
801 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEddMMyyyy", "Wed, 01/10/2007",
804 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hhmm", "10:10 AM",
805 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "HHmm", "10:10",
807 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hhmmzz", "10:10 AM PST",
810 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMMMy", "J 10, 2007",
812 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEEdM", "W, 1/10",
814 "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e09\\u81f32008\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e94",
817 "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u81f311\\u670810\\u65e5",
820 "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMMy", "2007\\u5e7410\\u6708\\u81f311\\u6708",
823 "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "2007/10/10 \\u4E0A\\u534810:10 \\u6D1B\\u6749\\u77F6\\u65F6\\u95F4 \\u2013 2007/11/10 \\u4E0A\\u534810:10 \\u6D1B\\u6749\\u77F6\\u65F6\\u95F4",
825 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "2007\\u5e7411\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
828 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMM", "11\\u670810\\u65e5\\u81f320\\u65e5",
830 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMMy", "2007\\u5E7411\\u6708", // (fixed expected result per ticket:6626:)
832 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMM", "11\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
835 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "2007/11/10\\u5468\\u516d\\u81f32007/11/20\\u5468\\u4e8c",
838 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "11/10 \\u2013 11/20",
840 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "2007/11",
842 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdM", "11/10\\u5468\\u516d\\u81f311/20\\u5468\\u4e8c",
845 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007\\u5E74", // (fixed expected result per ticket:6626:)
847 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11\\u6708",
849 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "11\\u6708", // (fixed expected result per ticket:6626: and others)
852 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "2007/11/10 \\u4e0a\\u534810:10 GMT-8 \\u2013 2007/11/20 \\u4e0a\\u534810:10 GMT-8",
854 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "2007/11/10 \\u4e0a\\u534810\\u65f6 \\u2013 2007/11/20 \\u4e0a\\u534810\\u65f6",
856 "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMMy", "2007\\u5e741\\u670810\\u65e5 \\u661f\\u671f\\u4e09",
858 "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
861 "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "GMT-8\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
863 "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "\\u4e0a\\u534810\\u65F6\\u81f3\\u4e0b\\u53482\\u65f6",
865 "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hv", "\\u6D1B\\u6749\\u77F6\\u65F6\\u95F4\\u4E0A\\u534810\\u65F6\\u81F3\\u4E0B\\u53482\\u65F6",
867 "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "\\u4e0a\\u534810:00\\u81f310:20",
869 "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "\\u6D1B\\u6749\\u77F6\\u65F6\\u95F4\\u4E0A\\u534810:00\\u81F310:20",
871 "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "\\u4e0a\\u534810\\u65f6 GMT-8",
873 "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hm", "\\u4e0a\\u534810:10",
875 "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "\\u4e0a\\u534810\\u65f6",
877 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt. 2007 - Freitag, 10. Okt. 2008",
880 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMM", "10. Okt. 2007 - 10. Okt. 2008",
882 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMy", "Okt. 2007 - Okt. 2008",
885 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMy", "Mi., 10.10.2007 - Fr., 10.10.2008",
887 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMy", "10.10.2007 - 10.10.2008",
890 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "My", "10.2007 - 10.2008",
892 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdM", "Mi., 10.10.2007 - Fr., 10.10.2008",
895 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "y", "2007-2008",
897 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "M", "10.2007 - 10.2008",
900 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hm", "10.10.2007 10:10 vorm. - 10.10.2008 10:10 vorm.",
901 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Hm", "10.10.2007 10:10 - 10.10.2008 10:10",
903 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt. - Samstag, 10. Nov. 2007",
906 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMM", "10. Okt. - 10. Nov.",
908 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMy", "Okt.-Nov. 2007",
910 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMM", "Mittwoch, 10. Okt. - Samstag, 10. Nov.",
913 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dM", "10.10. - 10.11.",
915 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "My", "10.2007 - 11.2007",
918 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "d", "10.10. - 10.11.",
920 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "y", "2007",
923 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Okt.-Nov.",
926 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10.10.2007 10:10:10 vorm. - 10.11.2007 10:10:10 vorm.",
927 "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "Hms", "10.10.2007 10:10:10 - 10.11.2007 10:10:10",
929 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMy", "Samstag, 10. - Dienstag, 20. Nov. 2007",
931 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMy", "10.-20. Nov. 2007",
934 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMy", "Nov. 2007",
936 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMM", "Samstag, 10. - Dienstag, 20. Nov.",
938 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "Sa., 10.11.2007 - Di., 20.11.2007",
941 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "10.11. - 20.11.",
943 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "11.2007",
946 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "d", "10.-20.",
948 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007",
951 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "10.11.2007 10:10 vorm. Los Angeles Zeit - 20.11.2007 10:10 vorm. Los Angeles Zeit",
953 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMy", "Mittwoch, 10. Jan. 2007",
956 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMM", "10. Jan.",
958 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMy", "Jan. 2007",
960 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMM", "Mittwoch, 10. Jan.",
963 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10 vorm. - 2 nachm.",
964 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "H", "10-14 Uhr",
966 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EEEEdMMM", "Mittwoch, 10. Jan.",
969 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "10:00-10:20 vorm. Los Angeles Zeit",
971 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00-10:20 vorm. GMT-8",
973 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "h", "10 vorm.",
974 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "H", "10 Uhr",
977 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "10 vorm. GMT-8",
979 "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMy", "Mittwoch, 10. Jan. 2007",
982 "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmv", "10:10 vorm. Los Angeles Zeit",
984 "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 vorm. GMT-8",
987 "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "10 vorm. Los Angeles Zeit",
989 "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hz", "10 vorm. GMT-8",
991 // Thai (default calendar buddhist)
993 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E1E\\u0E38\\u0E18 10 \\u0E15.\\u0E04. 2550 - \\u0E27\\u0E31\\u0E19\\u0E28\\u0E38\\u0E01\\u0E23\\u0E4C 10 \\u0E15.\\u0E04. 2551",
996 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. 2550 - 10 \\u0E15.\\u0E04. 2551",
998 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "MMMy", "\\u0E15.\\u0E04. 2550 - \\u0E15.\\u0E04. 2551",
1001 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EdMy", "\\u0E1E. 10/10/2550 - \\u0E28. 10/10/2551",
1003 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "dMy", "10/10/2550 - 10/10/2551",
1006 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "My", "10/2550 - 10/2551",
1008 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EdM", "\\u0E1E. 10/10/2550 - \\u0E28. 10/10/2551",
1011 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "y", "2550-2551",
1013 "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "M", "10/2550 - 10/2551",
1016 "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E1E\\u0E38\\u0E18 10 \\u0E15.\\u0E04. - \\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C 10 \\u0E1E.\\u0E22. 2550",
1019 "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. - 10 \\u0E1E.\\u0E22.",
1021 "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "MMMy", "\\u0E15.\\u0E04.-\\u0E1E.\\u0E22. 2550",
1023 "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "dM", "10/10 - 10/11",
1025 "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "My", "10/2550 - 11/2550",
1028 "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "d", "10/10 - 10/11",
1030 "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "y", "\\u0E1E.\\u0E28. 2550",
1033 "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "MMM", "\\u0E15.\\u0E04.-\\u0E1E.\\u0E22.",
1036 expect(DATA
, ARRAY_SIZE(DATA
));
1040 void DateIntervalFormatTest::expect(const char** data
, int32_t data_length
) {
1042 UErrorCode ec
= U_ZERO_ERROR
;
1043 UnicodeString str
, str2
;
1044 const char* pattern
= data
[0];
1047 #ifdef DTIFMTTS_DEBUG
1050 sprintf(mesg
, "locale: %s\n", locName
);
1054 while (i
<data_length
) {
1055 const char* locName
= data
[i
++];
1056 Locale
loc(locName
);
1057 SimpleDateFormat
ref(pattern
, loc
, ec
);
1058 if (U_FAILURE(ec
)) {
1059 dataerrln("contruct SimpleDateFormat in expect failed: %s", u_errorName(ec
));
1063 const char* datestr
= data
[i
++];
1064 const char* datestr_2
= data
[i
++];
1065 #ifdef DTIFMTTS_DEBUG
1066 sprintf(mesg
, "original date: %s - %s\n", datestr
, datestr_2
);
1069 UDate date
= ref
.parse(ctou(datestr
), ec
);
1070 if (!assertSuccess("parse 1st data in expect", ec
)) return;
1071 UDate date_2
= ref
.parse(ctou(datestr_2
), ec
);
1072 if (!assertSuccess("parse 2nd data in expect", ec
)) return;
1073 DateInterval
dtitv(date
, date_2
);
1075 const UnicodeString
& oneSkeleton
= data
[i
++];
1077 DateIntervalFormat
* dtitvfmt
= DateIntervalFormat::createInstance(oneSkeleton
, loc
, ec
);
1078 if (!assertSuccess("createInstance(skeleton) in expect", ec
)) return;
1079 FieldPosition pos
=0;
1080 dtitvfmt
->format(&dtitv
, str
.remove(), pos
, ec
);
1081 if (!assertSuccess("format in expect", ec
)) return;
1082 assertEquals((UnicodeString
)"\"" + locName
+ "\\" + oneSkeleton
+ "\\" + datestr
+ "\\" + datestr_2
+ "\"", ctou(data
[i
++]), str
);
1086 #ifdef DTIFMTTS_DEBUG
1087 str
.extract(0, str
.length(), result
, "UTF-8");
1088 sprintf(mesg
, "interval date: %s\n", result
);
1091 std::cout
<< "\"" << locName
<< "\", "
1092 << "\"" << datestr
<< "\", "
1093 << "\"" << datestr_2
<< "\", ";
1094 printUnicodeString(oneSkeleton
);
1095 printUnicodeString(str
);
1096 std::cout
<< "\n\n";
1104 * Test format using user defined DateIntervalInfo
1106 void DateIntervalFormatTest::testFormatUserDII() {
1107 // first item is date pattern
1108 const char* DATA
[] = {
1109 "yyyy MM dd HH:mm:ss",
1110 "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Oct 10, 2007 --- Oct 10, 2008",
1112 "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 Oct 10 - Nov 2007",
1114 "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Nov 10, 2007 --- Nov 20, 2007",
1116 "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Jan 10, 2007",
1118 "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "Jan 10, 2007",
1120 "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "Jan 10, 2007",
1122 "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "2007\\u5e7410\\u670810\\u65e5 --- 2008\\u5e7410\\u670810\\u65e5",
1124 "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 10\\u6708 10 - 11\\u6708 2007",
1126 "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "2007\\u5e7411\\u670810\\u65e5 --- 2007\\u5e7411\\u670820\\u65e5",
1128 "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1130 "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1132 "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
1134 "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10. Okt. 2007 --- 10. Okt. 2008",
1137 "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10. Nov. 2007 --- 20. Nov. 2007",
1139 "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10. Jan. 2007",
1141 "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10. Jan. 2007",
1144 "es", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10 oct 2007 --- 10 oct 2008",
1146 "es", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 oct 10 - nov 2007",
1148 "es", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10 nov 2007 --- 20 nov 2007",
1150 "es", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10 ene 2007",
1152 "es", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10 ene 2007",
1154 "es", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "10 ene 2007",
1156 expectUserDII(DATA
, ARRAY_SIZE(DATA
));
1160 void DateIntervalFormatTest::testSetIntervalPatternNoSideEffect() {
1161 UErrorCode ec
= U_ZERO_ERROR
;
1162 LocalPointer
<DateIntervalInfo
> dtitvinf(new DateIntervalInfo(ec
));
1163 if (U_FAILURE(ec
)) {
1164 errln("Failure encountered: %s", u_errorName(ec
));
1167 UnicodeString expected
;
1168 dtitvinf
->getIntervalPattern(ctou("yMd"), UCAL_DATE
, expected
, ec
);
1169 dtitvinf
->setIntervalPattern(ctou("yMd"), UCAL_DATE
, ctou("M/d/y \\u2013 d"), ec
);
1170 if (U_FAILURE(ec
)) {
1171 errln("Failure encountered: %s", u_errorName(ec
));
1174 dtitvinf
.adoptInstead(new DateIntervalInfo(ec
));
1175 if (U_FAILURE(ec
)) {
1176 errln("Failure encountered: %s", u_errorName(ec
));
1179 UnicodeString actual
;
1180 dtitvinf
->getIntervalPattern(ctou("yMd"), UCAL_DATE
, actual
, ec
);
1181 if (U_FAILURE(ec
)) {
1182 errln("Failure encountered: %s", u_errorName(ec
));
1185 if (expected
!= actual
) {
1186 errln("DateIntervalInfo.setIntervalPattern should have no side effects.");
1191 void DateIntervalFormatTest::expectUserDII(const char** data
,
1192 int32_t data_length
) {
1195 UErrorCode ec
= U_ZERO_ERROR
;
1196 const char* pattern
= data
[0];
1199 while ( i
< data_length
) {
1200 const char* locName
= data
[i
++];
1201 Locale
loc(locName
);
1202 SimpleDateFormat
ref(pattern
, loc
, ec
);
1203 if (U_FAILURE(ec
)) {
1204 dataerrln("contruct SimpleDateFormat in expectUserDII failed: %s", u_errorName(ec
));
1207 const char* datestr
= data
[i
++];
1208 const char* datestr_2
= data
[i
++];
1209 UDate date
= ref
.parse(ctou(datestr
), ec
);
1210 if (!assertSuccess("parse in expectUserDII", ec
)) return;
1211 UDate date_2
= ref
.parse(ctou(datestr_2
), ec
);
1212 if (!assertSuccess("parse in expectUserDII", ec
)) return;
1213 DateInterval
dtitv(date
, date_2
);
1216 // test user created DateIntervalInfo
1217 DateIntervalInfo
* dtitvinf
= new DateIntervalInfo(ec
);
1218 dtitvinf
->setFallbackIntervalPattern("{0} --- {1}", ec
);
1219 dtitvinf
->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY
, UCAL_MONTH
, "yyyy MMM d - MMM y",ec
);
1220 if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec
)) return;
1221 dtitvinf
->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY
, UCAL_HOUR_OF_DAY
, "yyyy MMM d HH:mm - HH:mm", ec
);
1222 if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec
)) return;
1223 DateIntervalFormat
* dtitvfmt
= DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY
, loc
, *dtitvinf
, ec
);
1225 if (!assertSuccess("createInstance(skeleton,dtitvinf) in expectUserDII", ec
)) return;
1226 FieldPosition pos
=0;
1227 dtitvfmt
->format(&dtitv
, str
.remove(), pos
, ec
);
1228 if (!assertSuccess("format in expectUserDII", ec
)) return;
1229 assertEquals((UnicodeString
)"\"" + locName
+ "\\" + datestr
+ "\\" + datestr_2
+ "\"", ctou(data
[i
++]), str
);
1230 #ifdef DTIFMTTS_DEBUG
1233 PRINTMESG("interval format using user defined DateIntervalInfo\n");
1234 str
.extract(0, str
.length(), result
, "UTF-8");
1235 sprintf(mesg
, "interval date: %s\n", result
);
1243 void DateIntervalFormatTest::testStress() {
1245 logln("Quick mode: Skipping test");
1248 const char* DATA
[] = {
1249 "yyyy MM dd HH:mm:ss",
1250 "2007 10 10 10:10:10", "2008 10 10 10:10:10",
1251 "2007 10 10 10:10:10", "2007 11 10 10:10:10",
1252 "2007 11 10 10:10:10", "2007 11 20 10:10:10",
1253 "2007 01 10 10:00:10", "2007 01 10 14:10:10",
1254 "2007 01 10 10:00:10", "2007 01 10 10:20:10",
1255 "2007 01 10 10:10:10", "2007 01 10 10:10:20",
1258 const char* testLocale
[][3] = {
1300 uint32_t localeIndex
;
1301 for ( localeIndex
= 0; localeIndex
< ARRAY_SIZE(testLocale
); ++localeIndex
) {
1303 uprv_strcpy(locName
, testLocale
[localeIndex
][0]);
1304 uprv_strcat(locName
, testLocale
[localeIndex
][1]);
1305 stress(DATA
, ARRAY_SIZE(DATA
), Locale(testLocale
[localeIndex
][0], testLocale
[localeIndex
][1], testLocale
[localeIndex
][2]), locName
);
1310 void DateIntervalFormatTest::stress(const char** data
, int32_t data_length
,
1311 const Locale
& loc
, const char* locName
) {
1312 UnicodeString skeleton
[] = {
1340 "EEddMMyyyy", // following could be normalized
1344 "hms", // following could not be normalized
1350 UErrorCode ec
= U_ZERO_ERROR
;
1351 UnicodeString str
, str2
;
1352 SimpleDateFormat
ref(data
[i
++], loc
, ec
);
1353 if (!assertSuccess("construct SimpleDateFormat", ec
)) return;
1355 #ifdef DTIFMTTS_DEBUG
1358 sprintf(mesg
, "locale: %s\n", locName
);
1362 while (i
<data_length
) {
1365 const char* datestr
= data
[i
++];
1366 const char* datestr_2
= data
[i
++];
1367 #ifdef DTIFMTTS_DEBUG
1368 sprintf(mesg
, "original date: %s - %s\n", datestr
, datestr_2
);
1371 UDate date
= ref
.parse(ctou(datestr
), ec
);
1372 if (!assertSuccess("parse", ec
)) return;
1373 UDate date_2
= ref
.parse(ctou(datestr_2
), ec
);
1374 if (!assertSuccess("parse", ec
)) return;
1375 DateInterval
dtitv(date
, date_2
);
1377 for ( uint32_t skeletonIndex
= 0;
1378 skeletonIndex
< ARRAY_SIZE(skeleton
);
1380 const UnicodeString
& oneSkeleton
= skeleton
[skeletonIndex
];
1381 DateIntervalFormat
* dtitvfmt
= DateIntervalFormat::createInstance(oneSkeleton
, loc
, ec
);
1382 if (!assertSuccess("createInstance(skeleton)", ec
)) return;
1384 // reset the calendar to be Gregorian calendar for "th"
1385 if ( uprv_strcmp(locName, "th") == 0 ) {
1386 GregorianCalendar* gregCal = new GregorianCalendar(loc, ec);
1387 if (!assertSuccess("GregorianCalendar()", ec)) return;
1388 const DateFormat* dformat = dtitvfmt->getDateFormat();
1389 DateFormat* newOne = (DateFormat*)dformat->clone();
1390 newOne->adoptCalendar(gregCal);
1391 //dtitvfmt->adoptDateFormat(newOne, ec);
1392 dtitvfmt->setDateFormat(*newOne, ec);
1394 if (!assertSuccess("adoptDateFormat()", ec)) return;
1397 FieldPosition pos
=0;
1398 dtitvfmt
->format(&dtitv
, str
.remove(), pos
, ec
);
1399 if (!assertSuccess("format", ec
)) return;
1400 #ifdef DTIFMTTS_DEBUG
1401 oneSkeleton
.extract(0, oneSkeleton
.length(), result
, "UTF-8");
1402 sprintf(mesg
, "interval by skeleton: %s\n", result
);
1404 str
.extract(0, str
.length(), result
, "UTF-8");
1405 sprintf(mesg
, "interval date: %s\n", result
);
1411 // test user created DateIntervalInfo
1413 DateIntervalInfo
* dtitvinf
= new DateIntervalInfo(ec
);
1414 dtitvinf
->setFallbackIntervalPattern("{0} --- {1}", ec
);
1415 dtitvinf
->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY
, UCAL_MONTH
, "yyyy MMM d - MMM y",ec
);
1416 if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec
)) return;
1417 dtitvinf
->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY
, UCAL_HOUR_OF_DAY
, "yyyy MMM d HH:mm - HH:mm", ec
);
1418 if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec
)) return;
1419 DateIntervalFormat
* dtitvfmt
= DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY
, loc
, *dtitvinf
, ec
);
1421 if (!assertSuccess("createInstance(skeleton,dtitvinf)", ec
)) return;
1422 FieldPosition pos
=0;
1423 dtitvfmt
->format(&dtitv
, str
.remove(), pos
, ec
);
1424 if ( uprv_strcmp(locName
, "th") ) {
1425 if (!assertSuccess("format", ec
)) return;
1426 #ifdef DTIFMTTS_DEBUG
1427 PRINTMESG("interval format using user defined DateIntervalInfo\n");
1428 str
.extract(0, str
.length(), result
, "UTF-8");
1429 sprintf(mesg
, "interval date: %s\n", result
);
1433 // for "th", the default calendar is Budhist,
1435 assertTrue("Default calendar for \"th\" is Budhist", ec
== U_ILLEGAL_ARGUMENT_ERROR
);
1442 #endif /* #if !UCONFIG_NO_FORMATTING */