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