]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/dtfmttst.cpp
ICU-461.18.tar.gz
[apple/icu.git] / icuSources / test / intltest / dtfmttst.cpp
CommitLineData
b75a7d8f 1/********************************************************************
729e4ab9
A
2 * COPYRIGHT:
3 * Copyright (c) 1997-2010, International Business Machines
4 * Corporation and others. All Rights Reserved.
b75a7d8f 5 ********************************************************************/
729e4ab9 6
b75a7d8f
A
7#include "unicode/utypes.h"
8
9#if !UCONFIG_NO_FORMATTING
10
11#include "dtfmttst.h"
12#include "unicode/timezone.h"
13#include "unicode/gregocal.h"
14#include "unicode/smpdtfmt.h"
15#include "unicode/datefmt.h"
16#include "unicode/simpletz.h"
17#include "unicode/strenum.h"
374ca955 18#include "unicode/dtfmtsym.h"
b75a7d8f 19#include "cmemory.h"
374ca955
A
20#include "cstring.h"
21#include "caltest.h" // for fieldName
46f4442e 22#include <stdio.h> // for sprintf
73c04bcf
A
23
24#ifdef U_WINDOWS
25#include "windttst.h"
26#endif
27
28#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
29
729e4ab9 30#define ASSERT_OK(status) if(U_FAILURE(status)) {errcheckln(status, #status " = %s @ %s:%d", u_errorName(status), __FILE__, __LINE__); return; }
73c04bcf 31
b75a7d8f
A
32// *****************************************************************************
33// class DateFormatTest
34// *****************************************************************************
35
36void DateFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
37{
38 // if (exec) logln((UnicodeString)"TestSuite DateFormatTest");
39 switch (index) {
40 TESTCASE(0,TestEquals);
41 TESTCASE(1,TestTwoDigitYearDSTParse);
42 TESTCASE(2,TestFieldPosition);
43 TESTCASE(3,TestPartialParse994);
44 TESTCASE(4,TestRunTogetherPattern985);
45 TESTCASE(5,TestRunTogetherPattern917);
46 TESTCASE(6,TestCzechMonths459);
47 TESTCASE(7,TestLetterDPattern212);
48 TESTCASE(8,TestDayOfYearPattern195);
49 TESTCASE(9,TestQuotePattern161);
50 TESTCASE(10,TestBadInput135);
51 TESTCASE(11,TestBadInput135a);
52 TESTCASE(12,TestTwoDigitYear);
53 TESTCASE(13,TestDateFormatZone061);
54 TESTCASE(14,TestDateFormatZone146);
55 TESTCASE(15,TestLocaleDateFormat);
56 TESTCASE(16,TestWallyWedel);
57 TESTCASE(17,TestDateFormatCalendar);
58 TESTCASE(18,TestSpaceParsing);
59 TESTCASE(19,TestExactCountFormat);
60 TESTCASE(20,TestWhiteSpaceParsing);
374ca955
A
61 TESTCASE(21,TestInvalidPattern);
62 TESTCASE(22,TestGeneral);
63 TESTCASE(23,TestGreekMay);
73c04bcf
A
64 TESTCASE(24,TestGenericTime);
65 TESTCASE(25,TestGenericTimeZoneOrder);
46f4442e
A
66 TESTCASE(26,TestHost);
67 TESTCASE(27,TestEras);
68 TESTCASE(28,TestNarrowNames);
69 TESTCASE(29,TestStandAloneDays);
70 TESTCASE(30,TestStandAloneMonths);
71 TESTCASE(31,TestQuarters);
72 TESTCASE(32,TestZTimeZoneParsing);
73 TESTCASE(33,TestRelative);
74 TESTCASE(34,TestRelativeClone);
75 TESTCASE(35,TestHostClone);
76 TESTCASE(36,TestTimeZoneDisplayName);
729e4ab9
A
77 TESTCASE(37,TestRoundtripWithCalendar);
78 TESTCASE(38,Test6338);
79 TESTCASE(39,Test6726);
80 TESTCASE(40,TestGMTParsing);
81 TESTCASE(41,Test6880);
82 TESTCASE(42,TestISOEra);
83 TESTCASE(43,TestFormalChineseDate);
84 TESTCASE(44,TestNumberAsStringParsing);
46f4442e 85 /*
729e4ab9
A
86 TESTCASE(45,TestRelativeError);
87 TESTCASE(46,TestRelativeOther);
88 */
b75a7d8f
A
89 default: name = ""; break;
90 }
91}
92
93// Test written by Wally Wedel and emailed to me.
94void DateFormatTest::TestWallyWedel()
95{
96 UErrorCode status = U_ZERO_ERROR;
97 /*
98 * Instantiate a TimeZone so we can get the ids.
99 */
100 TimeZone *tz = new SimpleTimeZone(7,"");
101 /*
102 * Computational variables.
103 */
46f4442e 104 int32_t offset, hours, minutes, seconds;
b75a7d8f
A
105 /*
106 * Instantiate a SimpleDateFormat set up to produce a full time
107 zone name.
108 */
109 SimpleDateFormat *sdf = new SimpleDateFormat((UnicodeString)"zzzz", status);
110 /*
111 * A String array for the time zone ids.
112 */
113 int32_t ids_length;
114 StringEnumeration* ids = TimeZone::createEnumeration();
115 ids_length = ids->count(status);
116 /*
117 * How many ids do we have?
118 */
119 logln("Time Zone IDs size: %d", ids_length);
120 /*
121 * Column headings (sort of)
122 */
123 logln("Ordinal ID offset(h:m) name");
124 /*
125 * Loop through the tzs.
126 */
127 UDate today = Calendar::getNow();
128 Calendar *cal = Calendar::createInstance(status);
129 for (int32_t i = 0; i < ids_length; i++) {
130 // logln(i + " " + ids[i]);
131 const UnicodeString* id = ids->snext(status);
132 TimeZone *ttz = TimeZone::createTimeZone(*id);
133 // offset = ttz.getRawOffset();
134 cal->setTimeZone(*ttz);
135 cal->setTime(today, status);
136 offset = cal->get(UCAL_ZONE_OFFSET, status) + cal->get(UCAL_DST_OFFSET, status);
137 // logln(i + " " + ids[i] + " offset " + offset);
138 const char* sign = "+";
139 if (offset < 0) {
140 sign = "-";
141 offset = -offset;
142 }
143 hours = offset/3600000;
144 minutes = (offset%3600000)/60000;
46f4442e 145 seconds = (offset%60000)/1000;
b75a7d8f
A
146 UnicodeString dstOffset = (UnicodeString)"" + sign + (hours < 10 ? "0" : "") +
147 (int32_t)hours + ":" + (minutes < 10 ? "0" : "") + (int32_t)minutes;
46f4442e
A
148 if (seconds != 0) {
149 dstOffset = dstOffset + ":" + (seconds < 10 ? "0" : "") + seconds;
150 }
b75a7d8f
A
151 /*
152 * Instantiate a date so we can display the time zone name.
153 */
154 sdf->setTimeZone(*ttz);
155 /*
156 * Format the output.
157 */
158 UnicodeString fmtOffset;
159 FieldPosition pos(0);
160 sdf->format(today,fmtOffset, pos);
161 // UnicodeString fmtOffset = tzS.toString();
162 UnicodeString *fmtDstOffset = 0;
163 if (fmtOffset.startsWith("GMT"))
164 {
165 //fmtDstOffset = fmtOffset->substring(3);
166 fmtDstOffset = new UnicodeString();
167 fmtOffset.extract(3, fmtOffset.length(), *fmtDstOffset);
168 }
169 /*
170 * Show our result.
171 */
172 UBool ok = fmtDstOffset == 0 || *fmtDstOffset == dstOffset;
173 if (ok)
174 {
175 logln(UnicodeString() + i + " " + *id + " " + dstOffset +
176 " " + fmtOffset +
177 (fmtDstOffset != 0 ? " ok" : " ?"));
178 }
179 else
180 {
181 errln(UnicodeString() + i + " " + *id + " " + dstOffset +
182 " " + fmtOffset + " *** FAIL ***");
183 }
184 delete ttz;
185 delete fmtDstOffset;
186 }
187 delete cal;
188 // delete ids; // TODO: BAD API
189 delete ids;
190 delete sdf;
191 delete tz;
192}
193
194// -------------------------------------
729e4ab9 195
b75a7d8f
A
196/**
197 * Test operator==
198 */
199void
200DateFormatTest::TestEquals()
201{
202 DateFormat* fmtA = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL);
203 DateFormat* fmtB = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL);
73c04bcf
A
204 if ( fmtA == NULL || fmtB == NULL){
205 dataerrln("Error calling DateFormat::createDateTimeInstance");
206 delete fmtA;
207 delete fmtB;
208 return;
209 }
210
b75a7d8f
A
211 if (!(*fmtA == *fmtB)) errln((UnicodeString)"FAIL");
212 delete fmtA;
213 delete fmtB;
73c04bcf
A
214
215 TimeZone* test = TimeZone::createTimeZone("PDT");
216 delete test;
b75a7d8f 217}
729e4ab9 218
b75a7d8f
A
219// -------------------------------------
220
221/**
222 * Test the parsing of 2-digit years.
223 */
224void
225DateFormatTest::TestTwoDigitYearDSTParse(void)
226{
227 UErrorCode status = U_ZERO_ERROR;
228 SimpleDateFormat* fullFmt = new SimpleDateFormat((UnicodeString)"EEE MMM dd HH:mm:ss.SSS zzz yyyy G", status);
229 SimpleDateFormat *fmt = new SimpleDateFormat((UnicodeString)"dd-MMM-yy h:mm:ss 'o''clock' a z", Locale::getEnglish(), status);
230 //DateFormat* fmt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL, Locale::ENGLISH);
231 UnicodeString* s = new UnicodeString("03-Apr-04 2:20:47 o'clock AM PST", "");
73c04bcf
A
232 TimeZone* defaultTZ = TimeZone::createDefault();
233 TimeZone* PST = TimeZone::createTimeZone("PST");
234 int32_t defaultOffset = defaultTZ->getRawOffset();
235 int32_t PSTOffset = PST->getRawOffset();
236 int32_t hour = 2 + (defaultOffset - PSTOffset) / (60*60*1000);
237 // hour is the expected hour of day, in units of seconds
238 hour = ((hour < 0) ? hour + 24 : hour) * 60*60;
729e4ab9 239
b75a7d8f 240 UnicodeString str;
73c04bcf
A
241
242 if(U_FAILURE(status)) {
729e4ab9 243 dataerrln("Could not set up test. exitting - %s", u_errorName(status));
73c04bcf
A
244 return;
245 }
246
b75a7d8f
A
247 UDate d = fmt->parse(*s, status);
248 logln(*s + " P> " + ((DateFormat*)fullFmt)->format(d, str));
249 int32_t y, m, day, hr, min, sec;
250 dateToFields(d, y, m, day, hr, min, sec);
73c04bcf
A
251 hour += defaultTZ->inDaylightTime(d, status) ? 1 : 0;
252 hr = hr*60*60;
b75a7d8f 253 if (hr != hour)
73c04bcf 254 errln((UnicodeString)"FAIL: Should parse to hour " + hour + " but got " + hr);
b75a7d8f
A
255
256 if (U_FAILURE(status))
257 errln((UnicodeString)"FAIL: " + (int32_t)status);
258
259 delete s;
260 delete fmt;
261 delete fullFmt;
73c04bcf
A
262 delete PST;
263 delete defaultTZ;
b75a7d8f 264}
729e4ab9 265
b75a7d8f 266// -------------------------------------
729e4ab9 267
b75a7d8f
A
268UChar toHexString(int32_t i) { return (UChar)(i + (i < 10 ? 0x30 : (0x41 - 10))); }
269
270UnicodeString&
271DateFormatTest::escape(UnicodeString& s)
272{
273 UnicodeString buf;
274 for (int32_t i=0; i<s.length(); ++i)
275 {
276 UChar c = s[(int32_t)i];
277 if (c <= (UChar)0x7F) buf += c;
278 else {
279 buf += (UChar)0x5c; buf += (UChar)0x55;
280 buf += toHexString((c & 0xF000) >> 12);
281 buf += toHexString((c & 0x0F00) >> 8);
282 buf += toHexString((c & 0x00F0) >> 4);
283 buf += toHexString(c & 0x000F);
284 }
285 }
286 return (s = buf);
287}
729e4ab9 288
b75a7d8f
A
289// -------------------------------------
290
374ca955
A
291/**
292 * This MUST be kept in sync with DateFormatSymbols.gPatternChars.
293 */
46f4442e 294static const char* PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqV";
374ca955
A
295
296/**
297 * A list of the names of all the fields in DateFormat.
298 * This MUST be kept in sync with DateFormat.
299 */
300static const char* DATEFORMAT_FIELD_NAMES[] = {
301 "ERA_FIELD",
302 "YEAR_FIELD",
303 "MONTH_FIELD",
304 "DATE_FIELD",
305 "HOUR_OF_DAY1_FIELD",
306 "HOUR_OF_DAY0_FIELD",
307 "MINUTE_FIELD",
308 "SECOND_FIELD",
309 "MILLISECOND_FIELD",
310 "DAY_OF_WEEK_FIELD",
311 "DAY_OF_YEAR_FIELD",
312 "DAY_OF_WEEK_IN_MONTH_FIELD",
313 "WEEK_OF_YEAR_FIELD",
314 "WEEK_OF_MONTH_FIELD",
315 "AM_PM_FIELD",
316 "HOUR1_FIELD",
317 "HOUR0_FIELD",
318 "TIMEZONE_FIELD",
319 "YEAR_WOY_FIELD",
320 "DOW_LOCAL_FIELD",
321 "EXTENDED_YEAR_FIELD",
322 "JULIAN_DAY_FIELD",
323 "MILLISECONDS_IN_DAY_FIELD",
73c04bcf
A
324 "TIMEZONE_RFC_FIELD",
325 "GENERIC_TIMEZONE_FIELD",
326 "STAND_ALONE_DAY_FIELD",
327 "STAND_ALONE_MONTH_FIELD",
328 "QUARTER_FIELD",
46f4442e
A
329 "STAND_ALONE_QUARTER_FIELD",
330 "TIMEZONE_SPECIAL_FIELD"
b75a7d8f
A
331};
332
374ca955
A
333static const int32_t DATEFORMAT_FIELD_NAMES_LENGTH =
334 sizeof(DATEFORMAT_FIELD_NAMES) / sizeof(DATEFORMAT_FIELD_NAMES[0]);
335
b75a7d8f
A
336/**
337 * Verify that returned field position indices are correct.
338 */
374ca955
A
339void DateFormatTest::TestFieldPosition() {
340 UErrorCode ec = U_ZERO_ERROR;
341 int32_t i, j, exp;
342 UnicodeString buf;
343
344 // Verify data
345 DateFormatSymbols rootSyms(Locale(""), ec);
346 assertSuccess("DateFormatSymbols", ec);
729e4ab9
A
347 if (U_FAILURE(ec)) {
348 return;
349 }
73c04bcf 350
46f4442e
A
351 // local pattern chars data is not longer loaded
352 // from icu locale bundle
353 assertEquals("patternChars", PATTERN_CHARS, rootSyms.getLocalPatternChars(buf));
374ca955
A
354 assertEquals("patternChars", PATTERN_CHARS, DateFormatSymbols::getPatternUChars());
355 assertTrue("DATEFORMAT_FIELD_NAMES", DATEFORMAT_FIELD_NAMES_LENGTH == UDAT_FIELD_COUNT);
356 assertTrue("Data", UDAT_FIELD_COUNT == uprv_strlen(PATTERN_CHARS));
357
358 // Create test formatters
359 const int32_t COUNT = 4;
360 DateFormat* dateFormats[COUNT];
361 dateFormats[0] = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale::getUS());
362 dateFormats[1] = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale::getFrance());
363 // Make the pattern "G y M d..."
364 buf.remove().append(PATTERN_CHARS);
365 for (j=buf.length()-1; j>=0; --j) buf.insert(j, (UChar)32/*' '*/);
366 dateFormats[2] = new SimpleDateFormat(buf, Locale::getUS(), ec);
367 // Make the pattern "GGGG yyyy MMMM dddd..."
368 for (j=buf.length()-1; j>=0; j-=2) {
369 for (i=0; i<3; ++i) {
370 buf.insert(j, buf.charAt(j));
371 }
372 }
373 dateFormats[3] = new SimpleDateFormat(buf, Locale::getUS(), ec);
73c04bcf
A
374 if(U_FAILURE(ec)){
375 errln(UnicodeString("Could not create SimpleDateFormat object for locale en_US. Error: " )+ UnicodeString(u_errorName(ec)));
376 return;
377 }
374ca955
A
378 UDate aug13 = 871508052513.0;
379
380 // Expected output field values for above DateFormats on aug13
381 // Fields are given in order of DateFormat field number
382 const char* EXPECTED[] = {
383 "", "1997", "August", "13", "", "", "34", "12", "",
729e4ab9 384 "Wednesday", "", "", "", "", "PM", "2", "", "Pacific Daylight Time", "", "", "", "", "", "", "", "", "", "", "","",
374ca955 385
46f4442e 386 "", "1997", "ao\\u00FBt", "13", "", "14", "34", "12", "",
729e4ab9 387 "mercredi", "", "", "", "", "", "", "", "heure avanc\\u00e9e du Pacifique", "", "", "", "", "", "", "", "", "", "", "", "",
374ca955
A
388
389 "AD", "1997", "8", "13", "14", "14", "34", "12", "5",
729e4ab9 390 "Wed", "225", "2", "33", "2", "PM", "2", "2", "PDT", "1997", "4", "1997", "2450674", "52452513", "-0700", "PT", "4", "8", "3", "3","PDT",
b75a7d8f 391
73c04bcf 392 "Anno Domini", "1997", "August", "0013", "0014", "0014", "0034", "0012", "5130",
729e4ab9 393 "Wednesday", "0225", "0002", "0033", "0002", "PM", "0002", "0002", "Pacific Daylight Time", "1997", "Wednesday", "1997", "2450674", "52452513", "GMT-07:00",
46f4442e 394 "Pacific Time", "Wednesday", "August", "3rd quarter", "3rd quarter", "United States (Los Angeles)"
b75a7d8f
A
395 };
396
374ca955 397 const int32_t EXPECTED_LENGTH = sizeof(EXPECTED)/sizeof(EXPECTED[0]);
b75a7d8f 398
374ca955
A
399 assertTrue("data size", EXPECTED_LENGTH == COUNT * UDAT_FIELD_COUNT);
400
401 TimeZone* PT = TimeZone::createTimeZone("America/Los_Angeles");
402 for (j = 0, exp = 0; j < COUNT; ++j) {
403 // String str;
b75a7d8f 404 DateFormat* df = dateFormats[j];
374ca955 405 df->setTimeZone(*PT);
729e4ab9
A
406 SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(df);
407 if (sdtfmt != NULL) {
408 logln(" Pattern = " + sdtfmt->toPattern(buf.remove()));
374ca955
A
409 } else {
410 logln(" Pattern = ? (not a SimpleDateFormat)");
411 }
412 logln((UnicodeString)" Result = " + df->format(aug13, buf.remove()));
413
729e4ab9 414 int32_t expBase = exp; // save for later
374ca955
A
415 for (i = 0; i < UDAT_FIELD_COUNT; ++i, ++exp) {
416 FieldPosition pos(i);
73c04bcf 417 buf.remove();
729e4ab9 418 df->format(aug13, buf, pos);
b75a7d8f 419 UnicodeString field;
374ca955
A
420 buf.extractBetween(pos.getBeginIndex(), pos.getEndIndex(), field);
421 assertEquals((UnicodeString)"field #" + i + " " + DATEFORMAT_FIELD_NAMES[i],
422 ctou(EXPECTED[exp]), field);
b75a7d8f 423 }
729e4ab9
A
424
425 // test FieldPositionIterator API
426 logln("FieldPositionIterator");
427 {
428 UErrorCode status = U_ZERO_ERROR;
429 FieldPositionIterator posIter;
430 FieldPosition fp;
431
432 buf.remove();
433 df->format(aug13, buf, &posIter, status);
434 while (posIter.next(fp)) {
435 int32_t i = fp.getField();
436 UnicodeString field;
437 buf.extractBetween(fp.getBeginIndex(), fp.getEndIndex(), field);
438 assertEquals((UnicodeString)"field #" + i + " " + DATEFORMAT_FIELD_NAMES[i],
439 ctou(EXPECTED[expBase + i]), field);
440 }
441
442 }
b75a7d8f 443 }
374ca955 444
729e4ab9
A
445
446 // test null posIter
447 buf.remove();
448 UErrorCode status = U_ZERO_ERROR;
449 dateFormats[0]->format(aug13, buf, NULL, status);
450 // if we didn't crash, we succeeded.
451
374ca955
A
452 for (i=0; i<COUNT; ++i) {
453 delete dateFormats[i];
454 }
455 delete PT;
b75a7d8f 456}
374ca955 457
b75a7d8f 458// -------------------------------------
374ca955
A
459
460/**
461 * General parse/format tests. Add test cases as needed.
462 */
463void DateFormatTest::TestGeneral() {
464 const char* DATA[] = {
465 "yyyy MM dd HH:mm:ss.SSS",
466
467 // Milliseconds are left-justified, since they format as fractions of a second
729e4ab9
A
468 "y/M/d H:mm:ss.S", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.5", "2004 03 10 16:36:31.500",
469 "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.56", "2004 03 10 16:36:31.560",
374ca955
A
470 "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567",
471 "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.568", "2004/3/10 16:36:31.5680",
472 };
73c04bcf 473 expect(DATA, ARRAY_SIZE(DATA), Locale("en", "", ""));
b75a7d8f 474}
729e4ab9 475
b75a7d8f
A
476// -------------------------------------
477
478/**
479 * Verify that strings which contain incomplete specifications are parsed
480 * correctly. In some instances, this means not being parsed at all, and
481 * returning an appropriate error.
482 */
483void
484DateFormatTest::TestPartialParse994()
485{
486 UErrorCode status = U_ZERO_ERROR;
487 SimpleDateFormat* f = new SimpleDateFormat(status);
729e4ab9
A
488 if (U_FAILURE(status)) {
489 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status));
490 delete f;
491 return;
492 }
b75a7d8f
A
493 UDate null = 0;
494 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:11:42", date(97, 1 - 1, 17, 10, 11, 42));
495 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:", null);
496 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10", null);
497 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 ", null);
498 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17", null);
499 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
500 delete f;
501}
729e4ab9 502
b75a7d8f 503// -------------------------------------
729e4ab9 504
b75a7d8f
A
505void
506DateFormatTest::tryPat994(SimpleDateFormat* format, const char* pat, const char* str, UDate expected)
507{
508 UErrorCode status = U_ZERO_ERROR;
509 UDate null = 0;
510 logln(UnicodeString("Pattern \"") + pat + "\" String \"" + str + "\"");
511 //try {
512 format->applyPattern(pat);
513 UDate date = format->parse(str, status);
514 if (U_FAILURE(status) || date == null)
515 {
516 logln((UnicodeString)"ParseException: " + (int32_t)status);
517 if (expected != null) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
518 }
519 else
520 {
521 UnicodeString f;
522 ((DateFormat*)format)->format(date, f);
523 logln(UnicodeString(" parse(") + str + ") -> " + dateToString(date));
524 logln((UnicodeString)" format -> " + f);
525 if (expected == null ||
526 !(date == expected)) errln((UnicodeString)"FAIL: Expected null");//" + expected);
527 if (!(f == str)) errln(UnicodeString("FAIL: Expected ") + str);
528 }
529 //}
530 //catch(ParseException e) {
531 // logln((UnicodeString)"ParseException: " + e.getMessage());
532 // if (expected != null) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
533 //}
534 //catch(Exception e) {
535 // errln((UnicodeString)"*** Exception:");
536 // e.printStackTrace();
537 //}
538}
729e4ab9 539
b75a7d8f 540// -------------------------------------
729e4ab9 541
b75a7d8f
A
542/**
543 * Verify the behavior of patterns in which digits for different fields run together
544 * without intervening separators.
545 */
546void
547DateFormatTest::TestRunTogetherPattern985()
548{
549 UErrorCode status = U_ZERO_ERROR;
550 UnicodeString format("yyyyMMddHHmmssSSS");
551 UnicodeString now, then;
552 //UBool flag;
553 SimpleDateFormat *formatter = new SimpleDateFormat(format, status);
729e4ab9
A
554 if (U_FAILURE(status)) {
555 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status));
556 delete formatter;
557 return;
558 }
b75a7d8f
A
559 UDate date1 = Calendar::getNow();
560 ((DateFormat*)formatter)->format(date1, now);
561 logln(now);
562 ParsePosition pos(0);
563 UDate date2 = formatter->parse(now, pos);
564 if (date2 == 0) then = "Parse stopped at " + pos.getIndex();
565 else ((DateFormat*)formatter)->format(date2, then);
566 logln(then);
567 if (!(date2 == date1)) errln((UnicodeString)"FAIL");
568 delete formatter;
569 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
570}
729e4ab9 571
b75a7d8f 572// -------------------------------------
729e4ab9 573
b75a7d8f
A
574/**
575 * Verify the behavior of patterns in which digits for different fields run together
576 * without intervening separators.
577 */
578void
579DateFormatTest::TestRunTogetherPattern917()
580{
581 UErrorCode status = U_ZERO_ERROR;
582 SimpleDateFormat* fmt;
583 UnicodeString myDate;
584 fmt = new SimpleDateFormat((UnicodeString)"yyyy/MM/dd", status);
729e4ab9
A
585 if (U_FAILURE(status)) {
586 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status));
587 delete fmt;
588 return;
589 }
b75a7d8f
A
590 myDate = "1997/02/03";
591 testIt917(fmt, myDate, date(97, 2 - 1, 3));
592 delete fmt;
593 fmt = new SimpleDateFormat((UnicodeString)"yyyyMMdd", status);
594 myDate = "19970304";
595 testIt917(fmt, myDate, date(97, 3 - 1, 4));
596 delete fmt;
597 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
598}
729e4ab9 599
b75a7d8f 600// -------------------------------------
729e4ab9 601
b75a7d8f
A
602void
603DateFormatTest::testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expected)
604{
605 UErrorCode status = U_ZERO_ERROR;
606 UnicodeString pattern;
607 logln((UnicodeString)"pattern=" + fmt->toPattern(pattern) + " string=" + str);
608 Formattable o;
609 //try {
610 ((Format*)fmt)->parseObject(str, o, status);
611 //}
612 if (U_FAILURE(status)) return;
613 //catch(ParseException e) {
614 // e.printStackTrace();
615 // return;
616 //}
617 logln((UnicodeString)"Parsed object: " + dateToString(o.getDate()));
618 if (!(o.getDate() == expected)) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
619 UnicodeString formatted; ((Format*)fmt)->format(o, formatted, status);
620 logln((UnicodeString)"Formatted string: " + formatted);
621 if (!(formatted == str)) errln((UnicodeString)"FAIL: Expected " + str);
622 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
623}
729e4ab9 624
b75a7d8f 625// -------------------------------------
729e4ab9 626
b75a7d8f
A
627/**
628 * Verify the handling of Czech June and July, which have the unique attribute that
629 * one is a proper prefix substring of the other.
630 */
631void
632DateFormatTest::TestCzechMonths459()
633{
634 UErrorCode status = U_ZERO_ERROR;
635 DateFormat* fmt = DateFormat::createDateInstance(DateFormat::FULL, Locale("cs", "", ""));
73c04bcf
A
636 if (fmt == NULL){
637 dataerrln("Error calling DateFormat::createDateInstance()");
638 return;
639 }
640
b75a7d8f
A
641 UnicodeString pattern;
642 logln((UnicodeString)"Pattern " + ((SimpleDateFormat*) fmt)->toPattern(pattern));
643 UDate june = date(97, UCAL_JUNE, 15);
644 UDate july = date(97, UCAL_JULY, 15);
645 UnicodeString juneStr; fmt->format(june, juneStr);
646 UnicodeString julyStr; fmt->format(july, julyStr);
647 //try {
648 logln((UnicodeString)"format(June 15 1997) = " + juneStr);
649 UDate d = fmt->parse(juneStr, status);
650 UnicodeString s; fmt->format(d, s);
651 int32_t month,yr,day,hr,min,sec; dateToFields(d,yr,month,day,hr,min,sec);
652 logln((UnicodeString)" -> parse -> " + s + " (month = " + month + ")");
653 if (month != UCAL_JUNE) errln((UnicodeString)"FAIL: Month should be June");
654 logln((UnicodeString)"format(July 15 1997) = " + julyStr);
655 d = fmt->parse(julyStr, status);
656 fmt->format(d, s);
657 dateToFields(d,yr,month,day,hr,min,sec);
658 logln((UnicodeString)" -> parse -> " + s + " (month = " + month + ")");
659 if (month != UCAL_JULY) errln((UnicodeString)"FAIL: Month should be July");
660 //}
661 //catch(ParseException e) {
662 if (U_FAILURE(status))
663 errln((UnicodeString)"Exception: " + (int32_t)status);
664 //}
665 delete fmt;
666}
729e4ab9 667
b75a7d8f
A
668// -------------------------------------
669
670/**
671 * Test the handling of 'D' in patterns.
672 */
673void
674DateFormatTest::TestLetterDPattern212()
675{
676 UErrorCode status = U_ZERO_ERROR;
677 UnicodeString dateString("1995-040.05:01:29");
46f4442e 678 UnicodeString ddateString("1995-02-09.05:01:29");
b75a7d8f 679 UnicodeString bigD("yyyy-DDD.hh:mm:ss");
46f4442e 680 UnicodeString littleD("yyyy-MM-dd.hh:mm:ss");
b75a7d8f
A
681 UDate expLittleD = date(95, 0, 1, 5, 1, 29);
682 UDate expBigD = expLittleD + 39 * 24 * 3600000.0;
683 expLittleD = expBigD; // Expect the same, with default lenient parsing
684 logln((UnicodeString)"dateString= " + dateString);
685 SimpleDateFormat *formatter = new SimpleDateFormat(bigD, status);
729e4ab9
A
686 if (U_FAILURE(status)) {
687 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status));
688 delete formatter;
689 return;
690 }
b75a7d8f
A
691 ParsePosition pos(0);
692 UDate myDate = formatter->parse(dateString, pos);
693 logln((UnicodeString)"Using " + bigD + " -> " + myDate);
46f4442e 694 if (myDate != expBigD) errln((UnicodeString)"FAIL: bigD - Expected " + dateToString(expBigD));
b75a7d8f
A
695 delete formatter;
696 formatter = new SimpleDateFormat(littleD, status);
729e4ab9 697 ASSERT_OK(status);
b75a7d8f 698 pos = ParsePosition(0);
46f4442e 699 myDate = formatter->parse(ddateString, pos);
b75a7d8f 700 logln((UnicodeString)"Using " + littleD + " -> " + dateToString(myDate));
46f4442e 701 if (myDate != expLittleD) errln((UnicodeString)"FAIL: littleD - Expected " + dateToString(expLittleD));
b75a7d8f
A
702 delete formatter;
703 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
704}
729e4ab9 705
b75a7d8f
A
706// -------------------------------------
707
708/**
709 * Test the day of year pattern.
710 */
711void
712DateFormatTest::TestDayOfYearPattern195()
713{
714 UErrorCode status = U_ZERO_ERROR;
715 UDate today = Calendar::getNow();
716 int32_t year,month,day,hour,min,sec; dateToFields(today,year,month,day,hour,min,sec);
717 UDate expected = date(year, month, day);
718 logln((UnicodeString)"Test Date: " + dateToString(today));
719 SimpleDateFormat* sdf = (SimpleDateFormat*)DateFormat::createDateInstance();
73c04bcf
A
720 if (sdf == NULL){
721 dataerrln("Error calling DateFormat::createDateInstance()");
722 return;
723 }
b75a7d8f
A
724 tryPattern(*sdf, today, 0, expected);
725 tryPattern(*sdf, today, "G yyyy DDD", expected);
726 delete sdf;
727 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
728}
729e4ab9 729
b75a7d8f 730// -------------------------------------
729e4ab9 731
b75a7d8f
A
732void
733DateFormatTest::tryPattern(SimpleDateFormat& sdf, UDate d, const char* pattern, UDate expected)
734{
735 UErrorCode status = U_ZERO_ERROR;
736 if (pattern != 0) sdf.applyPattern(pattern);
737 UnicodeString thePat;
738 logln((UnicodeString)"pattern: " + sdf.toPattern(thePat));
739 UnicodeString formatResult; (*(DateFormat*)&sdf).format(d, formatResult);
740 logln((UnicodeString)" format -> " + formatResult);
741 // try {
742 UDate d2 = sdf.parse(formatResult, status);
743 logln((UnicodeString)" parse(" + formatResult + ") -> " + dateToString(d2));
744 if (d2 != expected) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
745 UnicodeString format2; (*(DateFormat*)&sdf).format(d2, format2);
746 logln((UnicodeString)" format -> " + format2);
747 if (!(formatResult == format2)) errln((UnicodeString)"FAIL: Round trip drift");
748 //}
749 //catch(Exception e) {
750 if (U_FAILURE(status))
751 errln((UnicodeString)"Error: " + (int32_t)status);
752 //}
753}
729e4ab9 754
b75a7d8f
A
755// -------------------------------------
756
757/**
758 * Test the handling of single quotes in patterns.
759 */
760void
761DateFormatTest::TestQuotePattern161()
762{
763 UErrorCode status = U_ZERO_ERROR;
764 SimpleDateFormat* formatter = new SimpleDateFormat((UnicodeString)"MM/dd/yyyy 'at' hh:mm:ss a zzz", status);
729e4ab9
A
765 if (U_FAILURE(status)) {
766 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status));
767 delete formatter;
768 return;
769 }
b75a7d8f
A
770 UDate currentTime_1 = date(97, UCAL_AUGUST, 13, 10, 42, 28);
771 UnicodeString dateString; ((DateFormat*)formatter)->format(currentTime_1, dateString);
772 UnicodeString exp("08/13/1997 at 10:42:28 AM ");
773 logln((UnicodeString)"format(" + dateToString(currentTime_1) + ") = " + dateString);
774 if (0 != dateString.compareBetween(0, exp.length(), exp, 0, exp.length())) errln((UnicodeString)"FAIL: Expected " + exp);
775 delete formatter;
776 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
777}
729e4ab9 778
b75a7d8f
A
779// -------------------------------------
780
781/**
782 * Verify the correct behavior when handling invalid input strings.
783 */
784void
785DateFormatTest::TestBadInput135()
786{
787 UErrorCode status = U_ZERO_ERROR;
788 DateFormat::EStyle looks[] = {
789 DateFormat::SHORT, DateFormat::MEDIUM, DateFormat::LONG, DateFormat::FULL
790 };
791 int32_t looks_length = (int32_t)(sizeof(looks) / sizeof(looks[0]));
792 const char* strings[] = {
793 "Mar 15", "Mar 15 1997", "asdf", "3/1/97 1:23:", "3/1/00 1:23:45 AM"
794 };
795 int32_t strings_length = (int32_t)(sizeof(strings) / sizeof(strings[0]));
796 DateFormat *full = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG);
73c04bcf 797 if(full==NULL) {
729e4ab9 798 dataerrln("could not create date time instance");
73c04bcf
A
799 return;
800 }
b75a7d8f
A
801 UnicodeString expected("March 1, 2000 1:23:45 AM ");
802 for (int32_t i = 0; i < strings_length;++i) {
803 const char* text = strings[i];
804 for (int32_t j = 0; j < looks_length;++j) {
805 DateFormat::EStyle dateLook = looks[j];
806 for (int32_t k = 0; k < looks_length;++k) {
807 DateFormat::EStyle timeLook = looks[k];
808 DateFormat *df = DateFormat::createDateTimeInstance(dateLook, timeLook);
73c04bcf
A
809 if (df == NULL){
810 dataerrln("Error calling DateFormat::createDateTimeInstance()");
811 continue;
812 }
b75a7d8f
A
813 UnicodeString prefix = UnicodeString(text) + ", " + dateLook + "/" + timeLook + ": ";
814 //try {
815 UDate when = df->parse(text, status);
816 if (when == 0 && U_SUCCESS(status)) {
817 errln(prefix + "SHOULD NOT HAPPEN: parse returned 0.");
818 continue;
819 }
820 if (U_SUCCESS(status))
821 {
822 UnicodeString format;
823 full->format(when, format);
824 logln(prefix + "OK: " + format);
825 if (0!=format.compareBetween(0, expected.length(), expected, 0, expected.length()))
826 errln((UnicodeString)"FAIL: Expected " + expected + " got " + format);
827 }
828 //}
829 //catch(ParseException e) {
830 else
831 status = U_ZERO_ERROR;
832 //}
833 //catch(StringIndexOutOfBoundsException e) {
834 // errln(prefix + "SHOULD NOT HAPPEN: " + (int)status);
835 //}
836 delete df;
837 }
838 }
839 }
840 delete full;
841 if (U_FAILURE(status))
842 errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
843}
729e4ab9 844
46f4442e 845static const char* const parseFormats[] = {
b75a7d8f
A
846 "MMMM d, yyyy",
847 "MMMM d yyyy",
848 "M/d/yy",
849 "d MMMM, yyyy",
850 "d MMMM yyyy",
851 "d MMMM",
852 "MMMM d",
853 "yyyy",
854 "h:mm a MMMM d, yyyy"
855};
729e4ab9 856
46f4442e
A
857#if 0
858// strict inputStrings
859static const char* const inputStrings[] = {
b75a7d8f
A
860 "bogus string", 0, 0, 0, 0, 0, 0, 0, 0, 0,
861 "April 1, 1997", "April 1, 1997", 0, 0, 0, 0, 0, "April 1", 0, 0,
862 "Jan 1, 1970", "January 1, 1970", 0, 0, 0, 0, 0, "January 1", 0, 0,
863 "Jan 1 2037", 0, "January 1 2037", 0, 0, 0, 0, "January 1", 0, 0,
864 "1/1/70", 0, 0, "1/1/70", 0, 0, 0, 0, "0001", 0,
865 "5 May 1997", 0, 0, 0, 0, "5 May 1997", "5 May", 0, "0005", 0,
866 "16 May", 0, 0, 0, 0, 0, "16 May", 0, "0016", 0,
867 "April 30", 0, 0, 0, 0, 0, 0, "April 30", 0, 0,
868 "1998", 0, 0, 0, 0, 0, 0, 0, "1998", 0,
869 "1", 0, 0, 0, 0, 0, 0, 0, "0001", 0,
870 "3:00 pm Jan 1, 1997", 0, 0, 0, 0, 0, 0, 0, "0003", "3:00 PM January 1, 1997",
871};
46f4442e
A
872#else
873// lenient inputStrings
874static const char* const inputStrings[] = {
875 "bogus string", 0, 0, 0, 0, 0, 0, 0, 0, 0,
876 "April 1, 1997", "April 1, 1997", "April 1 1997", "4/1/97", 0, 0, 0, "April 1", 0, 0,
877 "Jan 1, 1970", "January 1, 1970", "January 1 1970", "1/1/70", 0, 0, 0, "January 1", 0, 0,
878 "Jan 1 2037", "January 1, 2037", "January 1 2037", "1/1/37", 0, 0, 0, "January 1", 0, 0,
879 "1/1/70", "January 1, 1970", "January 1 1970", "1/1/70", "1 January, 1970", "1 January 1970", "1 January", "January 1", "0001", 0,
880 "5 May 1997", 0, 0, 0, "5 May, 1997", "5 May 1997", "5 May", 0, "0005", 0,
881 "16 May", 0, 0, 0, 0, 0, "16 May", 0, "2016", 0,
882 "April 30", 0, 0, 0, 0, 0, 0, "April 30", 0, 0,
883 "1998", 0, 0, 0, 0, 0, 0, 0, "1998", 0,
884 "1", 0, 0, 0, 0, 0, 0, 0, "0001", 0,
885 "3:00 pm Jan 1, 1997", 0, 0, 0, 0, 0, 0, 0, "0003", "3:00 PM January 1, 1997",
886};
887#endif
729e4ab9 888
b75a7d8f
A
889// -------------------------------------
890
891/**
892 * Verify the correct behavior when parsing an array of inputs against an
893 * array of patterns, with known results. The results are encoded after
894 * the input strings in each row.
895 */
896void
897DateFormatTest::TestBadInput135a()
898{
899 UErrorCode status = U_ZERO_ERROR;
900 SimpleDateFormat* dateParse = new SimpleDateFormat(status);
901 if(U_FAILURE(status)) {
729e4ab9 902 dataerrln("Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status));
b75a7d8f
A
903 delete dateParse;
904 return;
905 }
906 const char* s;
907 UDate date;
908 const uint32_t PF_LENGTH = (int32_t)(sizeof(parseFormats)/sizeof(parseFormats[0]));
909 const uint32_t INPUT_LENGTH = (int32_t)(sizeof(inputStrings)/sizeof(inputStrings[0]));
910
911 dateParse->applyPattern("d MMMM, yyyy");
912 dateParse->adoptTimeZone(TimeZone::createDefault());
913 s = "not parseable";
914 UnicodeString thePat;
915 logln(UnicodeString("Trying to parse \"") + s + "\" with " + dateParse->toPattern(thePat));
916 //try {
917 date = dateParse->parse(s, status);
918 if (U_SUCCESS(status))
919 errln((UnicodeString)"FAIL: Expected exception during parse");
920 //}
921 //catch(Exception ex) {
922 else
923 logln((UnicodeString)"Exception during parse: " + (int32_t)status);
924 status = U_ZERO_ERROR;
925 //}
926 for (uint32_t i = 0; i < INPUT_LENGTH; i += (PF_LENGTH + 1)) {
927 ParsePosition parsePosition(0);
928 UnicodeString s( inputStrings[i]);
929 for (uint32_t index = 0; index < PF_LENGTH;++index) {
930 const char* expected = inputStrings[i + 1 + index];
931 dateParse->applyPattern(parseFormats[index]);
932 dateParse->adoptTimeZone(TimeZone::createDefault());
933 //try {
934 parsePosition.setIndex(0);
935 date = dateParse->parse(s, parsePosition);
936 if (parsePosition.getIndex() != 0) {
937 UnicodeString s1, s2;
938 s.extract(0, parsePosition.getIndex(), s1);
939 s.extract(parsePosition.getIndex(), s.length(), s2);
940 if (date == 0) {
941 errln((UnicodeString)"ERROR: null result fmt=\"" +
942 parseFormats[index] +
943 "\" pos=" + parsePosition.getIndex() + " " +
944 s1 + "|" + s2);
945 }
946 else {
947 UnicodeString result;
948 ((DateFormat*)dateParse)->format(date, result);
949 logln((UnicodeString)"Parsed \"" + s + "\" using \"" + dateParse->toPattern(thePat) + "\" to: " + result);
950 if (expected == 0)
729e4ab9 951 errln((UnicodeString)"FAIL: Expected parse failure, got " + result);
b75a7d8f 952 else if (!(result == expected))
46f4442e 953 errln(UnicodeString("FAIL: Expected ") + expected + UnicodeString(", got ") + result);
b75a7d8f
A
954 }
955 }
956 else if (expected != 0) {
957 errln(UnicodeString("FAIL: Expected ") + expected + " from \"" +
958 s + "\" with \"" + dateParse->toPattern(thePat) + "\"");
959 }
960 //}
961 //catch(Exception ex) {
962 if (U_FAILURE(status))
963 errln((UnicodeString)"An exception was thrown during parse: " + (int32_t)status);
964 //}
965 }
966 }
967 delete dateParse;
968 if (U_FAILURE(status))
969 errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
970}
729e4ab9 971
b75a7d8f
A
972// -------------------------------------
973
974/**
975 * Test the parsing of two-digit years.
976 */
977void
978DateFormatTest::TestTwoDigitYear()
979{
980 UErrorCode ec = U_ZERO_ERROR;
981 SimpleDateFormat fmt("dd/MM/yy", Locale::getUK(), ec);
982 if (U_FAILURE(ec)) {
729e4ab9 983 dataerrln("FAIL: SimpleDateFormat constructor - %s", u_errorName(ec));
b75a7d8f
A
984 return;
985 }
986 parse2DigitYear(fmt, "5/6/17", date(117, UCAL_JUNE, 5));
987 parse2DigitYear(fmt, "4/6/34", date(34, UCAL_JUNE, 4));
988}
729e4ab9 989
b75a7d8f 990// -------------------------------------
729e4ab9 991
b75a7d8f
A
992void
993DateFormatTest::parse2DigitYear(DateFormat& fmt, const char* str, UDate expected)
994{
995 UErrorCode status = U_ZERO_ERROR;
996 //try {
997 UDate d = fmt.parse(str, status);
998 UnicodeString thePat;
999 logln(UnicodeString("Parsing \"") + str + "\" with " + ((SimpleDateFormat*)&fmt)->toPattern(thePat) +
1000 " => " + dateToString(d));
1001 if (d != expected) errln((UnicodeString)"FAIL: Expected " + expected);
1002 //}
1003 //catch(ParseException e) {
1004 if (U_FAILURE(status))
1005 errln((UnicodeString)"FAIL: Got exception");
1006 //}
1007}
729e4ab9 1008
b75a7d8f
A
1009// -------------------------------------
1010
1011/**
1012 * Test the formatting of time zones.
1013 */
1014void
1015DateFormatTest::TestDateFormatZone061()
1016{
1017 UErrorCode status = U_ZERO_ERROR;
1018 UDate date;
1019 DateFormat *formatter;
1020 date= 859248000000.0;
1021 logln((UnicodeString)"Date 1997/3/25 00:00 GMT: " + date);
1022 formatter = new SimpleDateFormat((UnicodeString)"dd-MMM-yyyyy HH:mm", Locale::getUK(), status);
1023 if(U_FAILURE(status)) {
729e4ab9 1024 dataerrln("Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status));
b75a7d8f
A
1025 delete formatter;
1026 return;
1027 }
1028 formatter->adoptTimeZone(TimeZone::createTimeZone("GMT"));
1029 UnicodeString temp; formatter->format(date, temp);
1030 logln((UnicodeString)"Formatted in GMT to: " + temp);
1031 //try {
1032 UDate tempDate = formatter->parse(temp, status);
1033 logln((UnicodeString)"Parsed to: " + dateToString(tempDate));
1034 if (tempDate != date) errln((UnicodeString)"FAIL: Expected " + dateToString(date));
1035 //}
1036 //catch(Throwable t) {
1037 if (U_FAILURE(status))
1038 errln((UnicodeString)"Date Formatter throws: " + (int32_t)status);
1039 //}
1040 delete formatter;
1041}
729e4ab9 1042
b75a7d8f 1043// -------------------------------------
729e4ab9 1044
b75a7d8f
A
1045/**
1046 * Test the formatting of time zones.
1047 */
1048void
1049DateFormatTest::TestDateFormatZone146()
1050{
1051 TimeZone *saveDefault = TimeZone::createDefault();
1052
1053 //try {
1054 TimeZone *thedefault = TimeZone::createTimeZone("GMT");
1055 TimeZone::setDefault(*thedefault);
1056 // java.util.Locale.setDefault(new java.util.Locale("ar", "", ""));
1057
1058 // check to be sure... its GMT all right
1059 TimeZone *testdefault = TimeZone::createDefault();
1060 UnicodeString testtimezone;
1061 testdefault->getID(testtimezone);
1062 if (testtimezone == "GMT")
1063 logln("Test timezone = " + testtimezone);
1064 else
1065 errln("Test timezone should be GMT, not " + testtimezone);
1066
1067 UErrorCode status = U_ZERO_ERROR;
1068 // now try to use the default GMT time zone
1069 GregorianCalendar *greenwichcalendar =
1070 new GregorianCalendar(1997, 3, 4, 23, 0, status);
729e4ab9
A
1071 if (U_FAILURE(status)) {
1072 dataerrln("Fail new GregorianCalendar: %s", u_errorName(status));
1073 } else {
1074 //*****************************greenwichcalendar.setTimeZone(TimeZone.getDefault());
1075 //greenwichcalendar.set(1997, 3, 4, 23, 0);
1076 // try anything to set hour to 23:00 !!!
1077 greenwichcalendar->set(UCAL_HOUR_OF_DAY, 23);
1078 // get time
1079 UDate greenwichdate = greenwichcalendar->getTime(status);
1080 // format every way
1081 UnicodeString DATA [] = {
1082 UnicodeString("simple format: "), UnicodeString("04/04/97 23:00 GMT+00:00"),
1083 UnicodeString("MM/dd/yy HH:mm z"),
1084 UnicodeString("full format: "), UnicodeString("Friday, April 4, 1997 11:00:00 o'clock PM GMT+00:00"),
1085 UnicodeString("EEEE, MMMM d, yyyy h:mm:ss 'o''clock' a z"),
1086 UnicodeString("long format: "), UnicodeString("April 4, 1997 11:00:00 PM GMT+00:00"),
1087 UnicodeString("MMMM d, yyyy h:mm:ss a z"),
1088 UnicodeString("default format: "), UnicodeString("04-Apr-97 11:00:00 PM"),
1089 UnicodeString("dd-MMM-yy h:mm:ss a"),
1090 UnicodeString("short format: "), UnicodeString("4/4/97 11:00 PM"),
1091 UnicodeString("M/d/yy h:mm a")
1092 };
1093 int32_t DATA_length = (int32_t)(sizeof(DATA) / sizeof(DATA[0]));
1094
1095 for (int32_t i=0; i<DATA_length; i+=3) {
1096 DateFormat *fmt = new SimpleDateFormat(DATA[i+2], Locale::getEnglish(), status);
1097 if(failure(status, "new SimpleDateFormat")) break;
1098 fmt->setCalendar(*greenwichcalendar);
1099 UnicodeString result;
1100 result = fmt->format(greenwichdate, result);
1101 logln(DATA[i] + result);
1102 if (result != DATA[i+1])
1103 errln("FAIL: Expected " + DATA[i+1] + ", got " + result);
1104 delete fmt;
1105 }
b75a7d8f
A
1106 }
1107 //}
1108 //finally {
1109 TimeZone::adoptDefault(saveDefault);
1110 //}
1111 delete testdefault;
1112 delete greenwichcalendar;
1113 delete thedefault;
1114
1115
1116}
729e4ab9 1117
b75a7d8f 1118// -------------------------------------
729e4ab9 1119
b75a7d8f
A
1120/**
1121 * Test the formatting of dates in different locales.
1122 */
1123void
1124DateFormatTest::TestLocaleDateFormat() // Bug 495
1125{
1126 UDate testDate = date(97, UCAL_SEPTEMBER, 15);
729e4ab9 1127 DateFormat *dfFrench = DateFormat::createDateTimeInstance(DateFormat::FULL,
b75a7d8f 1128 DateFormat::FULL, Locale::getFrench());
729e4ab9 1129 DateFormat *dfUS = DateFormat::createDateTimeInstance(DateFormat::FULL,
b75a7d8f 1130 DateFormat::FULL, Locale::getUS());
729e4ab9 1131 UnicodeString expectedFRENCH ( "lundi 15 septembre 1997 00:00:00 heure avanc\\u00E9e du Pacifique", -1, US_INV );
374ca955 1132 expectedFRENCH = expectedFRENCH.unescape();
b75a7d8f 1133 //UnicodeString expectedUS ( "Monday, September 15, 1997 12:00:00 o'clock AM PDT" );
729e4ab9 1134 UnicodeString expectedUS ( "Monday, September 15, 1997 12:00:00 AM Pacific Daylight Time" );
b75a7d8f 1135 logln((UnicodeString)"Date set to : " + dateToString(testDate));
729e4ab9 1136 UnicodeString out;
73c04bcf
A
1137 if (dfUS == NULL || dfFrench == NULL){
1138 dataerrln("Error calling DateFormat::createDateTimeInstance)");
1139 delete dfUS;
1140 delete dfFrench;
1141 return;
1142 }
1143
b75a7d8f
A
1144 dfFrench->format(testDate, out);
1145 logln((UnicodeString)"Date Formated with French Locale " + out);
1146 if (!(out == expectedFRENCH))
1147 errln((UnicodeString)"FAIL: Expected " + expectedFRENCH);
1148 out.truncate(0);
1149 dfUS->format(testDate, out);
1150 logln((UnicodeString)"Date Formated with US Locale " + out);
1151 if (!(out == expectedUS))
1152 errln((UnicodeString)"FAIL: Expected " + expectedUS);
1153 delete dfUS;
1154 delete dfFrench;
1155}
1156
1157/**
1158 * Test DateFormat(Calendar) API
1159 */
1160void DateFormatTest::TestDateFormatCalendar() {
1161 DateFormat *date=0, *time=0, *full=0;
1162 Calendar *cal=0;
1163 UnicodeString str;
1164 ParsePosition pos;
1165 UDate when;
1166 UErrorCode ec = U_ZERO_ERROR;
1167
1168 /* Create a formatter for date fields. */
1169 date = DateFormat::createDateInstance(DateFormat::kShort, Locale::getUS());
1170 if (date == NULL) {
729e4ab9 1171 dataerrln("FAIL: createDateInstance failed");
b75a7d8f
A
1172 goto FAIL;
1173 }
1174
1175 /* Create a formatter for time fields. */
1176 time = DateFormat::createTimeInstance(DateFormat::kShort, Locale::getUS());
1177 if (time == NULL) {
1178 errln("FAIL: createTimeInstance failed");
1179 goto FAIL;
1180 }
1181
1182 /* Create a full format for output */
1183 full = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull,
1184 Locale::getUS());
1185 if (full == NULL) {
1186 errln("FAIL: createInstance failed");
1187 goto FAIL;
1188 }
1189
1190 /* Create a calendar */
1191 cal = Calendar::createInstance(Locale::getUS(), ec);
1192 if (cal == NULL || U_FAILURE(ec)) {
729e4ab9 1193 errln((UnicodeString)"FAIL: Calendar::createInstance failed with " +
b75a7d8f
A
1194 u_errorName(ec));
1195 goto FAIL;
1196 }
1197
1198 /* Parse the date */
1199 cal->clear();
1200 str = UnicodeString("4/5/2001", "");
1201 pos.setIndex(0);
1202 date->parse(str, *cal, pos);
1203 if (pos.getIndex() != str.length()) {
1204 errln((UnicodeString)"FAIL: DateFormat::parse(4/5/2001) failed at " +
1205 pos.getIndex());
1206 goto FAIL;
1207 }
1208
1209 /* Parse the time */
1210 str = UnicodeString("5:45 PM", "");
1211 pos.setIndex(0);
1212 time->parse(str, *cal, pos);
1213 if (pos.getIndex() != str.length()) {
1214 errln((UnicodeString)"FAIL: DateFormat::parse(17:45) failed at " +
1215 pos.getIndex());
1216 goto FAIL;
1217 }
729e4ab9 1218
b75a7d8f
A
1219 /* Check result */
1220 when = cal->getTime(ec);
1221 if (U_FAILURE(ec)) {
1222 errln((UnicodeString)"FAIL: cal->getTime() failed with " + u_errorName(ec));
1223 goto FAIL;
1224 }
1225 str.truncate(0);
1226 full->format(when, str);
1227 // Thursday, April 5, 2001 5:45:00 PM PDT 986517900000
1228 if (when == 986517900000.0) {
1229 logln("Ok: Parsed result: " + str);
1230 } else {
1231 errln("FAIL: Parsed result: " + str + ", exp 4/5/2001 5:45 PM");
1232 }
1233
729e4ab9 1234 FAIL:
b75a7d8f
A
1235 delete date;
1236 delete time;
1237 delete full;
1238 delete cal;
1239}
1240
1241/**
1242 * Test DateFormat's parsing of space characters. See jitterbug 1916.
1243 */
1244void DateFormatTest::TestSpaceParsing() {
1245 const char* DATA[] = {
1246 "yyyy MM dd HH:mm:ss",
1247
1248 // pattern, input, expected parse or NULL if expect parse failure
46f4442e 1249 "MMMM d yy", " 04 05 06", "2006 04 05 00:00:00",
b75a7d8f 1250 NULL, "04 05 06", "2006 04 05 00:00:00",
46f4442e
A
1251
1252 "MM d yy", " 04 05 06", "2006 04 05 00:00:00",
1253 NULL, "04 05 06", "2006 04 05 00:00:00",
1254 NULL, "04/05/06", "2006 04 05 00:00:00",
1255 NULL, "04-05-06", "2006 04 05 00:00:00",
1256 NULL, "04.05.06", "2006 04 05 00:00:00",
1257 NULL, "04 / 05 / 06", "2006 04 05 00:00:00",
1258 NULL, "Apr / 05/ 06", "2006 04 05 00:00:00",
1259 NULL, "Apr-05-06", "2006 04 05 00:00:00",
1260 NULL, "Apr 05, 2006", "2006 04 05 00:00:00",
1261
b75a7d8f
A
1262 "MMMM d yy", " Apr 05 06", "2006 04 05 00:00:00",
1263 NULL, "Apr 05 06", "2006 04 05 00:00:00",
46f4442e
A
1264 NULL, "Apr05 06", "2006 04 05 00:00:00",
1265
1266 "hh:mm:ss a", "12:34:56 PM", "1970 01 01 12:34:56",
1267 NULL, "12:34:56PM", "1970 01 01 12:34:56",
1268 NULL, "12.34.56PM", "1970 01 01 12:34:56",
1269 NULL, "12-34-56 PM", "1970 01 01 12:34:56",
1270 NULL, "12 : 34 : 56 PM", "1970 01 01 12:34:56",
1271
1272 "MM d yy 'at' hh:mm:ss a", "04/05/06 12:34:56 PM", "2006 04 05 12:34:56",
1273
1274 "MMMM dd yyyy hh:mm a", "September 27, 1964 21:56 PM", "1964 09 28 09:56:00",
1275 NULL, "November 4, 2008 0:13 AM", "2008 11 04 00:13:00",
1276
1277 "HH'h'mm'min'ss's'", "12h34min56s", "1970 01 01 12:34:56",
1278 NULL, "12h34mi56s", "1970 01 01 12:34:56",
1279 NULL, "12h34m56s", "1970 01 01 12:34:56",
1280 NULL, "12:34:56", "1970 01 01 12:34:56"
b75a7d8f
A
1281 };
1282 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]);
1283
1284 expectParse(DATA, DATA_len, Locale("en"));
1285}
1286
1287/**
1288 * Test handling of "HHmmss" pattern.
1289 */
1290void DateFormatTest::TestExactCountFormat() {
1291 const char* DATA[] = {
1292 "yyyy MM dd HH:mm:ss",
1293
1294 // pattern, input, expected parse or NULL if expect parse failure
1295 "HHmmss", "123456", "1970 01 01 12:34:56",
1296 NULL, "12345", "1970 01 01 01:23:45",
1297 NULL, "1234", NULL,
1298 NULL, "00-05", NULL,
1299 NULL, "12-34", NULL,
1300 NULL, "00+05", NULL,
1301 "ahhmm", "PM730", "1970 01 01 19:30:00",
1302 };
1303 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]);
1304
1305 expectParse(DATA, DATA_len, Locale("en"));
1306}
1307
1308/**
1309 * Test handling of white space.
1310 */
1311void DateFormatTest::TestWhiteSpaceParsing() {
1312 const char* DATA[] = {
1313 "yyyy MM dd",
729e4ab9 1314
b75a7d8f 1315 // pattern, input, expected parse or null if expect parse failure
729e4ab9 1316
b75a7d8f
A
1317 // Pattern space run should parse input text space run
1318 "MM d yy", " 04 01 03", "2003 04 01",
1319 NULL, " 04 01 03 ", "2003 04 01",
1320 };
1321 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]);
729e4ab9 1322
b75a7d8f
A
1323 expectParse(DATA, DATA_len, Locale("en"));
1324}
1325
374ca955
A
1326
1327void DateFormatTest::TestInvalidPattern() {
1328 UErrorCode ec = U_ZERO_ERROR;
1329 SimpleDateFormat f(UnicodeString("Yesterday"), ec);
729e4ab9
A
1330 if (U_FAILURE(ec)) {
1331 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(ec));
1332 return;
1333 }
374ca955
A
1334 UnicodeString out;
1335 FieldPosition pos;
1336 f.format((UDate)0, out, pos);
1337 logln(out);
1338 // The bug is that the call to format() will crash. By not
1339 // crashing, the test passes.
1340}
1341
1342void DateFormatTest::TestGreekMay() {
1343 UErrorCode ec = U_ZERO_ERROR;
1344 UDate date = -9896080848000.0;
1345 SimpleDateFormat fmt("EEEE, dd MMMM yyyy h:mm:ss a", Locale("el", "", ""), ec);
729e4ab9
A
1346 if (U_FAILURE(ec)) {
1347 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(ec));
1348 return;
1349 }
374ca955
A
1350 UnicodeString str;
1351 fmt.format(date, str);
1352 ParsePosition pos(0);
1353 UDate d2 = fmt.parse(str, pos);
1354 if (date != d2) {
1355 errln("FAIL: unable to parse strings where case-folding changes length");
1356 }
1357}
1358
73c04bcf
A
1359void DateFormatTest::TestStandAloneMonths()
1360{
1361 const char *EN_DATA[] = {
1362 "yyyy MM dd HH:mm:ss",
1363
1364 "yyyy LLLL dd H:mm:ss", "fp", "2004 03 10 16:36:31", "2004 March 10 16:36:31", "2004 03 10 16:36:31",
1365 "yyyy LLL dd H:mm:ss", "fp", "2004 03 10 16:36:31", "2004 Mar 10 16:36:31", "2004 03 10 16:36:31",
1366 "yyyy LLLL dd H:mm:ss", "F", "2004 03 10 16:36:31", "2004 March 10 16:36:31",
1367 "yyyy LLL dd H:mm:ss", "pf", "2004 Mar 10 16:36:31", "2004 03 10 16:36:31", "2004 Mar 10 16:36:31",
729e4ab9 1368
73c04bcf
A
1369 "LLLL", "fp", "1970 01 01 0:00:00", "January", "1970 01 01 0:00:00",
1370 "LLLL", "fp", "1970 02 01 0:00:00", "February", "1970 02 01 0:00:00",
1371 "LLLL", "fp", "1970 03 01 0:00:00", "March", "1970 03 01 0:00:00",
1372 "LLLL", "fp", "1970 04 01 0:00:00", "April", "1970 04 01 0:00:00",
1373 "LLLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00",
1374 "LLLL", "fp", "1970 06 01 0:00:00", "June", "1970 06 01 0:00:00",
1375 "LLLL", "fp", "1970 07 01 0:00:00", "July", "1970 07 01 0:00:00",
1376 "LLLL", "fp", "1970 08 01 0:00:00", "August", "1970 08 01 0:00:00",
1377 "LLLL", "fp", "1970 09 01 0:00:00", "September", "1970 09 01 0:00:00",
1378 "LLLL", "fp", "1970 10 01 0:00:00", "October", "1970 10 01 0:00:00",
1379 "LLLL", "fp", "1970 11 01 0:00:00", "November", "1970 11 01 0:00:00",
1380 "LLLL", "fp", "1970 12 01 0:00:00", "December", "1970 12 01 0:00:00",
729e4ab9 1381
73c04bcf
A
1382 "LLL", "fp", "1970 01 01 0:00:00", "Jan", "1970 01 01 0:00:00",
1383 "LLL", "fp", "1970 02 01 0:00:00", "Feb", "1970 02 01 0:00:00",
1384 "LLL", "fp", "1970 03 01 0:00:00", "Mar", "1970 03 01 0:00:00",
1385 "LLL", "fp", "1970 04 01 0:00:00", "Apr", "1970 04 01 0:00:00",
1386 "LLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00",
1387 "LLL", "fp", "1970 06 01 0:00:00", "Jun", "1970 06 01 0:00:00",
1388 "LLL", "fp", "1970 07 01 0:00:00", "Jul", "1970 07 01 0:00:00",
1389 "LLL", "fp", "1970 08 01 0:00:00", "Aug", "1970 08 01 0:00:00",
1390 "LLL", "fp", "1970 09 01 0:00:00", "Sep", "1970 09 01 0:00:00",
1391 "LLL", "fp", "1970 10 01 0:00:00", "Oct", "1970 10 01 0:00:00",
1392 "LLL", "fp", "1970 11 01 0:00:00", "Nov", "1970 11 01 0:00:00",
1393 "LLL", "fp", "1970 12 01 0:00:00", "Dec", "1970 12 01 0:00:00",
1394 };
729e4ab9 1395
73c04bcf
A
1396 const char *CS_DATA[] = {
1397 "yyyy MM dd HH:mm:ss",
1398
1399 "yyyy LLLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 duben 10 16:36:31", "2004 04 10 16:36:31",
1400 "yyyy MMMM dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31", "2004 04 10 16:36:31",
1401 "yyyy LLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 4. 10 16:36:31", "2004 04 10 16:36:31",
1402 "yyyy LLLL dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 duben 10 16:36:31",
1403 "yyyy MMMM dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31",
1404 "yyyy LLLL dd H:mm:ss", "pf", "2004 duben 10 16:36:31", "2004 04 10 16:36:31", "2004 duben 10 16:36:31",
1405 "yyyy MMMM dd H:mm:ss", "pf", "2004 dubna 10 16:36:31", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31",
729e4ab9 1406
73c04bcf
A
1407 "LLLL", "fp", "1970 01 01 0:00:00", "leden", "1970 01 01 0:00:00",
1408 "LLLL", "fp", "1970 02 01 0:00:00", "\\u00FAnor", "1970 02 01 0:00:00",
1409 "LLLL", "fp", "1970 03 01 0:00:00", "b\\u0159ezen", "1970 03 01 0:00:00",
1410 "LLLL", "fp", "1970 04 01 0:00:00", "duben", "1970 04 01 0:00:00",
1411 "LLLL", "fp", "1970 05 01 0:00:00", "kv\\u011Bten", "1970 05 01 0:00:00",
1412 "LLLL", "fp", "1970 06 01 0:00:00", "\\u010Derven", "1970 06 01 0:00:00",
1413 "LLLL", "fp", "1970 07 01 0:00:00", "\\u010Dervenec", "1970 07 01 0:00:00",
1414 "LLLL", "fp", "1970 08 01 0:00:00", "srpen", "1970 08 01 0:00:00",
1415 "LLLL", "fp", "1970 09 01 0:00:00", "z\\u00E1\\u0159\\u00ED", "1970 09 01 0:00:00",
1416 "LLLL", "fp", "1970 10 01 0:00:00", "\\u0159\\u00EDjen", "1970 10 01 0:00:00",
1417 "LLLL", "fp", "1970 11 01 0:00:00", "listopad", "1970 11 01 0:00:00",
1418 "LLLL", "fp", "1970 12 01 0:00:00", "prosinec", "1970 12 01 0:00:00",
1419
1420 "LLL", "fp", "1970 01 01 0:00:00", "1.", "1970 01 01 0:00:00",
1421 "LLL", "fp", "1970 02 01 0:00:00", "2.", "1970 02 01 0:00:00",
1422 "LLL", "fp", "1970 03 01 0:00:00", "3.", "1970 03 01 0:00:00",
1423 "LLL", "fp", "1970 04 01 0:00:00", "4.", "1970 04 01 0:00:00",
1424 "LLL", "fp", "1970 05 01 0:00:00", "5.", "1970 05 01 0:00:00",
1425 "LLL", "fp", "1970 06 01 0:00:00", "6.", "1970 06 01 0:00:00",
1426 "LLL", "fp", "1970 07 01 0:00:00", "7.", "1970 07 01 0:00:00",
1427 "LLL", "fp", "1970 08 01 0:00:00", "8.", "1970 08 01 0:00:00",
1428 "LLL", "fp", "1970 09 01 0:00:00", "9.", "1970 09 01 0:00:00",
1429 "LLL", "fp", "1970 10 01 0:00:00", "10.", "1970 10 01 0:00:00",
1430 "LLL", "fp", "1970 11 01 0:00:00", "11.", "1970 11 01 0:00:00",
1431 "LLL", "fp", "1970 12 01 0:00:00", "12.", "1970 12 01 0:00:00",
1432 };
729e4ab9 1433
73c04bcf
A
1434 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1435 expect(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", ""));
1436}
1437
1438void DateFormatTest::TestStandAloneDays()
1439{
1440 const char *EN_DATA[] = {
1441 "yyyy MM dd HH:mm:ss",
1442
1443 "cccc", "fp", "1970 01 04 0:00:00", "Sunday", "1970 01 04 0:00:00",
1444 "cccc", "fp", "1970 01 05 0:00:00", "Monday", "1970 01 05 0:00:00",
1445 "cccc", "fp", "1970 01 06 0:00:00", "Tuesday", "1970 01 06 0:00:00",
1446 "cccc", "fp", "1970 01 07 0:00:00", "Wednesday", "1970 01 07 0:00:00",
1447 "cccc", "fp", "1970 01 01 0:00:00", "Thursday", "1970 01 01 0:00:00",
1448 "cccc", "fp", "1970 01 02 0:00:00", "Friday", "1970 01 02 0:00:00",
1449 "cccc", "fp", "1970 01 03 0:00:00", "Saturday", "1970 01 03 0:00:00",
729e4ab9 1450
73c04bcf
A
1451 "ccc", "fp", "1970 01 04 0:00:00", "Sun", "1970 01 04 0:00:00",
1452 "ccc", "fp", "1970 01 05 0:00:00", "Mon", "1970 01 05 0:00:00",
1453 "ccc", "fp", "1970 01 06 0:00:00", "Tue", "1970 01 06 0:00:00",
1454 "ccc", "fp", "1970 01 07 0:00:00", "Wed", "1970 01 07 0:00:00",
1455 "ccc", "fp", "1970 01 01 0:00:00", "Thu", "1970 01 01 0:00:00",
1456 "ccc", "fp", "1970 01 02 0:00:00", "Fri", "1970 01 02 0:00:00",
1457 "ccc", "fp", "1970 01 03 0:00:00", "Sat", "1970 01 03 0:00:00",
1458 };
729e4ab9 1459
73c04bcf
A
1460 const char *CS_DATA[] = {
1461 "yyyy MM dd HH:mm:ss",
1462
1463 "cccc", "fp", "1970 01 04 0:00:00", "ned\\u011Ble", "1970 01 04 0:00:00",
1464 "cccc", "fp", "1970 01 05 0:00:00", "pond\\u011Bl\\u00ED", "1970 01 05 0:00:00",
1465 "cccc", "fp", "1970 01 06 0:00:00", "\\u00FAter\\u00FD", "1970 01 06 0:00:00",
1466 "cccc", "fp", "1970 01 07 0:00:00", "st\\u0159eda", "1970 01 07 0:00:00",
1467 "cccc", "fp", "1970 01 01 0:00:00", "\\u010Dtvrtek", "1970 01 01 0:00:00",
1468 "cccc", "fp", "1970 01 02 0:00:00", "p\\u00E1tek", "1970 01 02 0:00:00",
1469 "cccc", "fp", "1970 01 03 0:00:00", "sobota", "1970 01 03 0:00:00",
729e4ab9 1470
73c04bcf
A
1471 "ccc", "fp", "1970 01 04 0:00:00", "ne", "1970 01 04 0:00:00",
1472 "ccc", "fp", "1970 01 05 0:00:00", "po", "1970 01 05 0:00:00",
1473 "ccc", "fp", "1970 01 06 0:00:00", "\\u00FAt", "1970 01 06 0:00:00",
1474 "ccc", "fp", "1970 01 07 0:00:00", "st", "1970 01 07 0:00:00",
1475 "ccc", "fp", "1970 01 01 0:00:00", "\\u010Dt", "1970 01 01 0:00:00",
1476 "ccc", "fp", "1970 01 02 0:00:00", "p\\u00E1", "1970 01 02 0:00:00",
1477 "ccc", "fp", "1970 01 03 0:00:00", "so", "1970 01 03 0:00:00",
1478 };
729e4ab9 1479
73c04bcf
A
1480 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1481 expect(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", ""));
1482}
1483
1484void DateFormatTest::TestNarrowNames()
1485{
1486 const char *EN_DATA[] = {
1487 "yyyy MM dd HH:mm:ss",
1488
1489 "yyyy MMMMM dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31",
1490 "yyyy LLLLL dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31",
729e4ab9 1491
73c04bcf
A
1492 "MMMMM", "1970 01 01 0:00:00", "J",
1493 "MMMMM", "1970 02 01 0:00:00", "F",
1494 "MMMMM", "1970 03 01 0:00:00", "M",
1495 "MMMMM", "1970 04 01 0:00:00", "A",
1496 "MMMMM", "1970 05 01 0:00:00", "M",
1497 "MMMMM", "1970 06 01 0:00:00", "J",
1498 "MMMMM", "1970 07 01 0:00:00", "J",
1499 "MMMMM", "1970 08 01 0:00:00", "A",
1500 "MMMMM", "1970 09 01 0:00:00", "S",
1501 "MMMMM", "1970 10 01 0:00:00", "O",
1502 "MMMMM", "1970 11 01 0:00:00", "N",
1503 "MMMMM", "1970 12 01 0:00:00", "D",
729e4ab9 1504
73c04bcf
A
1505 "LLLLL", "1970 01 01 0:00:00", "J",
1506 "LLLLL", "1970 02 01 0:00:00", "F",
1507 "LLLLL", "1970 03 01 0:00:00", "M",
1508 "LLLLL", "1970 04 01 0:00:00", "A",
1509 "LLLLL", "1970 05 01 0:00:00", "M",
1510 "LLLLL", "1970 06 01 0:00:00", "J",
1511 "LLLLL", "1970 07 01 0:00:00", "J",
1512 "LLLLL", "1970 08 01 0:00:00", "A",
1513 "LLLLL", "1970 09 01 0:00:00", "S",
1514 "LLLLL", "1970 10 01 0:00:00", "O",
1515 "LLLLL", "1970 11 01 0:00:00", "N",
1516 "LLLLL", "1970 12 01 0:00:00", "D",
1517
1518 "EEEEE", "1970 01 04 0:00:00", "S",
1519 "EEEEE", "1970 01 05 0:00:00", "M",
1520 "EEEEE", "1970 01 06 0:00:00", "T",
1521 "EEEEE", "1970 01 07 0:00:00", "W",
1522 "EEEEE", "1970 01 01 0:00:00", "T",
1523 "EEEEE", "1970 01 02 0:00:00", "F",
1524 "EEEEE", "1970 01 03 0:00:00", "S",
729e4ab9 1525
73c04bcf
A
1526 "ccccc", "1970 01 04 0:00:00", "S",
1527 "ccccc", "1970 01 05 0:00:00", "M",
1528 "ccccc", "1970 01 06 0:00:00", "T",
1529 "ccccc", "1970 01 07 0:00:00", "W",
1530 "ccccc", "1970 01 01 0:00:00", "T",
1531 "ccccc", "1970 01 02 0:00:00", "F",
1532 "ccccc", "1970 01 03 0:00:00", "S",
1533 };
729e4ab9 1534
73c04bcf
A
1535 const char *CS_DATA[] = {
1536 "yyyy MM dd HH:mm:ss",
1537
1538 "yyyy LLLLL dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31",
1539 "yyyy MMMMM dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31",
729e4ab9 1540
73c04bcf
A
1541 "MMMMM", "1970 01 01 0:00:00", "l",
1542 "MMMMM", "1970 02 01 0:00:00", "\\u00FA",
1543 "MMMMM", "1970 03 01 0:00:00", "b",
1544 "MMMMM", "1970 04 01 0:00:00", "d",
1545 "MMMMM", "1970 05 01 0:00:00", "k",
1546 "MMMMM", "1970 06 01 0:00:00", "\\u010D",
1547 "MMMMM", "1970 07 01 0:00:00", "\\u010D",
1548 "MMMMM", "1970 08 01 0:00:00", "s",
1549 "MMMMM", "1970 09 01 0:00:00", "z",
1550 "MMMMM", "1970 10 01 0:00:00", "\\u0159",
1551 "MMMMM", "1970 11 01 0:00:00", "l",
1552 "MMMMM", "1970 12 01 0:00:00", "p",
729e4ab9 1553
73c04bcf
A
1554 "LLLLL", "1970 01 01 0:00:00", "l",
1555 "LLLLL", "1970 02 01 0:00:00", "\\u00FA",
1556 "LLLLL", "1970 03 01 0:00:00", "b",
1557 "LLLLL", "1970 04 01 0:00:00", "d",
1558 "LLLLL", "1970 05 01 0:00:00", "k",
1559 "LLLLL", "1970 06 01 0:00:00", "\\u010D",
1560 "LLLLL", "1970 07 01 0:00:00", "\\u010D",
1561 "LLLLL", "1970 08 01 0:00:00", "s",
1562 "LLLLL", "1970 09 01 0:00:00", "z",
1563 "LLLLL", "1970 10 01 0:00:00", "\\u0159",
1564 "LLLLL", "1970 11 01 0:00:00", "l",
1565 "LLLLL", "1970 12 01 0:00:00", "p",
1566
1567 "EEEEE", "1970 01 04 0:00:00", "N",
1568 "EEEEE", "1970 01 05 0:00:00", "P",
1569 "EEEEE", "1970 01 06 0:00:00", "\\u00DA",
1570 "EEEEE", "1970 01 07 0:00:00", "S",
1571 "EEEEE", "1970 01 01 0:00:00", "\\u010C",
1572 "EEEEE", "1970 01 02 0:00:00", "P",
1573 "EEEEE", "1970 01 03 0:00:00", "S",
1574
1575 "ccccc", "1970 01 04 0:00:00", "N",
1576 "ccccc", "1970 01 05 0:00:00", "P",
1577 "ccccc", "1970 01 06 0:00:00", "\\u00DA",
1578 "ccccc", "1970 01 07 0:00:00", "S",
1579 "ccccc", "1970 01 01 0:00:00", "\\u010C",
1580 "ccccc", "1970 01 02 0:00:00", "P",
1581 "ccccc", "1970 01 03 0:00:00", "S",
1582 };
729e4ab9 1583
73c04bcf
A
1584 expectFormat(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1585 expectFormat(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", ""));
1586}
1587
1588void DateFormatTest::TestEras()
1589{
1590 const char *EN_DATA[] = {
1591 "yyyy MM dd",
1592
1593 "MMMM dd yyyy G", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
1594 "MMMM dd yyyy GG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
1595 "MMMM dd yyyy GGG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
1596 "MMMM dd yyyy GGGG", "fp", "1951 07 17", "July 17 1951 Anno Domini", "1951 07 17",
1597
1598 "MMMM dd yyyy G", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
1599 "MMMM dd yyyy GG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
1600 "MMMM dd yyyy GGG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
1601 "MMMM dd yyyy GGGG", "fp", "-438 07 17", "July 17 0439 Before Christ", "-438 07 17",
1602 };
729e4ab9 1603
73c04bcf
A
1604 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1605}
1606
1607void DateFormatTest::TestQuarters()
1608{
1609 const char *EN_DATA[] = {
1610 "yyyy MM dd",
1611
1612 "Q", "fp", "1970 01 01", "1", "1970 01 01",
1613 "QQ", "fp", "1970 04 01", "02", "1970 04 01",
1614 "QQQ", "fp", "1970 07 01", "Q3", "1970 07 01",
1615 "QQQQ", "fp", "1970 10 01", "4th quarter", "1970 10 01",
1616
1617 "q", "fp", "1970 01 01", "1", "1970 01 01",
1618 "qq", "fp", "1970 04 01", "02", "1970 04 01",
1619 "qqq", "fp", "1970 07 01", "Q3", "1970 07 01",
1620 "qqqq", "fp", "1970 10 01", "4th quarter", "1970 10 01",
1621 };
729e4ab9 1622
73c04bcf
A
1623 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1624}
1625
b75a7d8f
A
1626/**
1627 * Test parsing. Input is an array that starts with the following
1628 * header:
1629 *
1630 * [0] = pattern string to parse [i+2] with
1631 *
1632 * followed by test cases, each of which is 3 array elements:
1633 *
1634 * [i] = pattern, or NULL to reuse prior pattern
1635 * [i+1] = input string
1636 * [i+2] = expected parse result (parsed with pattern [0])
1637 *
1638 * If expect parse failure, then [i+2] should be NULL.
1639 */
1640void DateFormatTest::expectParse(const char** data, int32_t data_length,
1641 const Locale& loc) {
1642 const UDate FAIL = (UDate) -1;
1643 const UnicodeString FAIL_STR("parse failure");
1644 int32_t i = 0;
1645
1646 UErrorCode ec = U_ZERO_ERROR;
1647 SimpleDateFormat fmt("", loc, ec);
1648 SimpleDateFormat ref(data[i++], loc, ec);
1649 SimpleDateFormat gotfmt("G yyyy MM dd HH:mm:ss z", loc, ec);
1650 if (U_FAILURE(ec)) {
729e4ab9 1651 dataerrln("FAIL: SimpleDateFormat constructor - %s", u_errorName(ec));
b75a7d8f
A
1652 return;
1653 }
1654
1655 const char* currentPat = NULL;
1656 while (i<data_length) {
1657 const char* pattern = data[i++];
1658 const char* input = data[i++];
1659 const char* expected = data[i++];
1660
1661 ec = U_ZERO_ERROR;
1662 if (pattern != NULL) {
1663 fmt.applyPattern(pattern);
1664 currentPat = pattern;
1665 }
1666 UDate got = fmt.parse(input, ec);
1667 UnicodeString gotstr(FAIL_STR);
1668 if (U_FAILURE(ec)) {
1669 got = FAIL;
1670 } else {
1671 gotstr.remove();
1672 gotfmt.format(got, gotstr);
1673 }
1674
1675 UErrorCode ec2 = U_ZERO_ERROR;
1676 UDate exp = FAIL;
1677 UnicodeString expstr(FAIL_STR);
1678 if (expected != NULL) {
1679 expstr = expected;
1680 exp = ref.parse(expstr, ec2);
1681 if (U_FAILURE(ec2)) {
1682 // This only happens if expected is in wrong format --
1683 // should never happen once test is debugged.
1684 errln("FAIL: Internal test error");
1685 return;
1686 }
1687 }
1688
1689 if (got == exp) {
1690 logln((UnicodeString)"Ok: " + input + " x " +
729e4ab9 1691 currentPat + " => " + gotstr);
b75a7d8f
A
1692 } else {
1693 errln((UnicodeString)"FAIL: " + input + " x " +
1694 currentPat + " => " + gotstr + ", expected " +
1695 expstr);
1696 }
729e4ab9 1697 }
b75a7d8f
A
1698}
1699
374ca955
A
1700/**
1701 * Test formatting and parsing. Input is an array that starts
1702 * with the following header:
1703 *
1704 * [0] = pattern string to parse [i+2] with
1705 *
1706 * followed by test cases, each of which is 3 array elements:
1707 *
1708 * [i] = pattern, or null to reuse prior pattern
1709 * [i+1] = control string, either "fp", "pf", or "F".
1710 * [i+2..] = data strings
1711 *
1712 * The number of data strings depends on the control string.
1713 * Examples:
1714 * 1. "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.56", "2004 03 10 16:36:31.560",
1715 * 'f': Format date [i+2] (as parsed using pattern [0]) and expect string [i+3].
1716 * 'p': Parse string [i+3] and expect date [i+4].
1717 *
1718 * 2. "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567"
1719 * 'F': Format date [i+2] and expect string [i+3],
1720 * then parse string [i+3] and expect date [i+2].
1721 *
1722 * 3. "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.5670",
1723 * 'p': Parse string [i+2] and expect date [i+3].
1724 * 'f': Format date [i+3] and expect string [i+4].
1725 */
1726void DateFormatTest::expect(const char** data, int32_t data_length,
1727 const Locale& loc) {
1728 int32_t i = 0;
1729 UErrorCode ec = U_ZERO_ERROR;
1730 UnicodeString str, str2;
1731 SimpleDateFormat fmt("", loc, ec);
1732 SimpleDateFormat ref(data[i++], loc, ec);
1733 SimpleDateFormat univ("EE G yyyy MM dd HH:mm:ss.SSS z", loc, ec);
729e4ab9
A
1734 if (U_FAILURE(ec)) {
1735 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(ec));
1736 return;
1737 }
374ca955
A
1738
1739 UnicodeString currentPat;
1740 while (i<data_length) {
1741 const char* pattern = data[i++];
1742 if (pattern != NULL) {
1743 fmt.applyPattern(pattern);
1744 currentPat = pattern;
1745 }
1746
1747 const char* control = data[i++];
1748
1749 if (uprv_strcmp(control, "fp") == 0) {
1750 // 'f'
1751 const char* datestr = data[i++];
1752 const char* string = data[i++];
73c04bcf 1753 UDate date = ref.parse(ctou(datestr), ec);
374ca955
A
1754 if (!assertSuccess("parse", ec)) return;
1755 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
73c04bcf 1756 ctou(string),
374ca955
A
1757 fmt.format(date, str.remove()));
1758 // 'p'
1759 datestr = data[i++];
73c04bcf 1760 date = ref.parse(ctou(datestr), ec);
374ca955 1761 if (!assertSuccess("parse", ec)) return;
73c04bcf 1762 UDate parsedate = fmt.parse(ctou(string), ec);
374ca955
A
1763 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1764 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1765 univ.format(date, str.remove()),
1766 univ.format(parsedate, str2.remove()));
1767 }
1768 }
1769
1770 else if (uprv_strcmp(control, "pf") == 0) {
1771 // 'p'
1772 const char* string = data[i++];
1773 const char* datestr = data[i++];
73c04bcf 1774 UDate date = ref.parse(ctou(datestr), ec);
374ca955 1775 if (!assertSuccess("parse", ec)) return;
73c04bcf 1776 UDate parsedate = fmt.parse(ctou(string), ec);
374ca955
A
1777 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1778 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1779 univ.format(date, str.remove()),
1780 univ.format(parsedate, str2.remove()));
1781 }
1782 // 'f'
1783 string = data[i++];
1784 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
73c04bcf 1785 ctou(string),
374ca955
A
1786 fmt.format(date, str.remove()));
1787 }
1788
1789 else if (uprv_strcmp(control, "F") == 0) {
1790 const char* datestr = data[i++];
1791 const char* string = data[i++];
73c04bcf 1792 UDate date = ref.parse(ctou(datestr), ec);
374ca955
A
1793 if (!assertSuccess("parse", ec)) return;
1794 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
73c04bcf 1795 ctou(string),
374ca955
A
1796 fmt.format(date, str.remove()));
1797
1798 UDate parsedate = fmt.parse(string, ec);
1799 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1800 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1801 univ.format(date, str.remove()),
1802 univ.format(parsedate, str2.remove()));
1803 }
1804 }
1805
1806 else {
1807 errln((UnicodeString)"FAIL: Invalid control string " + control);
1808 return;
1809 }
1810 }
1811}
1812
73c04bcf
A
1813/**
1814 * Test formatting. Input is an array that starts
1815 * with the following header:
1816 *
1817 * [0] = pattern string to parse [i+2] with
1818 *
1819 * followed by test cases, each of which is 3 array elements:
1820 *
1821 * [i] = pattern, or null to reuse prior pattern
1822 * [i+1] = data string a
1823 * [i+2] = data string b
1824 *
1825 * Examples:
1826 * Format date [i+1] and expect string [i+2].
1827 *
1828 * "y/M/d H:mm:ss.SSSS", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567"
1829 */
1830void DateFormatTest::expectFormat(const char** data, int32_t data_length,
1831 const Locale& loc) {
1832 int32_t i = 0;
1833 UErrorCode ec = U_ZERO_ERROR;
1834 UnicodeString str, str2;
1835 SimpleDateFormat fmt("", loc, ec);
1836 SimpleDateFormat ref(data[i++], loc, ec);
1837 SimpleDateFormat univ("EE G yyyy MM dd HH:mm:ss.SSS z", loc, ec);
729e4ab9
A
1838 if (U_FAILURE(ec)) {
1839 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(ec));
1840 return;
1841 }
73c04bcf
A
1842
1843 UnicodeString currentPat;
1844
1845 while (i<data_length) {
1846 const char* pattern = data[i++];
1847 if (pattern != NULL) {
1848 fmt.applyPattern(pattern);
1849 currentPat = pattern;
1850 }
1851
1852 const char* datestr = data[i++];
1853 const char* string = data[i++];
1854 UDate date = ref.parse(ctou(datestr), ec);
1855 if (!assertSuccess("parse", ec)) return;
1856 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1857 ctou(string),
1858 fmt.format(date, str.remove()));
1859 }
1860}
1861
1862void DateFormatTest::TestGenericTime() {
1863 // any zone pattern should parse any zone
1864 const Locale en("en");
1865 const char* ZDATA[] = {
1866 "yyyy MM dd HH:mm zzz",
1867 // round trip
1868 "y/M/d H:mm zzzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Standard Time",
1869 "y/M/d H:mm zzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",
1870 "y/M/d H:mm vvvv", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",
46f4442e 1871 "y/M/d H:mm v", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PT",
73c04bcf
A
1872 // non-generic timezone string influences dst offset even if wrong for date/time
1873 "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 PST",
1874 "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 Pacific Time",
1875 "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 PDT",
1876 "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 Pacific Time",
1877 // generic timezone generates dst offset appropriate for local time
1878 "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",
1879 "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",
1880 "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT",
1881 "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time",
1882 // daylight savings time transition edge cases.
1883 // time to parse does not really exist, PT interpreted as earlier time
46f4442e 1884 "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT",
73c04bcf
A
1885 "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT",
1886 "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PST",
46f4442e
A
1887 "y/M/d H:mm v", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT",
1888 "y/M/d H:mm v", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT",
1889 "y/M/d H:mm v", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PT",
1890 "y/M/d H:mm", "pf", "2005/4/3 2:30", "2005 04 03 03:30 PDT", "2005/4/3 3:30",
1891 // time to parse is ambiguous, PT interpreted as later time
1892 "y/M/d H:mm zzz", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PST",
1893 "y/M/d H:mm v", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PT",
1894 "y/M/d H:mm", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30",
1895
1896 "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST",
73c04bcf
A
1897 "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST",
1898 "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PDT",
46f4442e
A
1899 "y/M/d H:mm v", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT",
1900 "y/M/d H:mm v", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT",
1901 "y/M/d H:mm v", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PT",
1902 "y/M/d H:mm", "pf", "2004/10/31 1:30", "2004 10 31 01:30 PST", "2004/10/31 1:30",
73c04bcf
A
1903 };
1904 const int32_t ZDATA_length = sizeof(ZDATA)/ sizeof(ZDATA[0]);
1905 expect(ZDATA, ZDATA_length, en);
1906
1907 UErrorCode status = U_ZERO_ERROR;
1908
1909 logln("cross format/parse tests");
1910 UnicodeString basepat("yy/MM/dd H:mm ");
729e4ab9 1911 SimpleDateFormat formats[] = {
73c04bcf
A
1912 SimpleDateFormat(basepat + "vvv", en, status),
1913 SimpleDateFormat(basepat + "vvvv", en, status),
1914 SimpleDateFormat(basepat + "zzz", en, status),
1915 SimpleDateFormat(basepat + "zzzz", en, status)
1916 };
729e4ab9
A
1917 if (U_FAILURE(status)) {
1918 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(status));
1919 return;
1920 }
73c04bcf
A
1921 const int32_t formats_length = sizeof(formats)/sizeof(formats[0]);
1922
1923 UnicodeString test;
1924 SimpleDateFormat univ("yyyy MM dd HH:mm zzz", en, status);
1925 ASSERT_OK(status);
729e4ab9
A
1926 const UnicodeString times[] = {
1927 "2004 01 02 03:04 PST",
1928 "2004 07 08 09:10 PDT"
73c04bcf
A
1929 };
1930 int32_t times_length = sizeof(times)/sizeof(times[0]);
1931 for (int i = 0; i < times_length; ++i) {
1932 UDate d = univ.parse(times[i], status);
1933 logln(UnicodeString("\ntime: ") + d);
1934 for (int j = 0; j < formats_length; ++j) {
1935 test.remove();
1936 formats[j].format(d, test);
1937 logln("\ntest: '" + test + "'");
1938 for (int k = 0; k < formats_length; ++k) {
1939 UDate t = formats[k].parse(test, status);
1940 if (U_SUCCESS(status)) {
1941 if (d != t) {
729e4ab9
A
1942 errln((UnicodeString)"FAIL: format " + k +
1943 " incorrectly parsed output of format " + j +
73c04bcf
A
1944 " (" + test + "), returned " +
1945 dateToString(t) + " instead of " + dateToString(d));
1946 } else {
1947 logln((UnicodeString)"OK: format " + k + " parsed ok");
1948 }
1949 } else if (status == U_PARSE_ERROR) {
729e4ab9
A
1950 errln((UnicodeString)"FAIL: format " + k +
1951 " could not parse output of format " + j +
73c04bcf
A
1952 " (" + test + ")");
1953 }
1954 }
1955 }
1956 }
1957}
1958
1959void DateFormatTest::TestGenericTimeZoneOrder() {
1960 // generic times should parse the same no matter what the placement of the time zone string
1961 // should work for standard and daylight times
1962
1963 const char* XDATA[] = {
1964 "yyyy MM dd HH:mm zzz",
1965 // standard time, explicit daylight/standard
1966 "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",
1967 "y/M/d zzz H:mm", "pf", "2004/1/1 PT 1:00", "2004 01 01 01:00 PST", "2004/1/1 PST 1:00",
1968 "zzz y/M/d H:mm", "pf", "PT 2004/1/1 1:00", "2004 01 01 01:00 PST", "PST 2004/1/1 1:00",
1969
1970 // standard time, generic
1971 "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",
1972 "y/M/d vvvv H:mm", "pf", "2004/1/1 PT 1:00", "2004 01 01 01:00 PST", "2004/1/1 Pacific Time 1:00",
1973 "vvvv y/M/d H:mm", "pf", "PT 2004/1/1 1:00", "2004 01 01 01:00 PST", "Pacific Time 2004/1/1 1:00",
1974
1975 // dahylight time, explicit daylight/standard
1976 "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT",
1977 "y/M/d zzz H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 PDT 1:00",
1978 "zzz y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "PDT 2004/7/1 1:00",
1979
1980 // daylight time, generic
1981 "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time",
1982 "y/M/d vvvv H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 Pacific Time 1:00",
1983 "vvvv y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "Pacific Time 2004/7/1 1:00",
1984 };
1985 const int32_t XDATA_length = sizeof(XDATA)/sizeof(XDATA[0]);
1986 Locale en("en");
1987 expect(XDATA, XDATA_length, en);
1988}
1989
46f4442e
A
1990void DateFormatTest::TestZTimeZoneParsing(void) {
1991 UErrorCode status = U_ZERO_ERROR;
1992 const Locale en("en");
1993 UnicodeString test;
1994 //SimpleDateFormat univ("yyyy-MM-dd'T'HH:mm Z", en, status);
1995 SimpleDateFormat univ("HH:mm Z", en, status);
729e4ab9 1996 if (failure(status, "construct SimpleDateFormat", TRUE)) return;
46f4442e
A
1997 const TimeZone *t = TimeZone::getGMT();
1998 univ.setTimeZone(*t);
729e4ab9 1999
46f4442e
A
2000 univ.setLenient(false);
2001 ParsePosition pp(0);
46f4442e
A
2002 struct {
2003 UnicodeString input;
2004 UnicodeString expected_result;
2005 } tests[] = {
2006 { "11:00 -0200", "13:00 +0000" },
2007 { "11:00 +0200", "09:00 +0000" },
2008 { "11:00 +0400", "07:00 +0000" },
2009 { "11:00 +0530", "05:30 +0000" }
2010 };
2011
2012 UnicodeString result;
2013 int32_t tests_length = sizeof(tests)/sizeof(tests[0]);
2014 for (int i = 0; i < tests_length; ++i) {
2015 pp.setIndex(0);
2016 UDate d = univ.parse(tests[i].input, pp);
2017 if(pp.getIndex() != tests[i].input.length()){
2018 errln("Test %i: setZoneString() did not succeed. Consumed: %i instead of %i",
2019 i, pp.getIndex(), tests[i].input.length());
2020 return;
729e4ab9 2021 }
46f4442e
A
2022 result.remove();
2023 univ.format(d, result);
2024 if(result != tests[i].expected_result) {
2025 errln("Expected " + tests[i].expected_result
2026 + " got " + result);
2027 return;
2028 }
2029 logln("SUCCESS: Parsed " + tests[i].input
2030 + " got " + result
2031 + " expected " + tests[i].expected_result);
2032 }
2033}
2034
2035void DateFormatTest::TestHost(void)
2036{
2037#ifdef U_WINDOWS
2038 Win32DateTimeTest::testLocales(this);
2039#endif
2040}
2041
2042// Relative Date Tests
2043
729e4ab9 2044void DateFormatTest::TestRelative(int daysdelta,
46f4442e
A
2045 const Locale& loc,
2046 const char *expectChars) {
2047 char banner[25];
2048 sprintf(banner, "%d", daysdelta);
2049 UnicodeString bannerStr(banner, "");
729e4ab9 2050
46f4442e 2051 UErrorCode status = U_ZERO_ERROR;
729e4ab9 2052
46f4442e
A
2053 FieldPosition pos(0);
2054 UnicodeString test;
2055 Locale en("en");
2056 DateFormat *fullrelative = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
2057
2058 if (fullrelative == NULL) {
729e4ab9 2059 dataerrln("DateFormat::createDateInstance(DateFormat::kFullRelative, %s) returned NULL", loc.getName());
46f4442e
A
2060 return;
2061 }
2062
2063 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFull , loc);
729e4ab9 2064
46f4442e
A
2065 if (full == NULL) {
2066 errln("DateFormat::createDateInstance(DateFormat::kFull, %s) returned NULL", loc.getName());
2067 return;
2068 }
729e4ab9 2069
46f4442e 2070 DateFormat *en_full = DateFormat::createDateInstance(DateFormat::kFull, en);
729e4ab9 2071
46f4442e
A
2072 if (en_full == NULL) {
2073 errln("DateFormat::createDateInstance(DateFormat::kFull, en) returned NULL");
2074 return;
2075 }
729e4ab9 2076
46f4442e 2077 DateFormat *en_fulltime = DateFormat::createDateTimeInstance(DateFormat::kFull,DateFormat::kFull,en);
729e4ab9 2078
46f4442e
A
2079 if (en_fulltime == NULL) {
2080 errln("DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, en) returned NULL");
73c04bcf
A
2081 return;
2082 }
729e4ab9 2083
46f4442e
A
2084 UnicodeString result;
2085 UnicodeString normalResult;
2086 UnicodeString expect;
2087 UnicodeString parseResult;
729e4ab9 2088
46f4442e
A
2089 Calendar *c = Calendar::createInstance(status);
2090
2091 // Today = Today
2092 c->setTime(Calendar::getNow(), status);
2093 if(daysdelta != 0) {
2094 c->add(Calendar::DATE,daysdelta,status);
2095 }
2096 ASSERT_OK(status);
2097
2098 // calculate the expected string
2099 if(expectChars != NULL) {
2100 expect = expectChars;
2101 } else {
2102 full->format(*c, expect, pos); // expected = normal full
2103 }
729e4ab9 2104
46f4442e
A
2105 fullrelative ->format(*c, result, pos);
2106 en_full ->format(*c, normalResult, pos);
729e4ab9 2107
46f4442e
A
2108 if(result != expect) {
2109 errln("FAIL: Relative Format ["+bannerStr+"] of "+normalResult+" failed, expected "+expect+" but got " + result);
2110 } else {
2111 logln("PASS: Relative Format ["+bannerStr+"] of "+normalResult+" got " + result);
2112 }
729e4ab9
A
2113
2114
46f4442e
A
2115 //verify
2116 UDate d = fullrelative->parse(result, status);
73c04bcf 2117 ASSERT_OK(status);
729e4ab9 2118
46f4442e
A
2119 UnicodeString parseFormat; // parse rel->format full
2120 en_full->format(d, parseFormat, status);
729e4ab9 2121
46f4442e
A
2122 UnicodeString origFormat;
2123 en_full->format(*c, origFormat, pos);
729e4ab9 2124
46f4442e
A
2125 if(parseFormat!=origFormat) {
2126 errln("FAIL: Relative Parse ["+bannerStr+"] of "+result+" failed, expected "+parseFormat+" but got "+origFormat);
2127 } else {
2128 logln("PASS: Relative Parse ["+bannerStr+"] of "+result+" passed, got "+parseFormat);
2129 }
2130
2131 delete full;
2132 delete fullrelative;
2133 delete en_fulltime;
2134 delete en_full;
2135 delete c;
2136}
2137
2138
2139void DateFormatTest::TestRelative(void)
2140{
2141 Locale en("en");
2142 TestRelative( 0, en, "Today");
2143 TestRelative(-1, en, "Yesterday");
2144 TestRelative( 1, en, "Tomorrow");
2145 TestRelative( 2, en, NULL);
2146 TestRelative( -2, en, NULL);
2147 TestRelative( 3, en, NULL);
2148 TestRelative( -3, en, NULL);
2149 TestRelative( 300, en, NULL);
2150 TestRelative( -300, en, NULL);
2151}
2152
2153void DateFormatTest::TestRelativeClone(void)
2154{
2155 /*
2156 Verify that a cloned formatter gives the same results
2157 and is useable after the original has been deleted.
2158 */
2159 UErrorCode status = U_ZERO_ERROR;
2160 Locale loc("en");
2161 UDate now = Calendar::getNow();
2162 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
2163 if (full == NULL) {
729e4ab9 2164 dataerrln("FAIL: Can't create Relative date instance");
46f4442e 2165 return;
73c04bcf 2166 }
46f4442e
A
2167 UnicodeString result1;
2168 full->format(now, result1, status);
2169 Format *fullClone = full->clone();
2170 delete full;
2171 full = NULL;
73c04bcf 2172
46f4442e
A
2173 UnicodeString result2;
2174 fullClone->format(now, result2, status);
2175 ASSERT_OK(status);
2176 if (result1 != result2) {
2177 errln("FAIL: Clone returned different result from non-clone.");
73c04bcf 2178 }
46f4442e
A
2179 delete fullClone;
2180}
2181
2182void DateFormatTest::TestHostClone(void)
2183{
2184 /*
2185 Verify that a cloned formatter gives the same results
2186 and is useable after the original has been deleted.
2187 */
2188 // This is mainly important on Windows.
2189 UErrorCode status = U_ZERO_ERROR;
2190 Locale loc("en_US@compat=host");
2191 UDate now = Calendar::getNow();
2192 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFull, loc);
2193 if (full == NULL) {
729e4ab9 2194 dataerrln("FAIL: Can't create Relative date instance");
73c04bcf
A
2195 return;
2196 }
46f4442e
A
2197 UnicodeString result1;
2198 full->format(now, result1, status);
2199 Format *fullClone = full->clone();
2200 delete full;
2201 full = NULL;
2202
2203 UnicodeString result2;
2204 fullClone->format(now, result2, status);
2205 ASSERT_OK(status);
2206 if (result1 != result2) {
2207 errln("FAIL: Clone returned different result from non-clone.");
2208 }
2209 delete fullClone;
2210}
2211
2212void DateFormatTest::TestTimeZoneDisplayName()
2213{
2214 // This test data was ported from ICU4J. Don't know why the 6th column in there because it's not being
2215 // used currently.
2216 const char *fallbackTests[][6] = {
2217 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2218 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
2219 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" },
2220 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
2221 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "Pacific Standard Time", "America/Los_Angeles" },
2222 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2223 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2224 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" },
2225 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
2226 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "Pacific Daylight Time", "America/Los_Angeles" },
2227 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" },
2228 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Pacific Time", "America/Los_Angeles" },
2229 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "United States (Los Angeles)", "America/Los_Angeles" },
2230 { "en_GB", "America/Los_Angeles", "2004-01-15T12:00:00Z", "z", "PST", "America/Los_Angeles" },
2231 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "Z", "-0700", "-7:00" },
2232 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2233 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "z", "MST", "America/Phoenix" },
2234 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "V", "MST", "America/Phoenix" },
2235 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" },
2236 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2237 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2238 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "z", "MST", "America/Phoenix" },
2239 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "V", "MST", "America/Phoenix" },
2240 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" },
2241 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "v", "MST", "America/Phoenix" },
2242 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "vvvv", "Mountain Standard Time", "America/Phoenix" },
2243 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "VVVV", "United States (Phoenix)", "America/Phoenix" },
2244
2245 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2246 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2247 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2248 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "ART", "-3:00" },
2249 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
2250 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2251 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2252 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2253 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "ART", "-3:00" },
2254 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
2255 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
2256 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Time", "America/Buenos_Aires" },
2257 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
2258
2259 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2260 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2261 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2262 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "ART", "-3:00" },
2263 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
2264 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2265 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2266 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2267 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "ART", "-3:00" },
2268 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
2269 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
2270 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Time", "America/Buenos_Aires" },
2271 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
2272
2273 { "en", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2274 { "en", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
2275 { "en", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
2276 { "en", "America/Havana", "2004-01-15T00:00:00Z", "V", "CST (Cuba)", "-5:00" },
2277 { "en", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "Cuba Standard Time", "-5:00" },
2278 { "en", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2279 { "en", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
2280 { "en", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
2281 { "en", "America/Havana", "2004-07-15T00:00:00Z", "V", "CDT (Cuba)", "-4:00" },
2282 { "en", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "Cuba Daylight Time", "-4:00" },
2283 { "en", "America/Havana", "2004-07-15T00:00:00Z", "v", "Cuba Time", "America/Havana" },
2284 { "en", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Cuba Time", "America/Havana" },
2285 { "en", "America/Havana", "2004-07-15T00:00:00Z", "VVVV", "Cuba Time", "America/Havana" },
2286
2287 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2288 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2289 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2290 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" },
2291 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" },
2292 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2293 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2294 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2295 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" },
2296 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" },
2297 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australia (Sydney)", "Australia/Sydney" },
2298 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" },
2299 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "VVVV", "Australia (Sydney)", "Australia/Sydney" },
2300
2301 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2302 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2303 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2304 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" },
2305 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" },
2306 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2307 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2308 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2309 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" },
2310 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" },
2311 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australia (Sydney)", "Australia/Sydney" },
2312 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" },
2313 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "VVVV", "Australia (Sydney)", "Australia/Sydney" },
2314
2315 { "en", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2316 { "en", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
2317 { "en", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" },
2318 { "en", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
2319 { "en", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "Greenwich Mean Time", "+0:00" },
2320 { "en", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2321 { "en", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
2322 { "en", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "Europe/London" },
2323 { "en", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "Europe/London" },
2324 { "en", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "British Summer Time", "Europe/London" },
2325 // icu en.txt has exemplar city for this time zone
2326 { "en", "Europe/London", "2004-07-15T00:00:00Z", "v", "United Kingdom Time", "Europe/London" },
2327 { "en", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "United Kingdom Time", "Europe/London" },
2328 { "en", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "United Kingdom Time", "Europe/London" },
2329
2330 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2331 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2332 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2333 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2334 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2335 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2336 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2337 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2338 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
2339 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
2340
2341 // JB#5150
2342 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2343 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2344 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
2345 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "V", "IST", "+5:30" },
2346 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" },
2347 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2348 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2349 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
2350 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "V", "IST", "+05:30" },
2351 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" },
2352 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "India Time", "Asia/Calcutta" },
2353 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "India Standard Time", "Asia/Calcutta" },
729e4ab9 2354
46f4442e
A
2355 // ==========
2356
2357 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2358 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
2359 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" },
2360 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" },
2361 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2362 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2363 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" },
2364 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" },
2365 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "Vereinigte Staaten (Los Angeles)", "America/Los_Angeles" },
2366 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Vereinigte Staaten (Los Angeles)", "America/Los_Angeles" },
2367
2368 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2369 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2370 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2371 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2372 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2373 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2374 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2375 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2376 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
2377 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
2378
2379 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2380 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2381 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2382 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2383 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2384 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2385 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2386 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2387 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
2388 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
2389
2390 { "de", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2391 { "de", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
2392 { "de", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
2393 { "de", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },
2394 { "de", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2395 { "de", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
2396 { "de", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
2397 { "de", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },
729e4ab9
A
2398 { "de", "America/Havana", "2004-07-15T00:00:00Z", "v", "(Kuba)", "America/Havana" },
2399 { "de", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "(Kuba)", "America/Havana" },
46f4442e 2400 // added to test proper fallback of country name
729e4ab9
A
2401 { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "v", "(Kuba)", "America/Havana" },
2402 { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "(Kuba)", "America/Havana" },
46f4442e
A
2403
2404 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2405 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2406 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2407 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2408 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2409 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2410 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2411 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2412 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australien (Sydney)", "Australia/Sydney" },
2413 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Australien (Sydney)", "Australia/Sydney" },
2414
2415 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2416 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2417 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2418 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2419 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2420 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2421 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2422 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2423 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australien (Sydney)", "Australia/Sydney" },
2424 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Australien (Sydney)", "Australia/Sydney" },
2425
2426 { "de", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2427 { "de", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
2428 { "de", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },
2429 { "de", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+00:00", "+0:00" },
2430 { "de", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2431 { "de", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
2432 { "de", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },
2433 { "de", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },
729e4ab9
A
2434 { "de", "Europe/London", "2004-07-15T00:00:00Z", "v", "(Vereinigtes K\\u00f6nigreich)", "Europe/London" },
2435 { "de", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "(Vereinigtes K\\u00f6nigreich)", "Europe/London" },
46f4442e
A
2436
2437 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2438 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2439 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2440 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2441 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2442 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2443 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2444 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2445 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
2446 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
2447
2448 // JB#5150
2449 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2450 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2451 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
2452 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
2453 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2454 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2455 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
2456 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
729e4ab9
A
2457 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "(Indien)", "Asia/Calcutta" },
2458 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "(Indien)", "Asia/Calcutta" },
46f4442e
A
2459
2460 // ==========
2461
2462 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2463 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800", "-8:00" },
2464 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800", "America/Los_Angeles" },
2465 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u592a\\u5e73\\u6d0b\\u6807\\u51c6\\u65f6\\u95f4", "America/Los_Angeles" },
2466 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2467 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0700", "-7:00" },
2468 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0700", "America/Los_Angeles" },
2469 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\\u592a\\u5e73\\u6d0b\\u590f\\u4ee4\\u65f6\\u95f4", "America/Los_Angeles" },
2470 // icu zh.txt has exemplar city for this time zone
2471 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)", "America/Los_Angeles" },
2472 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u7f8e\\u56fd\\u592a\\u5e73\\u6d0b\\u65f6\\u95f4", "America/Los_Angeles" },
2473
2474 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2475 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2476 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2477 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "-3:00" },
2478 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2479 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2480 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2481 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "-3:00" },
2482 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u963f\\u6839\\u5ef7 (\\u5e03\\u5b9c\\u8bfa\\u65af\\u827e\\u5229\\u65af)", "America/Buenos_Aires" },
2483 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "America/Buenos_Aires" },
2484
2485 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2486 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2487 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2488 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "-3:00" },
2489 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2490 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2491 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2492 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "-3:00" },
2493 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u963f\\u6839\\u5ef7 (\\u5e03\\u5b9c\\u8bfa\\u65af\\u827e\\u5229\\u65af)", "America/Buenos_Aires" },
2494 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "America/Buenos_Aires" },
2495
2496 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2497 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0500", "-5:00" },
2498 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0500", "-5:00" },
729e4ab9 2499 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "\\u53e4\\u5df4\\u6807\\u51c6\\u65f6\\u95f4", "-5:00" },
46f4442e
A
2500 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2501 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0400", "-4:00" },
2502 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0400", "-4:00" },
729e4ab9
A
2503 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "\\u53e4\\u5df4\\u590f\\u4ee4\\u65f6\\u95f4", "-4:00" },
2504 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u53e4\\u5df4\\u65f6\\u95f4", "America/Havana" },
2505 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u53e4\\u5df4\\u65f6\\u95f4", "America/Havana" },
46f4442e
A
2506
2507 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2508 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+1100", "+11:00" },
2509 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+1100", "+11:00" },
2510 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u590f\\u4ee4\\u65f6\\u95f4", "+11:00" },
2511 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2512 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+1000", "+10:00" },
2513 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+1000", "+10:00" },
2514 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u6807\\u51c6\\u65f6\\u95f4", "+10:00" },
2515 // icu zh.txt does not have info for this time zone
2516 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u6fb3\\u5927\\u5229\\u4e9a (\\u6089\\u5c3c)", "Australia/Sydney" },
2517 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u65f6\\u95f4", "Australia/Sydney" },
2518
2519 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2520 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+1100", "+11:00" },
2521 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+1100", "+11:00" },
2522 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u590f\\u4ee4\\u65f6\\u95f4", "+11:00" },
2523 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2524 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+1000", "+10:00" },
2525 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+1000", "+10:00" },
2526 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u6807\\u51c6\\u65f6\\u95f4", "+10:00" },
2527 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u6fb3\\u5927\\u5229\\u4e9a (\\u6089\\u5c3c)", "Australia/Sydney" },
2528 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u65f6\\u95f4", "Australia/Sydney" },
2529
2530 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2531 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0000", "+0:00" },
2532 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0000", "+0:00" },
2533 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
2534 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u683C\\u6797\\u5C3C\\u6CBB\\u6807\\u51C6\\u65F6\\u95F4", "+0:00" },
2535 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2536 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0100", "+1:00" },
2537 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0100", "+1:00" },
2538 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "+1:00" },
2539 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0100", "+1:00" },
729e4ab9
A
2540 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u82f1\\u56fd\\u65f6\\u95f4", "Europe/London" },
2541 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u82f1\\u56fd\\u65f6\\u95f4", "Europe/London" },
2542 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\\u82f1\\u56fd\\u65f6\\u95f4", "Europe/London" },
46f4442e
A
2543
2544 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2545 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2546 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2547 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2548 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2549 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2550 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2551 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2552 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2553 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0300", "-3:00" },
2554
2555 // JB#5150
2556 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2557 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0530", "+5:30" },
2558 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0530", "+5:30" },
2559 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u5370\\u5ea6\\u6807\\u51c6\\u65f6\\u95f4", "+5:30" },
2560 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2561 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0530", "+5:30" },
2562 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4+0530", "+05:30" },
2563 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u5370\\u5ea6\\u6807\\u51c6\\u65f6\\u95f4", "+5:30" },
729e4ab9 2564 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u5370\\u5ea6\\u65f6\\u95f4", "Asia/Calcutta" },
46f4442e
A
2565 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u5370\\u5ea6\\u6807\\u51c6\\u65f6\\u95f4", "Asia/Calcutta" },
2566
2567 // ==========
2568
2569 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2570 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u096e:\\u0966\\u0966", "-8:00" },
2571 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u096e:\\u0966\\u0966", "-8:00" },
2572 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u096e:\\u0966\\u0966", "-8:00" },
2573 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2574 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u096d:\\u0966\\u0966", "-7:00" },
2575 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u096d:\\u0966\\u0966", "-7:00" },
2576 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u096d:\\u0966\\u0966", "-7:00" },
729e4ab9
A
2577 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u0938\\u0902\\u092f\\u0941\\u0915\\u094d\\u0924 \\u0930\\u093e\\u091c\\u094d\\u092f \\u0905\\u092e\\u0947\\u0930\\u093f\\u0915\\u093e (\\u0932\\u094b\\u0938 \\u090f\\u0902\\u091c\\u093f\\u0932\\u0947\\u0938)", "America/Los_Angeles" },
2578 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u0938\\u0902\\u092f\\u0941\\u0915\\u094d\\u0924 \\u0930\\u093e\\u091c\\u094d\\u092f \\u0905\\u092e\\u0947\\u0930\\u093f\\u0915\\u093e (\\u0932\\u094b\\u0938 \\u090f\\u0902\\u091c\\u093f\\u0932\\u0947\\u0938)", "America/Los_Angeles" },
46f4442e
A
2579
2580 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2581 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2582 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2583 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2584 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2585 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2586 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2587 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2588 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0905\\u0930\\u094d\\u091c\\u0947\\u0928\\u094d\\u091f\\u0940\\u0928\\u093e (\\u092c\\u094d\\u092f\\u0942\\u0928\\u0938 \\u0906\\u092f\\u0930\\u0938)", "America/Buenos_Aires" },
2589 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0905\\u0930\\u094d\\u091c\\u0947\\u0928\\u094d\\u091f\\u0940\\u0928\\u093e (\\u092c\\u094d\\u092f\\u0942\\u0928\\u0938 \\u0906\\u092f\\u0930\\u0938)", "America/Buenos_Aires" },
2590
2591 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2592 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2593 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2594 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2595 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2596 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2597 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2598 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2599 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0905\\u0930\\u094d\\u091c\\u0947\\u0928\\u094d\\u091f\\u0940\\u0928\\u093e (\\u092c\\u094d\\u092f\\u0942\\u0928\\u0938 \\u0906\\u092f\\u0930\\u0938)", "America/Buenos_Aires" },
2600 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0905\\u0930\\u094d\\u091c\\u0947\\u0928\\u094d\\u091f\\u0940\\u0928\\u093e (\\u092c\\u094d\\u092f\\u0942\\u0928\\u0938 \\u0906\\u092f\\u0930\\u0938)", "America/Buenos_Aires" },
2601
2602 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2603 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u096b:\\u0966\\u0966", "-5:00" },
2604 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u096b:\\u0966\\u0966", "-5:00" },
2605 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u096b:\\u0966\\u0966", "-5:00" },
2606 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2607 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u096a:\\u0966\\u0966", "-4:00" },
2608 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u096a:\\u0966\\u0966", "-4:00" },
2609 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u096a:\\u0966\\u0966", "-4:00" },
729e4ab9
A
2610 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "v", "(\\u0915\\u094d\\u092f\\u0942\\u092c\\u093e)", "America/Havana" },
2611 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "(\\u0915\\u094d\\u092f\\u0942\\u092c\\u093e)", "America/Havana" },
46f4442e
A
2612
2613 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2614 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2615 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2616 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2617 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2618 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2619 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2620 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2621 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u0911\\u0938\\u094d\\u091f\\u094d\\u0930\\u0947\\u0932\\u093f\\u092f\\u093e (\\u0938\\u093f\\u0921\\u0928\\u0940)", "Australia/Sydney" },
2622 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u0911\\u0938\\u094d\\u091f\\u094d\\u0930\\u0947\\u0932\\u093f\\u092f\\u093e (\\u0938\\u093f\\u0921\\u0928\\u0940)", "Australia/Sydney" },
2623
2624 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2625 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2626 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2627 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2628 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2629 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2630 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2631 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2632 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u0911\\u0938\\u094d\\u091f\\u094d\\u0930\\u0947\\u0932\\u093f\\u092f\\u093e (\\u0938\\u093f\\u0921\\u0928\\u0940)", "Australia/Sydney" },
2633 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u0911\\u0938\\u094d\\u091f\\u094d\\u0930\\u0947\\u0932\\u093f\\u092f\\u093e (\\u0938\\u093f\\u0921\\u0928\\u0940)", "Australia/Sydney" },
2634
2635 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2636 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\\u0966\\u0966:\\u0966\\u0966", "+0:00" },
2637 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+\\u0966\\u0966:\\u0966\\u0966", "+0:00" },
2638 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+\\u0966\\u0966:\\u0966\\u0966", "+0:00" },
2639 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2640 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\\u0966\\u0967:\\u0966\\u0966", "+1:00" },
2641 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+\\u0966\\u0967:\\u0966\\u0966", "+1:00" },
2642 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+\\u0966\\u0967:\\u0966\\u0966", "+1:00" },
729e4ab9
A
2643 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "v", "(\\u092C\\u094D\\u0930\\u093F\\u0924\\u0928)", "Europe/London" },
2644 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "(\\u092C\\u094D\\u0930\\u093F\\u0924\\u0928)", "Europe/London" },
46f4442e
A
2645
2646 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2647 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2648 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2649 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2650 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2651 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2652 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2653 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2654 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2655 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2656
2657 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2658 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\\u0966\\u096B:\\u0969\\u0966", "+5:30" },
2659 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "IST", "+5:30" },
2660 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "+5:30" },
2661 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2662 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\\u0966\\u096B:\\u0969\\u0966", "+5:30" },
2663 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "IST", "+05:30" },
2664 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "+5:30" },
2665 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "IST", "Asia/Calcutta" },
2666 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "Asia/Calcutta" },
2667
2668 // ==========
2669
2670 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2671 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0800", "-8:00" },
2672 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0800", "America/Los_Angeles" },
2673 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
2674 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u0422\\u0438\\u0445\\u043E\\u043E\\u043A\\u0435\\u0430\\u043D\\u0441\\u043A\\u0430 \\u0447\\u0430\\u0441\\u043E\\u0432\\u0430 \\u0437\\u043E\\u043D\\u0430", "America/Los_Angeles" },
2675 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2676 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0700", "-7:00" },
2677 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0700", "America/Los_Angeles" },
2678 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
2679 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\\u0422\\u0438\\u0445\\u043E\\u043E\\u043A\\u0435\\u0430\\u043D\\u0441\\u043A\\u0430 \\u043B\\u044F\\u0442\\u043D\\u0430 \\u0447\\u0430\\u0441\\u043E\\u0432\\u0430 \\u0437\\u043E\\u043D\\u0430", "America/Los_Angeles" },
2680 // icu bg.txt has exemplar city for this time zone
2681 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u0421\\u0410\\u0429 (\\u041b\\u043e\\u0441 \\u0410\\u043d\\u0436\\u0435\\u043b\\u0438\\u0441)", "America/Los_Angeles" },
2682 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u0421\\u0410\\u0429 (\\u041b\\u043e\\u0441 \\u0410\\u043d\\u0436\\u0435\\u043b\\u0438\\u0441)", "America/Los_Angeles" },
2683 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\\u0421\\u0410\\u0429 (\\u041b\\u043e\\u0441 \\u0410\\u043d\\u0436\\u0435\\u043b\\u0438\\u0441)", "America/Los_Angeles" },
2684
2685 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2686 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2687 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2688 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2689 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2690 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2691 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2692 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2693 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0410\\u0440\\u0436\\u0435\\u043d\\u0442\\u0438\\u043d\\u0430 (\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441)", "America/Buenos_Aires" },
2694 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0440\\u0436\\u0435\\u043d\\u0442\\u0438\\u043d\\u0430 (\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441)", "America/Buenos_Aires" },
2695
2696 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2697 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2698 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2699 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2700 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2701 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2702 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2703 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2704 // icu bg.txt does not have info for this time zone
2705 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0410\\u0440\\u0436\\u0435\\u043d\\u0442\\u0438\\u043d\\u0430 (\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441)", "America/Buenos_Aires" },
2706 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0440\\u0436\\u0435\\u043d\\u0442\\u0438\\u043d\\u0430 (\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441)", "America/Buenos_Aires" },
2707
2708 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2709 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0500", "-5:00" },
2710 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0500", "-5:00" },
2711 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0500", "-5:00" },
2712 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2713 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0400", "-4:00" },
2714 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0400", "-4:00" },
2715 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0400", "-4:00" },
729e4ab9
A
2716 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "v", "(\\u041a\\u0443\\u0431\\u0430)", "America/Havana" },
2717 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "(\\u041a\\u0443\\u0431\\u0430)", "America/Havana" },
46f4442e
A
2718
2719 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2720 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" },
2721 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" },
2722 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" },
2723 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2724 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" },
2725 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" },
2726 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" },
2727 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043b\\u0438\\u044f (\\u0421\\u0438\\u0434\\u043D\\u0438)", "Australia/Sydney" },
2728 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043b\\u0438\\u044f (\\u0421\\u0438\\u0434\\u043D\\u0438)", "Australia/Sydney" },
2729
2730 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2731 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" },
2732 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" },
2733 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" },
2734 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2735 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" },
2736 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" },
2737 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" },
2738 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043b\\u0438\\u044f (\\u0421\\u0438\\u0434\\u043D\\u0438)", "Australia/Sydney" },
2739 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043b\\u0438\\u044f (\\u0421\\u0438\\u0434\\u043D\\u0438)", "Australia/Sydney" },
2740
2741 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2742 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0000", "+0:00" },
2743 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0000", "+0:00" },
2744 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u0427\\u0430\\u0441\\u043E\\u0432\\u0430 \\u0437\\u043E\\u043D\\u0430 \\u0413\\u0440\\u0438\\u043D\\u0443\\u0438\\u0447", "+0:00" },
2745 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2746 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0100", "+1:00" },
2747 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0100", "+1:00" },
2748 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0100", "+1:00" },
729e4ab9
A
2749 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "v", "(\\u041e\\u0431\\u0435\\u0434\\u0438\\u043d\\u0435\\u043d\\u043e \\u043a\\u0440\\u0430\\u043b\\u0441\\u0442\\u0432\\u043e)", "Europe/London" },
2750 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "(\\u041e\\u0431\\u0435\\u0434\\u0438\\u043d\\u0435\\u043d\\u043e \\u043a\\u0440\\u0430\\u043b\\u0441\\u0442\\u0432\\u043e)", "Europe/London" },
46f4442e
A
2751
2752 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2753 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2754 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2755 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2756 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2757 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2758 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2759 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2760 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2761 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" },
2762
2763 // JB#5150
2764 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2765 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+5:30" },
2766 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+5:30" },
2767 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+5:30" },
2768 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2769 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+5:30" },
2770 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+05:30" },
2771 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+5:30" },
729e4ab9
A
2772 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "(\\u0418\\u043D\\u0434\\u0438\\u044F)", "Asia/Calcutta" },
2773 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "(\\u0418\\u043D\\u0434\\u0438\\u044F)", "Asia/Calcutta" },
46f4442e
A
2774 // ==========
2775
2776 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2777 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
2778 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "America/Los_Angeles" },
2779 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
2780 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u30a2\\u30e1\\u30ea\\u30ab\\u592a\\u5e73\\u6d0b\\u6a19\\u6e96\\u6642", "America/Los_Angeles" },
2781 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-700" },
2782 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2783 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "America/Los_Angeles" },
2784 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
2785 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\\u30a2\\u30e1\\u30ea\\u30ab\\u592a\\u5e73\\u6d0b\\u590f\\u6642\\u9593", "America/Los_Angeles" },
2786 // icu ja.txt has exemplar city for this time zone
2787 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u30A2\\u30E1\\u30EA\\u30AB\\u5408\\u8846\\u56FD (\\u30ed\\u30b5\\u30f3\\u30bc\\u30eb\\u30b9)", "America/Los_Angeles" },
2788 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u30A2\\u30E1\\u30EA\\u30AB\\u592A\\u5e73\\u6D0B\\u6642\\u9593", "America/Los_Angeles" },
2789 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\\u30A2\\u30E1\\u30EA\\u30AB\\u5408\\u8846\\u56FD (\\u30ed\\u30b5\\u30f3\\u30bc\\u30eb\\u30b9)", "America/Los_Angeles" },
2790
2791 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2792 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2793 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2794 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2795 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2796 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2797 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2798 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2799 // icu ja.txt does not have info for this time zone
2800 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u30a2\\u30eb\\u30bc\\u30f3\\u30c1\\u30f3 (\\u30D6\\u30A8\\u30CE\\u30B9\\u30A2\\u30A4\\u30EC\\u30B9)", "America/Buenos_Aires" },
2801 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u30a2\\u30eb\\u30bc\\u30f3\\u30c1\\u30f3\\u6642\\u9593", "America/Buenos_Aires" },
2802
2803 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2804 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2805 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2806 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2807 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2808 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2809 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2810 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2811 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u30a2\\u30eb\\u30bc\\u30f3\\u30c1\\u30f3 (\\u30D6\\u30A8\\u30CE\\u30B9\\u30A2\\u30A4\\u30EC\\u30B9)", "America/Buenos_Aires" },
2812 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u30a2\\u30eb\\u30bc\\u30f3\\u30c1\\u30f3\\u6642\\u9593", "America/Buenos_Aires" },
2813
2814 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2815 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
2816 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
2817 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },
2818 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2819 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
2820 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
2821 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },
2822 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u30ad\\u30e5\\u30fc\\u30d0\\u6642\\u9593", "America/Havana" },
2823 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u30ad\\u30e5\\u30fc\\u30d0\\u6642\\u9593", "America/Havana" },
2824
2825 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2826 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2827 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2828 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2829 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2830 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2831 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2832 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2833 // icu ja.txt does not have info for this time zone
2834 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u30aa\\u30fc\\u30b9\\u30c8\\u30e9\\u30ea\\u30a2 (\\u30b7\\u30c9\\u30cb\\u30fc)", "Australia/Sydney" },
2835 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u30aa\\u30fc\\u30b9\\u30c8\\u30e9\\u30ea\\u30a2 (\\u30b7\\u30c9\\u30cb\\u30fc)", "Australia/Sydney" },
2836
2837 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2838 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2839 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2840 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2841 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2842 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2843 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2844 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2845 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u30aa\\u30fc\\u30b9\\u30c8\\u30e9\\u30ea\\u30a2 (\\u30b7\\u30c9\\u30cb\\u30fc)", "Australia/Sydney" },
2846 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u30aa\\u30fc\\u30b9\\u30c8\\u30e9\\u30ea\\u30a2 (\\u30b7\\u30c9\\u30cb\\u30fc)", "Australia/Sydney" },
2847
2848 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2849 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
2850 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },
2851 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
2852 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u30B0\\u30EA\\u30CB\\u30C3\\u30B8\\u6A19\\u6E96\\u6642", "+0:00" },
2853 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2854 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
2855 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },
2856 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "V", "GMT+01:00", "+1:00" },
2857 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },
2858 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" },
2859 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" },
2860 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" },
2861
2862 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2863 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2864 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2865 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2866 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2867 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2868 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2869 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2870 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
2871 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
2872
2873 // JB#5150
2874 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2875 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2876 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
2877 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
2878 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2879 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2880 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
2881 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
2882 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u30A4\\u30F3\\u30C9\\u6642\\u9593", "Asia/Calcutta" },
2883 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u30A4\\u30F3\\u30C9\\u6642\\u9593", "Asia/Calcutta" },
2884
2885 // ==========
2886
2887 { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2888 { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
2889 { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" },
2890 { "si", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" },
2891 { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2892 { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2893 { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" },
2894 { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" },
2895 { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "US (Los Angeles)", "America/Los_Angeles" },
2896 { "si", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "US (Los Angeles)", "America/Los_Angeles" },
2897
2898 { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2899 { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2900 { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2901 { "si", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2902 { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2903 { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2904 { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2905 { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2906 { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "AR (Buenos Aires)", "America/Buenos_Aires" },
2907 { "si", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "AR (Buenos Aires)", "America/Buenos_Aires" },
2908
2909 { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2910 { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2911 { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2912 { "si", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2913 { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2914 { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2915 { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2916 { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2917 { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "AR (Buenos Aires)", "America/Buenos_Aires" },
2918 { "si", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "AR (Buenos Aires)", "America/Buenos_Aires" },
2919
2920 { "si", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2921 { "si", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
2922 { "si", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
2923 { "si", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },
2924 { "si", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2925 { "si", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
2926 { "si", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
2927 { "si", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },
729e4ab9
A
2928 { "si", "America/Havana", "2004-07-15T00:00:00Z", "v", "(CU)", "America/Havana" },
2929 { "si", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "(CU)", "America/Havana" },
46f4442e
A
2930
2931 { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2932 { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2933 { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2934 { "si", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2935 { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2936 { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2937 { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2938 { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2939 { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "AU (Sydney)", "Australia/Sydney" },
2940 { "si", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "AU (Sydney)", "Australia/Sydney" },
2941
2942 { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2943 { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2944 { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2945 { "si", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2946 { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2947 { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2948 { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2949 { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2950 { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "AU (Sydney)", "Australia/Sydney" },
2951 { "si", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "AU (Sydney)", "Australia/Sydney" },
2952
2953 { "si", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2954 { "si", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
2955 { "si", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },
2956 { "si", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+00:00", "+0:00" },
2957 { "si", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2958 { "si", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
2959 { "si", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },
2960 { "si", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },
729e4ab9
A
2961 { "si", "Europe/London", "2004-07-15T00:00:00Z", "v", "(GB)", "Europe/London" },
2962 { "si", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "(GB)", "Europe/London" },
46f4442e
A
2963
2964 { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2965 { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2966 { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2967 { "si", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2968 { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2969 { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2970 { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2971 { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2972 { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
2973 { "si", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
2974
2975 // JB#5150
2976 { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2977 { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2978 { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
2979 { "si", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
2980 { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2981 { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2982 { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
2983 { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
729e4ab9
A
2984 { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "(IN)", "Asia/Calcutta" },
2985 { "si", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "(IN)", "Asia/Calcutta" },
46f4442e
A
2986 { NULL, NULL, NULL, NULL, NULL, NULL },
2987 };
2988
2989 UErrorCode status = U_ZERO_ERROR;
2990 Calendar *cal = GregorianCalendar::createInstance(status);
729e4ab9 2991 if (failure(status, "GregorianCalendar::createInstance", TRUE)) return;
46f4442e
A
2992 for (int i = 0; fallbackTests[i][0]; i++) {
2993 const char **testLine = fallbackTests[i];
2994 UnicodeString info[5];
2995 for ( int j = 0 ; j < 5 ; j++ ) {
2996 info[j] = UnicodeString(testLine[j], -1, US_INV);
2997 }
2998 info[4] = info[4].unescape();
2999 logln("%s;%s;%s;%s", testLine[0], testLine[1], testLine[2], testLine[3]);
3000
3001 TimeZone *tz = TimeZone::createTimeZone(info[1]);
3002
3003 if (strcmp(testLine[2], "2004-07-15T00:00:00Z") == 0) {
3004 cal->set(2004,6,15,0,0,0);
3005 } else {
3006 cal->set(2004,0,15,0,0,0);
73c04bcf 3007 }
46f4442e
A
3008
3009 SimpleDateFormat fmt(info[3], Locale(testLine[0]),status);
3010 ASSERT_OK(status);
3011 cal->adoptTimeZone(tz);
3012 UnicodeString result;
3013 FieldPosition pos(0);
3014 fmt.format(*cal,result,pos);
3015 if (result != info[4]) {
729e4ab9 3016 errln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3] + " expected: '" +
46f4442e 3017 info[4] + "' but got: '" + result + "'");
73c04bcf
A
3018 }
3019 }
46f4442e
A
3020 delete cal;
3021}
3022
729e4ab9
A
3023void DateFormatTest::TestRoundtripWithCalendar(void) {
3024 UErrorCode status = U_ZERO_ERROR;
3025
3026 TimeZone *tz = TimeZone::createTimeZone("Europe/Paris");
3027 TimeZone *gmt = TimeZone::createTimeZone("Etc/GMT");
3028
3029 Calendar *calendars[] = {
3030 Calendar::createInstance(*tz, Locale("und@calendar=gregorian"), status),
3031 Calendar::createInstance(*tz, Locale("und@calendar=buddhist"), status),
3032// Calendar::createInstance(*tz, Locale("und@calendar=hebrew"), status),
3033 Calendar::createInstance(*tz, Locale("und@calendar=islamic"), status),
3034 Calendar::createInstance(*tz, Locale("und@calendar=japanese"), status),
3035 NULL
3036 };
3037 if (U_FAILURE(status)) {
3038 dataerrln("Failed to initialize calendars: %s", u_errorName(status));
3039 for (int i = 0; calendars[i] != NULL; i++) {
3040 delete calendars[i];
3041 }
3042 return;
3043 }
3044
3045 //FIXME The formatters commented out below are currently failing because of
3046 // the calendar calculation problem reported by #6691
3047
3048 // The order of test formatters must match the order of calendars above.
3049 DateFormat *formatters[] = {
3050 DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("en_US")), //calendar=gregorian
3051 DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("th_TH")), //calendar=buddhist
3052// DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("he_IL@calendar=hebrew")),
3053 DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("ar_EG@calendar=islamic")),
3054// DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("ja_JP@calendar=japanese")),
3055 NULL
3056 };
3057
3058 UDate d = Calendar::getNow();
3059 UnicodeString buf;
3060 FieldPosition fpos;
3061 ParsePosition ppos;
3062
3063 for (int i = 0; formatters[i] != NULL; i++) {
3064 buf.remove();
3065 fpos.setBeginIndex(0);
3066 fpos.setEndIndex(0);
3067 calendars[i]->setTime(d, status);
3068
3069 // Normal case output - the given calendar matches the calendar
3070 // used by the formatter
3071 formatters[i]->format(*calendars[i], buf, fpos);
3072 UnicodeString refStr(buf);
3073
3074 for (int j = 0; calendars[j] != NULL; j++) {
3075 if (j == i) {
3076 continue;
3077 }
3078 buf.remove();
3079 fpos.setBeginIndex(0);
3080 fpos.setEndIndex(0);
3081 calendars[j]->setTime(d, status);
3082
3083 // Even the different calendar type is specified,
3084 // we should get the same result.
3085 formatters[i]->format(*calendars[j], buf, fpos);
3086 if (refStr != buf) {
3087 errln((UnicodeString)"FAIL: Different format result with a different calendar for the same time -"
3088 + "\n Reference calendar type=" + calendars[i]->getType()
3089 + "\n Another calendar type=" + calendars[j]->getType()
3090 + "\n Expected result=" + refStr
3091 + "\n Actual result=" + buf);
3092 }
3093 }
3094
3095 calendars[i]->setTimeZone(*gmt);
3096 calendars[i]->clear();
3097 ppos.setErrorIndex(-1);
3098 ppos.setIndex(0);
3099
3100 // Normal case parse result - the given calendar matches the calendar
3101 // used by the formatter
3102 formatters[i]->parse(refStr, *calendars[i], ppos);
3103
3104 for (int j = 0; calendars[j] != NULL; j++) {
3105 if (j == i) {
3106 continue;
3107 }
3108 calendars[j]->setTimeZone(*gmt);
3109 calendars[j]->clear();
3110 ppos.setErrorIndex(-1);
3111 ppos.setIndex(0);
3112
3113 // Even the different calendar type is specified,
3114 // we should get the same time and time zone.
3115 formatters[i]->parse(refStr, *calendars[j], ppos);
3116 if (calendars[i]->getTime(status) != calendars[j]->getTime(status)
3117 || calendars[i]->getTimeZone() != calendars[j]->getTimeZone()) {
3118 UnicodeString tzid;
3119 errln((UnicodeString)"FAIL: Different parse result with a different calendar for the same string -"
3120 + "\n Reference calendar type=" + calendars[i]->getType()
3121 + "\n Another calendar type=" + calendars[j]->getType()
3122 + "\n Date string=" + refStr
3123 + "\n Expected time=" + calendars[i]->getTime(status)
3124 + "\n Expected time zone=" + calendars[i]->getTimeZone().getID(tzid)
3125 + "\n Actual time=" + calendars[j]->getTime(status)
3126 + "\n Actual time zone=" + calendars[j]->getTimeZone().getID(tzid));
3127 }
3128 }
3129 if (U_FAILURE(status)) {
3130 errln((UnicodeString)"FAIL: " + u_errorName(status));
3131 break;
3132 }
3133 }
3134
3135 delete tz;
3136 delete gmt;
3137 for (int i = 0; calendars[i] != NULL; i++) {
3138 delete calendars[i];
3139 }
3140 for (int i = 0; formatters[i] != NULL; i++) {
3141 delete formatters[i];
3142 }
3143}
3144
46f4442e
A
3145/*
3146void DateFormatTest::TestRelativeError(void)
3147{
3148 UErrorCode status;
3149 Locale en("en");
729e4ab9 3150
46f4442e
A
3151 DateFormat *en_reltime_reldate = DateFormat::createDateTimeInstance(DateFormat::kFullRelative,DateFormat::kFullRelative,en);
3152 if(en_reltime_reldate == NULL) {
3153 logln("PASS: rel date/rel time failed");
3154 } else {
3155 errln("FAIL: rel date/rel time created, should have failed.");
3156 delete en_reltime_reldate;
73c04bcf 3157 }
73c04bcf
A
3158}
3159
46f4442e 3160void DateFormatTest::TestRelativeOther(void)
73c04bcf 3161{
46f4442e 3162 logln("Nothing in this test. When we get more data from CLDR, put in some tests of -2, +2, etc. ");
73c04bcf 3163}
46f4442e
A
3164*/
3165
729e4ab9
A
3166void DateFormatTest::Test6338(void)
3167{
3168 UErrorCode status = U_ZERO_ERROR;
3169
3170 SimpleDateFormat *fmt1 = new SimpleDateFormat(UnicodeString("y-M-d"), Locale("ar"), status);
3171 if (failure(status, "new SimpleDateFormat", TRUE)) return;
3172
3173 UDate dt1 = date(2008-1900, UCAL_JUNE, 10, 12, 00);
3174 UnicodeString str1;
3175 str1 = fmt1->format(dt1, str1);
3176 logln(str1);
3177
3178 UDate dt11 = fmt1->parse(str1, status);
3179 failure(status, "fmt->parse");
3180
3181 UnicodeString str11;
3182 str11 = fmt1->format(dt11, str11);
3183 logln(str11);
3184
3185 if (str1 != str11) {
3186 errln((UnicodeString)"FAIL: Different dates str1:" + str1
3187 + " str2:" + str11);
3188 }
3189 delete fmt1;
3190
3191 /////////////////
3192
3193 status = U_ZERO_ERROR;
3194 SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("y M d"), Locale("ar"), status);
3195 failure(status, "new SimpleDateFormat");
3196
3197 UDate dt2 = date(2008-1900, UCAL_JUNE, 10, 12, 00);
3198 UnicodeString str2;
3199 str2 = fmt2->format(dt2, str2);
3200 logln(str2);
3201
3202 UDate dt22 = fmt2->parse(str2, status);
3203 failure(status, "fmt->parse");
3204
3205 UnicodeString str22;
3206 str22 = fmt2->format(dt22, str22);
3207 logln(str22);
3208
3209 if (str2 != str22) {
3210 errln((UnicodeString)"FAIL: Different dates str1:" + str2
3211 + " str2:" + str22);
3212 }
3213 delete fmt2;
3214
3215 /////////////////
3216
3217 status = U_ZERO_ERROR;
3218 SimpleDateFormat *fmt3 = new SimpleDateFormat(UnicodeString("y-M-d"), Locale("en-us"), status);
3219 failure(status, "new SimpleDateFormat");
3220
3221 UDate dt3 = date(2008-1900, UCAL_JUNE, 10, 12, 00);
3222 UnicodeString str3;
3223 str3 = fmt3->format(dt3, str3);
3224 logln(str3);
3225
3226 UDate dt33 = fmt3->parse(str3, status);
3227 failure(status, "fmt->parse");
3228
3229 UnicodeString str33;
3230 str33 = fmt3->format(dt33, str33);
3231 logln(str33);
3232
3233 if (str3 != str33) {
3234 errln((UnicodeString)"FAIL: Different dates str1:" + str3
3235 + " str2:" + str33);
3236 }
3237 delete fmt3;
3238
3239 /////////////////
3240
3241 status = U_ZERO_ERROR;
3242 SimpleDateFormat *fmt4 = new SimpleDateFormat(UnicodeString("y M d"), Locale("en-us"), status);
3243 failure(status, "new SimpleDateFormat");
3244
3245 UDate dt4 = date(2008-1900, UCAL_JUNE, 10, 12, 00);
3246 UnicodeString str4;
3247 str4 = fmt4->format(dt4, str4);
3248 logln(str4);
3249
3250 UDate dt44 = fmt4->parse(str4, status);
3251 failure(status, "fmt->parse");
3252
3253 UnicodeString str44;
3254 str44 = fmt4->format(dt44, str44);
3255 logln(str44);
3256
3257 if (str4 != str44) {
3258 errln((UnicodeString)"FAIL: Different dates str1:" + str4
3259 + " str2:" + str44);
3260 }
3261 delete fmt4;
3262
3263}
3264
3265void DateFormatTest::Test6726(void)
3266{
3267 // status
3268// UErrorCode status = U_ZERO_ERROR;
3269
3270 // fmtf, fmtl, fmtm, fmts;
3271 UnicodeString strf, strl, strm, strs;
3272 UDate dt = date(2008-1900, UCAL_JUNE, 10, 12, 00);
3273
3274 Locale loc("ja");
3275 DateFormat* fmtf = DateFormat::createDateTimeInstance(DateFormat::FULL, DateFormat::FULL, loc);
3276 DateFormat* fmtl = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::FULL, loc);
3277 DateFormat* fmtm = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL, loc);
3278 DateFormat* fmts = DateFormat::createDateTimeInstance(DateFormat::SHORT, DateFormat::FULL, loc);
3279 if (fmtf == NULL || fmtl == NULL || fmtm == NULL || fmts == NULL) {
3280 dataerrln("Unable to create DateFormat. got NULL.");
3281 /* It may not be true that if one is NULL all is NULL. Just to be safe. */
3282 delete fmtf;
3283 delete fmtl;
3284 delete fmtm;
3285 delete fmts;
3286
3287 return;
3288 }
3289 strf = fmtf->format(dt, strf);
3290 strl = fmtl->format(dt, strl);
3291 strm = fmtm->format(dt, strm);
3292 strs = fmts->format(dt, strs);
3293
3294
3295/* Locale data is not yet updated
3296 if (strf.charAt(13) == UChar(0x20)) {
3297 errln((UnicodeString)"FAIL: Improper formatted date: " + strf);
3298 }
3299 if (strl.charAt(10) == UChar(0x20)) {
3300 errln((UnicodeString)"FAIL: Improper formatted date: " + strl);
3301 }
3302*/
3303 logln("strm.charAt(10)=%04X wanted 0x20\n", strm.charAt(10));
3304 if (strm.charAt(10) != UChar(0x0020)) {
3305 errln((UnicodeString)"FAIL: Improper formatted date: " + strm );
3306 }
3307 logln("strs.charAt(10)=%04X wanted 0x20\n", strs.charAt(8));
3308 if (strs.charAt(8) != UChar(0x0020)) {
3309 errln((UnicodeString)"FAIL: Improper formatted date: " + strs);
3310 }
3311
3312 delete fmtf;
3313 delete fmtl;
3314 delete fmtm;
3315 delete fmts;
3316
3317 return;
3318}
3319
3320/**
3321 * Test DateFormat's parsing of default GMT variants. See ticket#6135
3322 */
3323void DateFormatTest::TestGMTParsing() {
3324 const char* DATA[] = {
3325 "HH:mm:ss Z",
3326
3327 // pattern, input, expected output (in quotes)
3328 "HH:mm:ss Z", "10:20:30 GMT+03:00", "10:20:30 +0300",
3329 "HH:mm:ss Z", "10:20:30 UT-02:00", "10:20:30 -0200",
3330 "HH:mm:ss Z", "10:20:30 GMT", "10:20:30 +0000",
3331 "HH:mm:ss vvvv", "10:20:30 UT+10:00", "10:20:30 +1000",
3332 "HH:mm:ss zzzz", "10:20:30 UTC", "10:20:30 +0000", // standalone "UTC"
3333 "ZZZZ HH:mm:ss", "UT 10:20:30", "10:20:30 +0000",
3334 "V HH:mm:ss", "UT+0130 10:20:30", "10:20:30 +0130",
3335 "V HH:mm:ss", "UTC+0130 10:20:30", NULL, // UTC+0130 is not a supported pattern
3336 "HH mm Z ss", "10 20 GMT-1100 30", "10:20:30 -1100",
3337 };
3338 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]);
3339 expectParse(DATA, DATA_len, Locale("en"));
3340}
3341
3342// Test case for localized GMT format parsing
3343// with no delimitters in offset format (Chinese locale)
3344void DateFormatTest::Test6880() {
3345 UErrorCode status = U_ZERO_ERROR;
3346 UDate d1, d2, dp1, dp2, dexp1, dexp2;
3347 UnicodeString s1, s2;
3348
3349 TimeZone *tz = TimeZone::createTimeZone("Asia/Shanghai");
3350 GregorianCalendar gcal(*tz, status);
3351 if (failure(status, "construct GregorianCalendar", TRUE)) return;
3352
3353 gcal.clear();
3354 gcal.set(1910, UCAL_JULY, 1, 12, 00); // offset 8:05:52
3355 d1 = gcal.getTime(status);
3356
3357 gcal.clear();
3358 gcal.set(1950, UCAL_JULY, 1, 12, 00); // offset 8:00
3359 d2 = gcal.getTime(status);
3360
3361 gcal.clear();
3362 gcal.set(1970, UCAL_JANUARY, 1, 12, 00);
3363 dexp2 = gcal.getTime(status);
3364 dexp1 = dexp2 - (5*60 + 52)*1000; // subtract 5m52s
3365
3366 if (U_FAILURE(status)) {
3367 errln("FAIL: Gregorian calendar error");
3368 }
3369
3370 DateFormat *fmt = DateFormat::createTimeInstance(DateFormat::kFull, Locale("zh"));
3371 if (fmt == NULL) {
3372 dataerrln("Unable to create DateFormat. Got NULL.");
3373 return;
3374 }
3375 fmt->adoptTimeZone(tz);
3376
3377 fmt->format(d1, s1);
3378 fmt->format(d2, s2);
3379
3380 dp1 = fmt->parse(s1, status);
3381 dp2 = fmt->parse(s2, status);
3382
3383 if (U_FAILURE(status)) {
3384 errln("FAIL: Parse failure");
3385 }
3386
3387 if (dp1 != dexp1) {
3388 errln("FAIL: Failed to parse " + s1 + " parsed: " + dp1 + " expected: " + dexp1);
3389 }
3390 if (dp2 != dexp2) {
3391 errln("FAIL: Failed to parse " + s2 + " parsed: " + dp2 + " expected: " + dexp2);
3392 }
3393
3394 delete fmt;
3395}
3396
7393aa2f
A
3397void DateFormatTest::TestNumberAsStringParsing()
3398{
3399 UErrorCode status = U_ZERO_ERROR;
3400 UnicodeString dateString("2009 7 2 08:14:16");
3401 UnicodeString datePattern("y MMMM d HH:mm:ss");
3402 SimpleDateFormat *formatter = new SimpleDateFormat(datePattern, Locale(""), status);
3403 UDate date1 = 0;
3404
3405 formatter->setLenient(FALSE);
3406 date1 = formatter->parse(dateString, status);
3407
3408 if (U_FAILURE(status)) {
3409 errln("FAIL: Could not parse \"2009 7 2 08:14:16\" with pattern \"y MMMM d HH:mm:ss\"");
3410 } else {
3411 UnicodeString formatted;
3412
3413 formatter->format(date1, formatted);
3414
3415 if (formatted != dateString) {
3416 errln("FAIL: parsed string did not match input.");
3417 }
3418 }
729e4ab9 3419
7393aa2f
A
3420 delete formatter;
3421}
3422
729e4ab9
A
3423void DateFormatTest::TestISOEra() {
3424
3425 const char* data[] = {
3426 // input, output
3427 "BC 4004-10-23T07:00:00Z", "BC 4004-10-23T07:00:00Z",
3428 "AD 4004-10-23T07:00:00Z", "AD 4004-10-23T07:00:00Z",
3429 "-4004-10-23T07:00:00Z" , "BC 4005-10-23T07:00:00Z",
3430 "4004-10-23T07:00:00Z" , "AD 4004-10-23T07:00:00Z",
3431 };
3432
3433 int32_t numData = 8;
3434
3435 UErrorCode status = U_ZERO_ERROR;
3436
3437 // create formatter
3438 SimpleDateFormat *fmt1 = new SimpleDateFormat(UnicodeString("GGG yyyy-MM-dd'T'HH:mm:ss'Z"), status);
3439 failure(status, "new SimpleDateFormat", TRUE);
3440
3441 for(int i=0; i < numData; i+=2) {
3442 // create input string
3443 UnicodeString in = data[i];
3444
3445 // parse string to date
3446 UDate dt1 = fmt1->parse(in, status);
3447 failure(status, "fmt->parse", TRUE);
3448
3449 // format date back to string
3450 UnicodeString out;
3451 out = fmt1->format(dt1, out);
3452 logln(out);
3453
3454 // check that roundtrip worked as expected
3455 UnicodeString expected = data[i+1];
3456 if (out != expected) {
3457 dataerrln((UnicodeString)"FAIL: " + in + " -> " + out + " expected -> " + expected);
3458 }
3459 }
3460
3461 delete fmt1;
3462}
3463void DateFormatTest::TestFormalChineseDate() {
3464
3465 UErrorCode status = U_ZERO_ERROR;
3466 UnicodeString pattern ("y\\u5e74M\\u6708d\\u65e5", -1, US_INV );
3467 pattern = pattern.unescape();
3468 UnicodeString override ("y=hanidec;M=hans;d=hans", -1, US_INV );
3469
3470 // create formatter
3471 SimpleDateFormat *sdf = new SimpleDateFormat(pattern,override,Locale::getChina(),status);
3472 failure(status, "new SimpleDateFormat with override", TRUE);
46f4442e 3473
729e4ab9
A
3474 UDate thedate = date(2009-1900, UCAL_JULY, 28);
3475 FieldPosition pos(0);
3476 UnicodeString result;
3477 sdf->format(thedate,result,pos);
3478
3479 UnicodeString expected = "\\u4e8c\\u3007\\u3007\\u4e5d\\u5e74\\u4e03\\u6708\\u4e8c\\u5341\\u516b\\u65e5";
3480 expected = expected.unescape();
3481 if (result != expected) {
3482 dataerrln((UnicodeString)"FAIL: -> " + result + " expected -> " + expected);
3483 }
3484
3485 UDate parsedate = sdf->parse(expected,status);
3486 if ( parsedate != thedate ) {
3487 UnicodeString pat1 ("yyyy-MM-dd'T'HH:mm:ss'Z'", -1, US_INV );
3488 SimpleDateFormat *usf = new SimpleDateFormat(pat1,Locale::getEnglish(),status);
3489 UnicodeString parsedres,expres;
3490 usf->format(parsedate,parsedres,pos);
3491 usf->format(thedate,expres,pos);
3492 errln((UnicodeString)"FAIL: parsed -> " + parsedres + " expected -> " + expres);
3493 delete usf;
3494 }
3495 delete sdf;
3496}
73c04bcf 3497
b75a7d8f
A
3498#endif /* #if !UCONFIG_NO_FORMATTING */
3499
3500//eof