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