home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / dtfmrgts.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-19  |  35.7 KB  |  1,142 lines

  1.  
  2. /*
  3. ********************************************************************
  4. * COPYRIGHT: 
  5. * (C) Copyright International Business Machines Corporation, 1998
  6. * Copyright (C) 1999 Alan Liu and others. All rights reserved. 
  7. * Licensed Material - Program-Property of IBM - All Rights Reserved. 
  8. * US Government Users Restricted Rights - Use, duplication, or disclosure 
  9. * restricted by GSA ADP Schedule Contract with IBM Corp. 
  10. *
  11. ********************************************************************
  12. */
  13.  
  14. #include "dtfmrgts.h"
  15.  
  16. #include "timezone.h"
  17. #include "gregocal.h"
  18. #include "smpdtfmt.h"
  19. #include "datefmt.h"
  20. #include "simpletz.h"
  21. #include "resbund.h"
  22.  
  23. // *****************************************************************************
  24. // class DateFormatRegressionTest
  25. // *****************************************************************************
  26.  
  27. #define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break;
  28.  
  29. void 
  30. DateFormatRegressionTest::runIndexedTest( int32_t index, bool_t exec, char* &name, char* par )
  31. {
  32.     // if (exec) logln((UnicodeString)"TestSuite DateFormatRegressionTest");
  33.     switch (index) {
  34.         CASE(0,Test4029195)
  35.         CASE(1,Test4052408)
  36.         CASE(2,Test4056591)
  37.         CASE(3,Test4059917)
  38.         CASE(4,Test4060212)
  39.         CASE(5,Test4061287)
  40.         CASE(6,Test4065240)
  41.         CASE(7,Test4071441)
  42.         CASE(8,Test4073003)
  43.         CASE(9,Test4089106)
  44.         CASE(10,Test4100302)
  45.         CASE(11,Test4101483)
  46.         CASE(12,Test4103340)
  47.         CASE(13,Test4103341)
  48.         CASE(14,Test4104136)
  49.         CASE(15,Test4104522)
  50.         CASE(16,Test4106807)
  51.         CASE(17,Test4108407) 
  52.         CASE(18,Test4134203)
  53.         CASE(19,Test4151631)
  54.         CASE(20,Test4151706)
  55.         CASE(21,Test4162071)
  56.         CASE(22,Test4182066)
  57.         CASE(23,Test4210209)
  58.  
  59.         default: name = ""; break;
  60.     }
  61. }
  62.  
  63. /**
  64.  * @bug 4029195
  65.  */
  66. void DateFormatRegressionTest::Test4029195() 
  67. {
  68.     UErrorCode status = U_ZERO_ERROR;
  69.  
  70.     UDate today = Calendar::getNow();
  71.     logln((UnicodeString) "today: " + today);
  72.  
  73.     SimpleDateFormat *sdf = (SimpleDateFormat*) DateFormat::createDateInstance();
  74.     failure(status, "SimpleDateFormat::createDateInstance");
  75.     UnicodeString pat;
  76.     pat = sdf->toPattern(pat);
  77.     logln("pattern: " + pat);
  78.     UnicodeString fmtd;
  79.     FieldPosition pos(FieldPosition::DONT_CARE);
  80.     fmtd = sdf->format(today, fmtd, pos);
  81.     logln("today: " + fmtd);
  82.  
  83.     sdf->applyPattern("G yyyy DDD");
  84.     UnicodeString todayS;
  85.     todayS = sdf->format(today, todayS, pos);
  86.     logln("today: " + todayS);
  87.     //try {
  88.         today = sdf->parse(todayS, status);
  89.         failure(status, "sdf->parse");
  90.         logln((UnicodeString)"today date: " + today);
  91.     /*} catch(Exception e) {
  92.         logln("Error reparsing date: " + e.getMessage());
  93.     }*/
  94.  
  95.     //try {
  96.         UnicodeString rt;
  97.         rt = sdf->format(sdf->parse(todayS, status), rt, pos);
  98.         failure(status, "sdf->parse");
  99.         logln("round trip: " + rt);
  100.         if(rt != todayS) 
  101.             errln("Fail: Want " + todayS + " Got " + rt);
  102.     /*}
  103.     catch (ParseException e) {
  104.         errln("Fail: " + e);
  105.         e.printStackTrace();
  106.     }*/
  107.  
  108.     delete sdf;
  109. }
  110.  
  111. /**
  112.  * @bug 4052408
  113.  */
  114. void DateFormatRegressionTest::Test4052408() 
  115. {
  116.  
  117.     DateFormat *fmt = DateFormat::createDateTimeInstance(DateFormat::SHORT,
  118.                                                 DateFormat::SHORT, Locale::US);
  119.     UDate dt = date(97, Calendar::MAY, 3, 8, 55);
  120.     UnicodeString str;
  121.     str = fmt->format(dt, str);
  122.     logln(str);
  123.     
  124.     if(str != "5/3/97 8:55 AM")
  125.         errln("Fail: Test broken; Want 5/3/97 8:55 AM Got " + str);   
  126.     
  127.     UnicodeString expected[] = {
  128.         (UnicodeString) "", //"ERA_FIELD",
  129.         (UnicodeString) "97", //"YEAR_FIELD",
  130.         (UnicodeString) "5", //"MONTH_FIELD",
  131.         (UnicodeString) "3", //"DATE_FIELD",
  132.         (UnicodeString) "", //"HOUR_OF_DAY1_FIELD",
  133.         (UnicodeString) "", //"HOUR_OF_DAY0_FIELD",
  134.         (UnicodeString) "55", //"MINUTE_FIELD",
  135.         (UnicodeString) "", //"SECOND_FIELD",
  136.         (UnicodeString) "", //"MILLISECOND_FIELD",
  137.         (UnicodeString) "", //"DAY_OF_WEEK_FIELD",
  138.         (UnicodeString) "", //"DAY_OF_YEAR_FIELD",
  139.         (UnicodeString) "", //"DAY_OF_WEEK_IN_MONTH_FIELD",
  140.         (UnicodeString) "", //"WEEK_OF_YEAR_FIELD",
  141.         (UnicodeString) "", //"WEEK_OF_MONTH_FIELD",
  142.         (UnicodeString) "AM", //"AM_PM_FIELD",
  143.         (UnicodeString) "8", //"HOUR1_FIELD",
  144.         (UnicodeString) "", //"HOUR0_FIELD",
  145.         (UnicodeString) "" //"TIMEZONE_FIELD"
  146.     };
  147.     
  148.     //Hashtable expected;// = new Hashtable();
  149.     //expected.put(new LongKey(DateFormat.MONTH_FIELD), "5");
  150.     //expected.put(new LongKey(DateFormat.DATE_FIELD), "3");
  151.     //expected.put(new LongKey(DateFormat.YEAR_FIELD), "97");
  152.     //expected.put(new LongKey(DateFormat.HOUR1_FIELD), "8");
  153.     //expected.put(new LongKey(DateFormat.MINUTE_FIELD), "55");
  154.     //expected.put(new LongKey(DateFormat.AM_PM_FIELD), "AM");
  155.     
  156.     //StringBuffer buf = new StringBuffer();
  157.     UnicodeString fieldNames[] = {
  158.         (UnicodeString) "ERA_FIELD",
  159.         (UnicodeString) "YEAR_FIELD",
  160.         (UnicodeString) "MONTH_FIELD",
  161.         (UnicodeString) "DATE_FIELD",
  162.         (UnicodeString) "HOUR_OF_DAY1_FIELD",
  163.         (UnicodeString) "HOUR_OF_DAY0_FIELD",
  164.         (UnicodeString) "MINUTE_FIELD",
  165.         (UnicodeString) "SECOND_FIELD",
  166.         (UnicodeString) "MILLISECOND_FIELD",
  167.         (UnicodeString) "DAY_OF_WEEK_FIELD",
  168.         (UnicodeString) "DAY_OF_YEAR_FIELD",
  169.         (UnicodeString) "DAY_OF_WEEK_IN_MONTH_FIELD",
  170.         (UnicodeString) "WEEK_OF_YEAR_FIELD",
  171.         (UnicodeString) "WEEK_OF_MONTH_FIELD",
  172.         (UnicodeString) "AM_PM_FIELD",
  173.         (UnicodeString) "HOUR1_FIELD",
  174.         (UnicodeString) "HOUR0_FIELD",
  175.         (UnicodeString) "TIMEZONE_FIELD"
  176.     };
  177.  
  178.     bool_t pass = TRUE;
  179.     for(int i = 0; i <= 17; ++i) {
  180.         FieldPosition pos(i);
  181.         UnicodeString buf;
  182.         fmt->format(dt, buf, pos);
  183.         //char[] dst = new char[pos.getEndIndex() - pos.getBeginIndex()];
  184.         UnicodeString dst;
  185.     buf.extractBetween(pos.getBeginIndex(), pos.getEndIndex(), dst);
  186.         UnicodeString str(dst);
  187.         log(i + ": " + fieldNames[i] +
  188.                          ", \"" + str + "\", " +
  189.                          pos.getBeginIndex() + ", " +
  190.                          pos.getEndIndex());
  191.         UnicodeString exp = expected[i];
  192.         if((exp.size() == 0 && str.size() == 0) || str == exp)
  193.             logln(" ok");
  194.         else {
  195.             logln(UnicodeString(" expected ") + exp);
  196.             pass = FALSE;
  197.         }
  198.     
  199.     }
  200.     if( ! pass) 
  201.         errln("Fail: FieldPosition not set right by DateFormat");
  202.  
  203.     delete fmt;
  204. }
  205.  
  206. /**
  207.  * @bug 4056591
  208.  * Verify the function of the [s|g]et2DigitYearStart() API.
  209.  */
  210. void DateFormatRegressionTest::Test4056591() 
  211. {
  212.     UErrorCode status = U_ZERO_ERROR;
  213.  
  214.     //try {
  215.         SimpleDateFormat *fmt = new SimpleDateFormat("yyMMdd", Locale::US, status);
  216.         failure(status, "new SimpleDateFormat");
  217.         UDate start = date(1809-1900, Calendar::DECEMBER, 25);
  218.         fmt->set2DigitYearStart(start, status);
  219.         failure(status, "fmt->setTwoDigitStartDate");
  220.         if( (fmt->get2DigitYearStart(status) != start) || failure(status, "get2DigitStartDate"))
  221.             errln("get2DigitYearStart broken");
  222.         UDate dates [] = {
  223.             date(1809-1900, Calendar::DECEMBER, 25),
  224.             date(1909-1900, Calendar::DECEMBER, 24),
  225.             date(1809-1900, Calendar::DECEMBER, 26),
  226.             date(1861-1900, Calendar::DECEMBER, 25),
  227.         };
  228.  
  229.         UnicodeString strings [] = {
  230.             (UnicodeString) "091225",
  231.             (UnicodeString) "091224",
  232.             (UnicodeString) "091226",
  233.             (UnicodeString) "611225"
  234.         };
  235.  
  236.         /*Object[] DATA = {
  237.             "091225", new Date(1809-1900, Calendar.DECEMBER, 25),
  238.             "091224", new Date(1909-1900, Calendar.DECEMBER, 24),
  239.             "091226", new Date(1809-1900, Calendar.DECEMBER, 26),
  240.             "611225", new Date(1861-1900, Calendar.DECEMBER, 25),
  241.         };*/
  242.  
  243.         for(int i = 0; i < 4; i++) {
  244.             UnicodeString s = strings[i];
  245.             UDate exp = dates[i];
  246.             UDate got = fmt->parse(s, status);
  247.             failure(status, "fmt->parse");
  248.             logln(s + " -> " + got + "; exp " + exp);
  249.             if(got != exp) 
  250.                 errln("set2DigitYearStart broken");
  251.         }
  252.     /*}
  253.     catch (ParseException e) {
  254.         errln("Fail: " + e);
  255.         e.printStackTrace();
  256.     }*/
  257.  
  258.     delete fmt;
  259. }
  260.  
  261. /**
  262.  * @bug 4059917
  263.  */
  264. void DateFormatRegressionTest::Test4059917() 
  265. {
  266.     UErrorCode status = U_ZERO_ERROR;
  267.     
  268.     SimpleDateFormat *fmt;
  269.     UnicodeString myDate;
  270.  
  271.     fmt = new SimpleDateFormat( "yyyy/MM/dd", status );
  272.     failure(status, "new SimpleDateFormat");
  273.     myDate = "1997/01/01";
  274.     aux917( fmt, myDate );
  275.     
  276.     delete fmt;
  277.     fmt = NULL;
  278.     
  279.     fmt = new SimpleDateFormat( "yyyyMMdd", status );
  280.     failure(status, "new SimpleDateFormat");
  281.     myDate = "19970101";
  282.     aux917( fmt, myDate );
  283.               
  284.     delete fmt;
  285. }
  286.  
  287. void DateFormatRegressionTest::aux917( SimpleDateFormat *fmt, UnicodeString& str ) {
  288.     //try {
  289.     UnicodeString pat;
  290.     pat = fmt->toPattern(pat);
  291.     logln( "==================" );
  292.     logln( "testIt: pattern=" + pat +
  293.                " string=" + str );
  294.                 
  295.         
  296.     Formattable o;
  297.     //Object o;
  298.     ParsePosition pos(0);
  299.     fmt->parseObject( str, o, pos );
  300.     //logln( UnicodeString("Parsed object: ") + o );
  301.     
  302.     UErrorCode status = U_ZERO_ERROR;
  303.     UnicodeString formatted;
  304.     FieldPosition poss(FieldPosition::DONT_CARE);
  305.     formatted = fmt->format( o, formatted, poss, status );
  306.     failure(status, "fmt->format");
  307.     logln( "Formatted string: " + formatted );
  308.     if( formatted != str) 
  309.         errln("Fail: Want " + str + " Got " + formatted);
  310.     /*}
  311.     catch (ParseException e) {
  312.         errln("Fail: " + e);
  313.         e.printStackTrace();
  314.     }*/
  315. }
  316.  
  317. /**
  318.  * @bug 4060212
  319.  */
  320. void DateFormatRegressionTest::Test4060212() 
  321. {
  322.     UnicodeString dateString = "1995-040.05:01:29";
  323.  
  324.     logln( "dateString= " + dateString );
  325.     logln("Using yyyy-DDD.hh:mm:ss");
  326.     UErrorCode status = U_ZERO_ERROR;
  327.     SimpleDateFormat *formatter = new SimpleDateFormat("yyyy-DDD.hh:mm:ss", status);
  328.     failure(status, "new SimpleDateFormat");
  329.     ParsePosition pos(0);
  330.     UDate myDate = formatter->parse( dateString, pos );
  331.     UnicodeString myString;
  332.     DateFormat *fmt = DateFormat::createDateTimeInstance( DateFormat::FULL,
  333.                                                             DateFormat::LONG);
  334.     myString = fmt->format( myDate, myString);
  335.     logln( myString );
  336.  
  337.     Calendar *cal = new GregorianCalendar(status);
  338.     failure(status, "new GregorianCalendar");
  339.     cal->setTime(myDate, status);
  340.     failure(status, "cal->setTime");
  341.     if ((cal->get(Calendar::DAY_OF_YEAR, status) != 40) || failure(status, "cal->get"))
  342.         errln((UnicodeString) "Fail: Got " + cal->get(Calendar::DAY_OF_YEAR, status) +
  343.                             " Want 40");
  344.  
  345.     logln("Using yyyy-ddd.hh:mm:ss");
  346.     delete formatter;
  347.     formatter = NULL;
  348.     formatter = new SimpleDateFormat("yyyy-ddd.hh:mm:ss", status);
  349.     failure(status, "new SimpleDateFormat");
  350.     pos.setIndex(0);
  351.     myDate = formatter->parse( dateString, pos );
  352.     myString = fmt->format( myDate, myString );
  353.     logln( myString );
  354.     cal->setTime(myDate, status);
  355.     failure(status, "cal->setTime");
  356.     if ((cal->get(Calendar::DAY_OF_YEAR, status) != 40) || failure(status, "cal->get"))
  357.         errln((UnicodeString) "Fail: Got " + cal->get(Calendar::DAY_OF_YEAR, status) +
  358.                             " Want 40");
  359.  
  360.     delete formatter;
  361.     delete fmt;
  362.     delete cal;
  363. }
  364.  
  365. /**
  366.  * @bug 4061287
  367.  */
  368. void DateFormatRegressionTest::Test4061287() 
  369. {
  370.     UErrorCode status = U_ZERO_ERROR;
  371.     
  372.     SimpleDateFormat *df = new SimpleDateFormat("dd/MM/yyyy", status);
  373.     failure(status, "new SimpleDateFormat");
  374.     //try {
  375.     logln(UnicodeString("") + df->parse("35/01/1971", status));  
  376.     failure(status, "df->parse");
  377.     //logln(df.parse("35/01/1971").toString());
  378.     //}
  379.     /*catch (ParseException e) {
  380.         errln("Fail: " + e);
  381.         e.printStackTrace();
  382.     }*/
  383.     df->setLenient(FALSE);
  384.     bool_t ok = FALSE;
  385.     //try {
  386.     logln(UnicodeString("") + df->parse("35/01/1971", status));
  387.     if(U_FAILURE(status))
  388.         ok = TRUE;
  389.     //logln(df.parse("35/01/1971").toString());
  390.     //} catch (ParseException e) {ok=TRUE;}
  391.     if(!ok) 
  392.         errln("Fail: Lenient not working");
  393. }
  394.  
  395. /**
  396.  * @bug 4065240
  397.  */
  398. void DateFormatRegressionTest::Test4065240() 
  399. {
  400.     UDate curDate;
  401.     DateFormat *shortdate, *fulldate;
  402.     UnicodeString strShortDate, strFullDate;
  403.     Locale saveLocale = Locale::getDefault();
  404.     TimeZone *saveZone = TimeZone::createDefault();
  405.  
  406.     UErrorCode status = U_ZERO_ERROR;
  407.     //try {
  408.         Locale *curLocale = new Locale("de","DE");
  409.         Locale::setDefault(*curLocale, status);
  410.         failure(status, "Locale::setDefault");
  411.         // {sfb} adoptDefault instead of setDefault
  412.         //TimeZone::setDefault(TimeZone::createTimeZone("EST"));
  413.         TimeZone::adoptDefault(TimeZone::createTimeZone("EST"));
  414.         curDate = date(98, 0, 1);
  415.         shortdate = DateFormat::createDateInstance(DateFormat::SHORT);
  416.         fulldate = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG);
  417.         strShortDate = "The current date (short form) is ";
  418.         UnicodeString temp;
  419.         temp = shortdate->format(curDate, temp);
  420.         strShortDate += temp;
  421.         strFullDate = "The current date (long form) is ";
  422.         UnicodeString temp2;
  423.         fulldate->format(curDate, temp2);
  424.         strFullDate += temp2;
  425.  
  426.         logln(strShortDate);
  427.         logln(strFullDate);
  428.  
  429.         // {sfb} What to do with resource bundle stuff?????
  430.  
  431.         // Check to see if the resource is present; if not, we can't test
  432.         ResourceBundle *bundle = new ResourceBundle(
  433.             icu_getDefaultDataDirectory(), *curLocale, status);
  434.         failure(status, "new ResourceBundle");
  435.             //(UnicodeString) "java.text.resources.DateFormatZoneData", curLocale);
  436.  
  437.         // {sfb} API change to ResourceBundle -- add getLocale()
  438.         /*if (bundle->getLocale().getLanguage(temp) == UnicodeString("de")) {
  439.             // UPDATE THIS AS ZONE NAME RESOURCE FOR <EST> in de_DE is updated
  440.             if (!strFullDate.endsWith(UnicodeString("GMT-05:00")))
  441.                 errln("Fail: Want GMT-05:00");
  442.         }
  443.         else {
  444.             logln("*** TEST COULD NOT BE COMPLETED BECAUSE DateFormatZoneData ***");
  445.             logln("*** FOR LOCALE de OR de_DE IS MISSING ***");
  446.         }*/
  447.     //}
  448.     //finally {
  449.     Locale::setDefault(saveLocale, status);
  450.     failure(status, "Locale::setDefault");
  451.     TimeZone::setDefault(*saveZone);
  452.     //}
  453.  
  454.     delete saveZone;
  455. }
  456.  
  457. /*
  458.   DateFormat.equals is too narrowly defined.  As a result, MessageFormat
  459.   does not work correctly.  DateFormat.equals needs to be written so
  460.   that the Calendar sub-object is not compared using Calendar.equals,
  461.   but rather compared for equivalency.  This may necessitate adding a
  462.   (package private) method to Calendar to test for equivalency.
  463.   
  464.   Currently this bug breaks MessageFormat.toPattern
  465.   */
  466. /**
  467.  * @bug 4071441
  468.  */
  469. void DateFormatRegressionTest::Test4071441() 
  470. {
  471.     DateFormat *fmtA = DateFormat::createInstance();
  472.     DateFormat *fmtB = DateFormat::createInstance();
  473.     
  474.     // {sfb} Is it OK to cast away const here?
  475.     Calendar *calA = (Calendar*) fmtA->getCalendar();
  476.     Calendar *calB = (Calendar*) fmtB->getCalendar();
  477.     UDate epoch = date(0, 0, 0);
  478.     UDate xmas = date(61, Calendar::DECEMBER, 25);
  479.  
  480.     UErrorCode status = U_ZERO_ERROR;
  481.     calA->setTime(epoch, status);
  482.     failure(status, "calA->setTime");
  483.     calB->setTime(epoch, status);
  484.     failure(status, "calB->setTime");
  485.     if (*calA != *calB)
  486.         errln("Fail: Can't complete test; Calendar instances unequal");
  487.     if (*fmtA != *fmtB)
  488.         errln("Fail: DateFormat unequal when Calendars equal");
  489.     calB->setTime(xmas, status);
  490.     failure(status, "calB->setTime");
  491.     if (*calA == *calB)
  492.         errln("Fail: Can't complete test; Calendar instances equal");
  493.     if (*fmtA != *fmtB)
  494.         errln("Fail: DateFormat unequal when Calendars equivalent");
  495.     logln("DateFormat.equals ok");
  496.  
  497.     delete fmtA;
  498.     delete fmtB;
  499. }
  500.  
  501. /* The java.text.DateFormat.parse(String) method expects for the
  502.   US locale a string formatted according to mm/dd/yy and parses it
  503.   correctly.
  504.  
  505.   When given a string mm/dd/yyyy it only parses up to the first
  506.   two y's, typically resulting in a date in the year 1919.
  507.   
  508.   Please extend the parsing method(s) to handle strings with
  509.   four-digit year values (probably also applicable to various
  510.   other locales.  */
  511. /**
  512.  * @bug 4073003
  513.  */
  514. void DateFormatRegressionTest::Test4073003() 
  515. {
  516.     //try {
  517.     DateFormat *fmt = DateFormat::createDateInstance(DateFormat::SHORT, Locale::US);
  518.         UnicodeString tests [] = { 
  519.             (UnicodeString) "12/25/61", 
  520.             (UnicodeString) "12/25/1961", 
  521.             (UnicodeString) "4/3/2010", 
  522.             (UnicodeString) "4/3/10" 
  523.         };
  524.         UErrorCode status = U_ZERO_ERROR;
  525.         for(int i= 0; i < 4; i+=2) {
  526.             UDate d = fmt->parse(tests[i], status);
  527.             failure(status, "fmt->parse");
  528.             UDate dd = fmt->parse(tests[i+1], status);
  529.             failure(status, "fmt->parse");
  530.             UnicodeString s;
  531.             s = fmt->format(d, s);
  532.             UnicodeString ss;
  533.             ss = fmt->format(dd, ss);
  534.             if (d != dd)
  535.                 errln((UnicodeString) "Fail: " + d + " != " + dd);
  536.             if (s != ss)
  537.                 errln((UnicodeString)"Fail: " + s + " != " + ss);
  538.             logln("Ok: " + s + " " + d);
  539.         }
  540.     /*}
  541.     catch (ParseException e) {
  542.         errln("Fail: " + e);
  543.         e.printStackTrace();
  544.     }*/
  545. }
  546.  
  547. /**
  548.  * @bug 4089106
  549.  */
  550. void DateFormatRegressionTest::Test4089106() 
  551. {
  552.     TimeZone *def = TimeZone::createDefault();
  553.     //try {
  554.         TimeZone *z = new SimpleTimeZone((int)(1.25 * 3600000), "FAKEZONE");
  555.         TimeZone::setDefault(*z);
  556.         UErrorCode status = U_ZERO_ERROR;
  557.         SimpleDateFormat *f = new SimpleDateFormat(status);
  558.         failure(status, "new SimpleDateFormat");
  559.         if (f->getTimeZone()!= *z)
  560.             errln("Fail: SimpleTimeZone should use TimeZone.getDefault()");
  561.         
  562.         //}
  563.     //finally {
  564.         TimeZone::setDefault(*def);
  565.     //}
  566.  
  567.     delete z;
  568.     delete f;
  569.     delete def;
  570. }
  571.  
  572. /**
  573.  * @bug 4100302
  574.  */
  575.  
  576. // {sfb} not applicable in C++??
  577.  
  578. void DateFormatRegressionTest::Test4100302() 
  579. {
  580. /*    Locale locales [] =  {
  581.         Locale::CANADA,
  582.         Locale::CANADA_FRENCH,
  583.         Locale::CHINA,
  584.         Locale::CHINESE,
  585.         Locale::ENGLISH,
  586.         Locale::FRANCE,
  587.         Locale::FRENCH,
  588.         Locale::GERMAN,
  589.         Locale::GERMANY,
  590.         Locale::ITALIAN,
  591.         Locale::ITALY,
  592.         Locale::JAPAN,
  593.         Locale::JAPANESE,
  594.         Locale::KOREA,
  595.         Locale::KOREAN,
  596.         Locale::PRC,
  597.         Locale::SIMPLIFIED_CHINESE,
  598.         Locale::TAIWAN,
  599.         Locale::TRADITIONAL_CHINESE,
  600.         Locale::UK,
  601.         Locale::US
  602.         };
  603.     //try {
  604.         bool_t pass = TRUE;
  605.         for(int i = 0; i < 21; i++) {
  606.  
  607.             Format *format = DateFormat::createDateTimeInstance(DateFormat::FULL,
  608.                 DateFormat::FULL, locales[i]);
  609.             byte[] bytes;
  610.         
  611.             ByteArrayOutputStream baos = new ByteArrayOutputStream();
  612.             ObjectOutputStream oos = new ObjectOutputStream(baos);
  613.         
  614.             oos.writeObject(format);
  615.             oos.flush();
  616.         
  617.             baos.close();
  618.             bytes = baos.toByteArray();
  619.         
  620.             ObjectInputStream ois =
  621.                 new ObjectInputStream(new ByteArrayInputStream(bytes));
  622.         
  623.             if (!format.equals(ois.readObject())) {
  624.                 pass = FALSE;
  625.                 logln("DateFormat instance for locale " +
  626.                       locales[i] + " is incorrectly serialized/deserialized.");
  627.             } else {
  628.                 logln("DateFormat instance for locale " +
  629.                       locales[i] + " is OKAY.");
  630.             }
  631.         }
  632.         if (!pass) errln("Fail: DateFormat serialization/equality bug");      
  633.     }
  634.     catch (IOException e) {
  635.         errln("Fail: " + e);
  636.         e.printStackTrace();
  637.     }
  638.     catch (ClassNotFoundException e) {
  639.         errln("Fail: " + e);
  640.         e.printStackTrace();
  641.     }
  642. */}
  643.  
  644. /**
  645.  * @bug 4101483
  646.  */
  647. void DateFormatRegressionTest::Test4101483() 
  648. {
  649.     UErrorCode status = U_ZERO_ERROR;
  650.     SimpleDateFormat *sdf = new SimpleDateFormat("z", Locale::US, status);
  651.     failure(status, "new SimpleDateFormat");
  652.     FieldPosition fp(DateFormat::TIMEZONE_FIELD);
  653.     //Date d = date(9234567890L);
  654.     UDate d = 9234567890.0;
  655.     //StringBuffer buf = new StringBuffer("");
  656.     UnicodeString buf;
  657.     sdf->format(d, buf, fp);
  658.     //logln(sdf.format(d, buf, fp).toString());
  659.     logln(dateToString(d) + " => " + buf);
  660.     logln("beginIndex = " + fp.getBeginIndex());
  661.     logln("endIndex = " + fp.getEndIndex());
  662.     if (fp.getBeginIndex() == fp.getEndIndex()) 
  663.         errln("Fail: Empty field");
  664.  
  665.     delete sdf;
  666. }
  667.  
  668. /**
  669.  * @bug 4103340
  670.  * @bug 4138203
  671.  * This bug really only works in Locale.US, since that's what the locale
  672.  * used for Date.toString() is.  Bug 4138203 reports that it fails on Korean
  673.  * NT; it would actually have failed on any non-US locale.  Now it should
  674.  * work on all locales.
  675.  */
  676. void DateFormatRegressionTest::Test4103340() 
  677. {
  678.     UErrorCode status = U_ZERO_ERROR;
  679.  
  680.     // choose a date that is the FIRST of some month 
  681.     // and some arbitrary time 
  682.     UDate d = date(97, 3, 1, 1, 1, 1); 
  683.     SimpleDateFormat *df = new SimpleDateFormat("MMMM", Locale::US, status); 
  684.     failure(status, "new SimpleDateFormat");
  685.  
  686.     UnicodeString s;
  687.     s = dateToString(d, s);
  688.     UnicodeString s2;
  689.     FieldPosition pos(FieldPosition::DONT_CARE);
  690.     s2 = df->format(d, s2, pos);
  691.     logln("Date=" + s); 
  692.     logln("DF=" + s2);
  693.     UnicodeString substr;
  694.     s2.extract(0,2, substr);
  695.     if (s.indexOf(substr) == -1)
  696.       errln("Months should match");
  697.     
  698.     delete df;
  699. }
  700.  
  701. /**
  702.  * @bug 4103341
  703.  */
  704. void DateFormatRegressionTest::Test4103341() 
  705. {
  706.     TimeZone *saveZone  =TimeZone::createDefault();
  707.     //try {
  708.         
  709.     // {sfb} changed from setDefault to adoptDefault
  710.     TimeZone::adoptDefault(TimeZone::createTimeZone("CST"));
  711.     UErrorCode status = U_ZERO_ERROR;
  712.     SimpleDateFormat *simple = new SimpleDateFormat("MM/dd/yyyy HH:mm", status);
  713.     failure(status, "new SimpleDateFormat");
  714.     TimeZone *temp = TimeZone::createDefault();
  715.     if(simple->getTimeZone() != *temp)
  716.             errln("Fail: SimpleDateFormat not using default zone");
  717.     //}
  718.     //finally {
  719.         TimeZone::adoptDefault(saveZone);
  720.     //}
  721.  
  722.     delete temp;
  723.     delete simple;
  724. }
  725.  
  726. /**
  727.  * @bug 4104136
  728.  */
  729. void DateFormatRegressionTest::Test4104136() 
  730. {
  731.     UErrorCode status = U_ZERO_ERROR;
  732.     SimpleDateFormat *sdf = new SimpleDateFormat(status); 
  733.     failure(status, "new SimpleDateFormat");
  734.     UnicodeString pattern = "'time' hh:mm"; 
  735.     sdf->applyPattern(pattern); 
  736.     logln("pattern: \"" + pattern + "\""); 
  737.  
  738.     UnicodeString strings [] = {
  739.         (UnicodeString)"time 10:30",
  740.         (UnicodeString) "time 10:x",
  741.         (UnicodeString) "time 10x"
  742.     };
  743.  
  744.     ParsePosition ppos [] = {
  745.         ParsePosition(10),
  746.         ParsePosition(0),
  747.         ParsePosition(0)
  748.     };
  749.  
  750.     UDate dates [] = {
  751.         date(70, Calendar::JANUARY, 1, 10, 30),
  752.         -1,
  753.         -1
  754.     };
  755.  
  756.     /*Object[] DATA = {
  757.         "time 10:30", new ParsePosition(10), new Date(70, Calendar.JANUARY, 1, 10, 30),
  758.         "time 10:x", new ParsePosition(0), null,
  759.         "time 10x", new ParsePosition(0), null,
  760.     };*/
  761.     
  762.     for(int i = 0; i < 3; i++) {
  763.         UnicodeString text = strings[i];
  764.         ParsePosition finish = ppos[i];
  765.         UDate exp = dates[i];
  766.         
  767.         ParsePosition pos(0);
  768.         UDate d = sdf->parse(text, pos);
  769.         logln(" text: \"" + text + "\""); 
  770.         logln(" index: " + pos.getIndex()); 
  771.         logln((UnicodeString) " result: " + d);
  772.         if(pos.getIndex() != finish.getIndex())
  773.             errln("Fail: Expected pos " + finish.getIndex());
  774.         if (! ((d == 0 && exp == -1) || (d == exp)))
  775.             errln((UnicodeString) "Fail: Expected result " + exp);
  776.     }
  777.  
  778.     delete sdf;
  779. }
  780.  
  781. /**
  782.  * @bug 4104522
  783.  * CANNOT REPRODUCE
  784.  * According to the bug report, this test should throw a
  785.  * StringIndexOutOfBoundsException during the second parse.  However,
  786.  * this is not seen.
  787.  */
  788. void DateFormatRegressionTest::Test4104522() 
  789. {
  790.     UErrorCode status = U_ZERO_ERROR;
  791.     
  792.     SimpleDateFormat *sdf = new SimpleDateFormat(status);
  793.     failure(status, "new SimpleDateFormat");
  794.     UnicodeString pattern = "'time' hh:mm";
  795.     sdf->applyPattern(pattern);
  796.     logln("pattern: \"" + pattern + "\"");
  797.  
  798.     // works correctly
  799.     ParsePosition pp(0);
  800.     UnicodeString text = "time ";
  801.     UDate dt = sdf->parse(text, pp);
  802.     logln(" text: \"" + text + "\"" +
  803.           " date: " + dt);
  804.  
  805.     // works wrong
  806.     pp.setIndex(0);
  807.     text = "time";
  808.     dt = sdf->parse(text, pp);
  809.     logln(" text: \"" + text + "\"" +
  810.           " date: " + dt);
  811. }
  812.  
  813. /**
  814.  * @bug 4106807
  815.  */
  816. void DateFormatRegressionTest::Test4106807() 
  817. {
  818.     UDate dt; 
  819.     DateFormat *df = DateFormat::createDateTimeInstance(); 
  820.     
  821.     UErrorCode status = U_ZERO_ERROR;
  822.     SimpleDateFormat *sdfs [] = {
  823.         new SimpleDateFormat("yyyyMMddHHmmss", status),
  824.         new SimpleDateFormat("yyyyMMddHHmmss'Z'", status),
  825.         new SimpleDateFormat("yyyyMMddHHmmss''", status),
  826.         new SimpleDateFormat("yyyyMMddHHmmss'a''a'", status),
  827.         new SimpleDateFormat("yyyyMMddHHmmss %", status)
  828.     };
  829.     failure(status, "new SimpleDateFormat");
  830.     
  831.     UnicodeString strings [] = {
  832.         (UnicodeString) "19980211140000",
  833.         (UnicodeString) "19980211140000",
  834.         (UnicodeString) "19980211140000",
  835.         (UnicodeString) "19980211140000a",
  836.         (UnicodeString) "19980211140000 "
  837.     };
  838.  
  839.     /*Object[] data = {
  840.         new SimpleDateFormat("yyyyMMddHHmmss"),       "19980211140000",
  841.         new SimpleDateFormat("yyyyMMddHHmmss'Z'"),    "19980211140000",
  842.         new SimpleDateFormat("yyyyMMddHHmmss''"),     "19980211140000",
  843.         new SimpleDateFormat("yyyyMMddHHmmss'a''a'"), "19980211140000a",
  844.         new SimpleDateFormat("yyyyMMddHHmmss %"),     "19980211140000 ",
  845.     };*/
  846.     GregorianCalendar *gc = new GregorianCalendar(status);
  847.     failure(status, "new GregorianCalendar");
  848.     TimeZone *timeZone = TimeZone::createDefault(); 
  849.  
  850.     TimeZone *gmt = timeZone->clone(); 
  851.  
  852.     gmt->setRawOffset(0); 
  853.  
  854.     for(int32_t i = 0; i < 5; i++) {
  855.         SimpleDateFormat *format = sdfs[i];
  856.         UnicodeString dateString = strings[i];
  857.         //try {
  858.             format->setTimeZone(*gmt); 
  859.             dt = format->parse(dateString, status);
  860.             // {sfb} some of these parses will fail purposely
  861.             if(U_FAILURE(status))
  862.                 break;
  863.             status = U_ZERO_ERROR;
  864.             UnicodeString fmtd;
  865.             FieldPosition pos(FieldPosition::DONT_CARE);
  866.             fmtd = df->format(dt, fmtd, pos);
  867.             logln(fmtd);
  868.             //logln(df->format(dt)); 
  869.             gc->setTime(dt, status); 
  870.             failure(status, "gc->getTime");
  871.             logln(UnicodeString("") + gc->get(Calendar::ZONE_OFFSET, status));
  872.             failure(status, "gc->get");
  873.             UnicodeString s;
  874.             s = format->format(dt, s, pos);
  875.             logln(s); 
  876.         /*}
  877.         catch (ParseException e) { 
  878.             logln("No way Jose"); 
  879.         }*/ 
  880.     } 
  881.  
  882.     delete timeZone;
  883.     delete df;
  884.     for(int32_t j = 0; j < 5; j++)
  885.         delete sdfs [j];
  886.      delete gc;
  887.     delete gmt;
  888. }
  889.  
  890. /*
  891.   Synopsis: Chinese time zone CTT is not recogonized correctly.
  892.   Description: Platform Chinese Windows 95 - ** Time zone set to CST ** 
  893.   */
  894. /**
  895.  * @bug 4108407
  896.  */
  897.  
  898. // {sfb} what to do with this one ?? 
  899. void DateFormatRegressionTest::Test4108407() 
  900.     /*long l = System.currentTimeMillis(); 
  901.     logln("user.timezone = " + System.getProperty("user.timezone", "?"));
  902.     logln("Time Zone :" + 
  903.                        DateFormat.getDateInstance().getTimeZone().getID()); 
  904.     logln("Default format :" + 
  905.                        DateFormat.getDateInstance().format(new Date(l))); 
  906.     logln("Full format :" + 
  907.                        DateFormat.getDateInstance(DateFormat.FULL).format(new 
  908.                                                                           Date(l))); 
  909.     logln("*** Set host TZ to CST ***");
  910.     logln("*** THE RESULTS OF THIS TEST MUST BE VERIFIED MANUALLY ***");*/
  911.  
  912. /**
  913.  * @bug 4134203
  914.  * SimpleDateFormat won't parse "GMT"
  915.  */
  916. void DateFormatRegressionTest::Test4134203() 
  917. {
  918.     UErrorCode status = U_ZERO_ERROR;
  919.     UnicodeString dateFormat = "MM/dd/yy HH:mm:ss zzz";
  920.     SimpleDateFormat *fmt = new SimpleDateFormat(dateFormat, status);
  921.     failure(status, "new SimpleDateFormat");
  922.     ParsePosition p0(0);
  923.     UDate d = fmt->parse("01/22/92 04:52:00 GMT", p0);
  924.     logln(dateToString(d));
  925.     if(p0 == ParsePosition(0))
  926.         errln("Fail: failed to parse 'GMT'");
  927.     // In the failure case an exception is thrown by parse();
  928.     // if no exception is thrown, the test passes.
  929.  
  930.     delete fmt;
  931. }
  932.  
  933. /**
  934.  * @bug 4151631
  935.  * SimpleDateFormat incorrect handling of 2 single quotes in format()
  936.  */
  937. void DateFormatRegressionTest::Test4151631() 
  938. {
  939.     UnicodeString pattern = "'TO_DATE('''dd'-'MM'-'yyyy HH:mm:ss''' , ''DD-MM-YYYY HH:MI:SS'')'";
  940.     logln("pattern=" + pattern);
  941.     UErrorCode status = U_ZERO_ERROR;
  942.     SimpleDateFormat *format = new SimpleDateFormat(pattern, Locale::US, status);
  943.     failure(status, "new SimpleDateFormat");
  944.     UnicodeString result;
  945.     FieldPosition pos(FieldPosition::DONT_CARE);
  946.     result = format->format(date(1998-1900, Calendar::JUNE, 30, 13, 30, 0), result, pos);
  947.     if (result != "TO_DATE('30-06-1998 13:30:00' , 'DD-MM-YYYY HH:MI:SS')") {
  948.         errln("Fail: result=" + result);
  949.     }
  950.     else {
  951.         logln("Pass: result=" + result);
  952.     }
  953.  
  954.     delete format;
  955. }
  956.  
  957. /**
  958.  * @bug 4151706
  959.  * 'z' at end of date format throws index exception in SimpleDateFormat
  960.  * CANNOT REPRODUCE THIS BUG ON 1.2FCS
  961.  */
  962. void DateFormatRegressionTest::Test4151706() 
  963. {
  964.     UErrorCode status = U_ZERO_ERROR;
  965.     SimpleDateFormat *fmt =
  966.         new SimpleDateFormat("EEEE, dd-MMM-yy HH:mm:ss z", Locale::US, status);
  967.     failure(status, "new SimpleDateFormat");
  968.     //try {
  969.         UDate d = fmt->parse("Thursday, 31-Dec-98 23:00:00 GMT", status);
  970.         failure(status, "fmt->parse");
  971.        // {sfb} what about next two lines?
  972.         //if (d.getTime() != Date.UTC(1998-1900, Calendar.DECEMBER, 31, 23, 0, 0))
  973.         //    errln("Incorrect value: " + d);
  974.     /*} catch (Exception e) {
  975.         errln("Fail: " + e);
  976.     }*/
  977. }
  978.  
  979. /**
  980.  * @bug 4162071
  981.  * Cannot reproduce this bug under 1.2 FCS -- it may be a convoluted duplicate
  982.  * of some other bug that has been fixed.
  983.  */
  984. void 
  985. DateFormatRegressionTest::Test4162071() 
  986. {
  987.     UnicodeString dateString("Thu, 30-Jul-1999 11:51:14 GMT");
  988.     UnicodeString format("EEE', 'dd-MMM-yyyy HH:mm:ss z"); // RFC 822/1123
  989.     UErrorCode status = U_ZERO_ERROR;
  990.     SimpleDateFormat df(format, Locale::US, status);
  991.     if(U_FAILURE(status))
  992.         errln("Couldn't create SimpleDateFormat");
  993.     
  994.     //try {
  995.         UDate x = df.parse(dateString, status);
  996.         if(U_SUCCESS(status))
  997.             logln("Parse format \"" + format + "\" ok");
  998.         else
  999.             errln("Parse format \"" + format + "\" failed.");
  1000.         UnicodeString temp;
  1001.         FieldPosition pos(0);
  1002.         logln(dateString + " -> " + df.format(x, temp, pos));
  1003.     //} catch (Exception e) {
  1004.     //    errln("Parse format \"" + format + "\" failed.");
  1005.     //}
  1006. }
  1007.  
  1008. /**
  1009.  * DateFormat shouldn't parse year "-1" as a two-digit year (e.g., "-1" -> 1999).
  1010.  */
  1011. void DateFormatRegressionTest::Test4182066() {
  1012.     UErrorCode status = U_ZERO_ERROR;
  1013.     SimpleDateFormat fmt("MM/dd/yy", Locale::US, status);
  1014.     SimpleDateFormat dispFmt("MMM dd yyyy GG", Locale::US, status);
  1015.     if (U_FAILURE(status)) {
  1016.         errln("Couldn't create SimpleDateFormat");
  1017.         return;
  1018.     }
  1019.  
  1020.     /* We expect 2-digit year formats to put 2-digit years in the right
  1021.      * window.  Out of range years, that is, anything less than "00" or
  1022.      * greater than "99", are treated as literal years.  So "1/2/3456"
  1023.      * becomes 3456 AD.  Likewise, "1/2/-3" becomes -3 AD == 2 BC.
  1024.      */
  1025.     const char* STRINGS[] = {
  1026.         "02/29/00",
  1027.         "01/23/01",
  1028.         "04/05/-1",
  1029.         "01/23/-9",
  1030.         "11/12/1314",
  1031.         "10/31/1",
  1032.         "09/12/+1",
  1033.         "09/12/001",
  1034.     };
  1035.     int32_t STRINGS_COUNT = sizeof(STRINGS) / sizeof(STRINGS[0]);
  1036.     UDate FAIL_DATE = (UDate) 0;
  1037.     UDate DATES[] = {
  1038.         date(2000-1900, Calendar::FEBRUARY, 29),
  1039.         date(2001-1900, Calendar::JANUARY,  23),
  1040.         date(  -1-1900, Calendar::APRIL,     5),
  1041.         date(  -9-1900, Calendar::JANUARY,  23),
  1042.         date(1314-1900, Calendar::NOVEMBER, 12),
  1043.         date(   1-1900, Calendar::OCTOBER,  31),
  1044.         FAIL_DATE, // "+1" isn't recognized by US NumberFormat
  1045.         date(   1-1900, Calendar::SEPTEMBER,12),
  1046.     };
  1047.  
  1048.     UnicodeString out;
  1049.     bool_t pass = TRUE;
  1050.     for (int32_t i=0; i<STRINGS_COUNT; ++i) {
  1051.         UnicodeString str(STRINGS[i]);
  1052.         UDate expected = DATES[i];
  1053.         status = U_ZERO_ERROR;
  1054.         UDate actual = fmt.parse(str, status);
  1055.         if (U_FAILURE(status)) {
  1056.             actual = FAIL_DATE;
  1057.         }
  1058.         UnicodeString actStr;
  1059.         if (actual == FAIL_DATE) {
  1060.             actStr.append("null");
  1061.         } else {
  1062.             // Yuck: See j25
  1063.             ((DateFormat*)&dispFmt)->format(actual, actStr);
  1064.         }
  1065.  
  1066.         if (expected == actual) {
  1067.             out.append(str + " => " + actStr + "\n");
  1068.         } else {
  1069.             UnicodeString expStr;
  1070.             if (expected == FAIL_DATE) {
  1071.                 expStr.append("null");
  1072.             } else {
  1073.                 // Yuck: See j25
  1074.                 ((DateFormat*)&dispFmt)->format(expected, expStr);
  1075.             }
  1076.             out.append("FAIL: " + str + " => " + actStr
  1077.                        + ", expected " + expStr + "\n");
  1078.             pass = FALSE;
  1079.         }
  1080.     }
  1081.     if (pass) {
  1082.         log(out);
  1083.     } else {
  1084.         err(out);
  1085.     }
  1086. }
  1087.  
  1088. /**
  1089.  * j32 {JDK Bug 4210209 4209272}
  1090.  * DateFormat cannot parse Feb 29 2000 when setLenient(false)
  1091.  */
  1092. void
  1093. DateFormatRegressionTest::Test4210209() {
  1094.     UErrorCode status = U_ZERO_ERROR;
  1095.     UnicodeString pattern("MMM d, yyyy");
  1096.     SimpleDateFormat sfmt(pattern, Locale::US, status);
  1097.     SimpleDateFormat sdisp("MMM dd yyyy GG", Locale::US, status);
  1098.     DateFormat& fmt = *(DateFormat*)&sfmt; // Yuck: See j25
  1099.     DateFormat& disp = *(DateFormat*)&sdisp; // Yuck: See j25
  1100.     if (U_FAILURE(status)) {
  1101.         errln("Couldn't create SimpleDateFormat");
  1102.         return;
  1103.     }
  1104.     Calendar* calx = (Calendar*)fmt.getCalendar(); // cast away const!
  1105.     calx->setLenient(FALSE);
  1106.     UDate d = date(2000-1900, Calendar::FEBRUARY, 29);
  1107.     UnicodeString s, ss;
  1108.     fmt.format(d, s);
  1109.     logln(disp.format(d, ss.remove()) + " f> " + pattern +
  1110.           " => \"" + s + "\"");
  1111.     ParsePosition pos(0);
  1112.     d = fmt.parse(s, pos);
  1113.     logln(UnicodeString("\"") + s + "\" p> " + pattern +
  1114.           " => " + disp.format(d, ss.remove()));
  1115.     logln(UnicodeString("Parse pos = ") + pos.getIndex() +
  1116.           ", error pos = " + pos.getErrorIndex());
  1117.     if (pos.getErrorIndex() != -1) {
  1118.         errln(UnicodeString("FAIL: Error index should be -1"));
  1119.     }
  1120.  
  1121.     // The underlying bug is in GregorianCalendar.  If the following lines
  1122.     // succeed, the bug is fixed.  If the bug isn't fixed, they will throw
  1123.     // an exception.
  1124.     GregorianCalendar cal(status);
  1125.     if (U_FAILURE(status)) {
  1126.         errln("FAIL: Unable to create Calendar");
  1127.         return;
  1128.     }
  1129.     cal.clear();
  1130.     cal.setLenient(FALSE);
  1131.     cal.set(2000, Calendar::FEBRUARY, 29); // This should work!
  1132.     logln(UnicodeString("Attempt to set Calendar to Feb 29 2000: ") +
  1133.                         disp.format(cal.getTime(status), ss.remove()));
  1134.     if (U_FAILURE(status)) {
  1135.         errln("FAIL: Unable to set Calendar to Feb 29 2000");
  1136.     }
  1137. }
  1138.  
  1139. //eof
  1140.