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