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