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