Lines Matching refs:UnicodeString
38 // if (exec) logln((UnicodeString)"TestSuite DateFormatTest");
108 SimpleDateFormat *sdf = new SimpleDateFormat((UnicodeString)"zzzz", status);
130 const UnicodeString* id = ids->snext(status);
145 UnicodeString dstOffset = (UnicodeString)"" + sign + (hours < 10 ? "0" : "") +
157 UnicodeString fmtOffset;
160 // UnicodeString fmtOffset = tzS.toString();
161 UnicodeString *fmtDstOffset = 0;
165 fmtDstOffset = new UnicodeString();
174 logln(UnicodeString() + i + " " + *id + " " + dstOffset +
180 errln(UnicodeString() + i + " " + *id + " " + dstOffset +
210 if (!(*fmtA == *fmtB)) errln((UnicodeString)"FAIL");
227 SimpleDateFormat* fullFmt = new SimpleDateFormat((UnicodeString)"EEE MMM dd HH:mm:ss.SSS zzz yyyy G", status);
228 SimpleDateFormat *fmt = new SimpleDateFormat((UnicodeString)"dd-MMM-yy h:mm:ss 'o''clock' a z", Locale::getEnglish(), status);
230 UnicodeString* s = new UnicodeString("03-Apr-04 2:20:47 o'clock AM PST", "");
239 UnicodeString str;
253 errln((UnicodeString)"FAIL: Should parse to hour " + hour + " but got " + hr);
256 errln((UnicodeString)"FAIL: " + (int32_t)status);
269 UnicodeString&
270 DateFormatTest::escape(UnicodeString& s)
272 UnicodeString buf;
341 UnicodeString buf;
374 errln(UnicodeString("Could not create SimpleDateFormat object for locale en_US. Error: " )+ UnicodeString(u_errorName(ec)));
411 logln((UnicodeString)" Result = " + df->format(aug13, buf.remove()));
418 UnicodeString field;
420 assertEquals((UnicodeString)"field #" + i + " " + DATEFORMAT_FIELD_NAMES[i],
435 UnicodeString field;
437 assertEquals((UnicodeString)"field #" + i + " " + DATEFORMAT_FIELD_NAMES[i],
498 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
509 logln(UnicodeString("Pattern \"") + pat + "\" String \"" + str + "\"");
515 logln((UnicodeString)"ParseException: " + (int32_t)status);
516 if (expected != null) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
520 UnicodeString f;
522 logln(UnicodeString(" parse(") + str + ") -> " + dateToString(date));
523 logln((UnicodeString)" format -> " + f);
525 !(date == expected)) errln((UnicodeString)"FAIL: Expected null");//" + expected);
526 if (!(f == str)) errln(UnicodeString("FAIL: Expected ") + str);
530 // logln((UnicodeString)"ParseException: " + e.getMessage());
531 // if (expected != null) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
534 // errln((UnicodeString)"*** Exception:");
549 UnicodeString format("yyyyMMddHHmmssSSS");
550 UnicodeString now, then;
566 if (!(date2 == date1)) errln((UnicodeString)"FAIL");
568 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
582 UnicodeString myDate;
583 fmt = new SimpleDateFormat((UnicodeString)"yyyy/MM/dd", status);
592 fmt = new SimpleDateFormat((UnicodeString)"yyyyMMdd", status);
596 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
602 DateFormatTest::testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expected)
605 UnicodeString pattern;
606 logln((UnicodeString)"pattern=" + fmt->toPattern(pattern) + " string=" + str);
616 logln((UnicodeString)"Parsed object: " + dateToString(o.getDate()));
617 if (!(o.getDate() == expected)) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
618 UnicodeString formatted; ((Format*)fmt)->format(o, formatted, status);
619 logln((UnicodeString)"Formatted string: " + formatted);
620 if (!(formatted == str)) errln((UnicodeString)"FAIL: Expected " + str);
621 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
640 UnicodeString pattern;
641 logln((UnicodeString)"Pattern " + ((SimpleDateFormat*) fmt)->toPattern(pattern));
644 UnicodeString juneStr; fmt->format(june, juneStr);
645 UnicodeString julyStr; fmt->format(july, julyStr);
647 logln((UnicodeString)"format(June 15 1997) = " + juneStr);
649 UnicodeString s; fmt->format(d, s);
651 logln((UnicodeString)" -> parse -> " + s + " (month = " + month + ")");
652 if (month != UCAL_JUNE) errln((UnicodeString)"FAIL: Month should be June");
653 logln((UnicodeString)"format(July 15 1997) = " + julyStr);
657 logln((UnicodeString)" -> parse -> " + s + " (month = " + month + ")");
658 if (month != UCAL_JULY) errln((UnicodeString)"FAIL: Month should be July");
662 errln((UnicodeString)"Exception: " + (int32_t)status);
676 UnicodeString dateString("1995-040.05:01:29");
677 UnicodeString bigD("yyyy-DDD.hh:mm:ss");
678 UnicodeString littleD("yyyy-ddd.hh:mm:ss");
682 logln((UnicodeString)"dateString= " + dateString);
691 logln((UnicodeString)"Using " + bigD + " -> " + myDate);
692 if (myDate != expBigD) errln((UnicodeString)"FAIL: Expected " + dateToString(expBigD));
698 logln((UnicodeString)"Using " + littleD + " -> " + dateToString(myDate));
699 if (myDate != expLittleD) errln((UnicodeString)"FAIL: Expected " + dateToString(expLittleD));
701 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
716 logln((UnicodeString)"Test Date: " + dateToString(today));
725 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
735 UnicodeString thePat;
736 logln((UnicodeString)"pattern: " + sdf.toPattern(thePat));
737 UnicodeString formatResult; (*(DateFormat*)&sdf).format(d, formatResult);
738 logln((UnicodeString)" format -> " + formatResult);
741 logln((UnicodeString)" parse(" + formatResult + ") -> " + dateToString(d2));
742 if (d2 != expected) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
743 UnicodeString format2; (*(DateFormat*)&sdf).format(d2, format2);
744 logln((UnicodeString)" format -> " + format2);
745 if (!(formatResult == format2)) errln((UnicodeString)"FAIL: Round trip drift");
749 errln((UnicodeString)"Error: " + (int32_t)status);
762 SimpleDateFormat* formatter = new SimpleDateFormat((UnicodeString)"MM/dd/yyyy 'at' hh:mm:ss a zzz", status);
769 UnicodeString dateString; ((DateFormat*)formatter)->format(currentTime_1, dateString);
770 UnicodeString exp("08/13/1997 at 10:42:28 AM ");
771 logln((UnicodeString)"format(" + dateToString(currentTime_1) + ") = " + dateString);
772 if (0 != dateString.compareBetween(0, exp.length(), exp, 0, exp.length())) errln((UnicodeString)"FAIL: Expected " + exp);
774 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
799 UnicodeString expected("March 1, 2000 1:23:45 AM ");
811 UnicodeString prefix = UnicodeString(text) + ", " + dateLook + "/" + timeLook + ": ";
820 UnicodeString format;
824 errln((UnicodeString)"FAIL: Expected " + expected + " got " + format);
840 errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
894 UnicodeString thePat;
895 logln(UnicodeString("Trying to parse \"") + s + "\" with " + dateParse->toPattern(thePat));
899 errln((UnicodeString)"FAIL: Expected exception during parse");
903 logln((UnicodeString)"Exception during parse: " + (int32_t)status);
908 UnicodeString s( inputStrings[i]);
917 UnicodeString s1, s2;
921 errln((UnicodeString)"ERROR: null result fmt=\"" +
927 UnicodeString result;
929 logln((UnicodeString)"Parsed \"" + s + "\" using \"" + dateParse->toPattern(thePat) + "\" to: " + result);
931 errln((UnicodeString)"FAIL: Expected parse failure");
933 errln(UnicodeString("FAIL: Expected ") + expected);
937 errln(UnicodeString("FAIL: Expected ") + expected + " from \"" +
943 errln((UnicodeString)"An exception was thrown during parse: " + (int32_t)status);
949 errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
978 UnicodeString thePat;
979 logln(UnicodeString("Parsing \"") + str + "\" with " + ((SimpleDateFormat*)&fmt)->toPattern(thePat) +
981 if (d != expected) errln((UnicodeString)"FAIL: Expected " + expected);
985 errln((UnicodeString)"FAIL: Got exception");
1001 logln((UnicodeString)"Date 1997/3/25 00:00 GMT: " + date);
1002 formatter = new SimpleDateFormat((UnicodeString)"dd-MMM-yyyyy HH:mm", Locale::getUK(), status);
1009 UnicodeString temp; formatter->format(date, temp);
1010 logln((UnicodeString)"Formatted in GMT to: " + temp);
1013 logln((UnicodeString)"Parsed to: " + dateToString(tempDate));
1014 if (tempDate != date) errln((UnicodeString)"FAIL: Expected " + dateToString(date));
1018 errln((UnicodeString)"Date Formatter throws: " + (int32_t)status);
1040 UnicodeString testtimezone;
1061 UnicodeString DATA [] = {
1062 UnicodeString("simple format: "), UnicodeString("04/04/97 23:00 GMT+00:00"),
1063 UnicodeString("MM/dd/yy HH:mm z"),
1064 UnicodeString("full format: "), UnicodeString("Friday, April 4, 1997 11:00:00 o'clock PM GMT+00:00"),
1065 UnicodeString("EEEE, MMMM d, yyyy h:mm:ss 'o''clock' a z"),
1066 UnicodeString("long format: "), UnicodeString("April 4, 1997 11:00:00 PM GMT+00:00"),
1067 UnicodeString("MMMM d, yyyy h:mm:ss a z"),
1068 UnicodeString("default format: "), UnicodeString("04-Apr-97 11:00:00 PM"),
1069 UnicodeString("dd-MMM-yy h:mm:ss a"),
1070 UnicodeString("short format: "), UnicodeString("4/4/97 11:00 PM"),
1071 UnicodeString("M/d/yy h:mm a")
1079 UnicodeString result;
1111 UnicodeString expectedFRENCH ( "lundi 15 septembre 1997 00:00:00 heure avanc\\u00E9e du Pacifique", -1, US_INV );
1113 //UnicodeString expectedUS ( "Monday, September 15, 1997 12:00:00 o'clock AM PDT" );
1114 UnicodeString expectedUS ( "Monday, September 15, 1997 12:00:00 AM Pacific Daylight Time" );
1115 logln((UnicodeString)"Date set to : " + dateToString(testDate));
1116 UnicodeString out;
1125 logln((UnicodeString)"Date Formated with French Locale " + out);
1127 errln((UnicodeString)"FAIL: Expected " + expectedFRENCH);
1130 logln((UnicodeString)"Date Formated with US Locale " + out);
1132 errln((UnicodeString)"FAIL: Expected " + expectedUS);
1143 UnicodeString str;
1173 errln((UnicodeString)"FAIL: Calendar::createInstance failed with " +
1180 str = UnicodeString("4/5/2001", "");
1184 errln((UnicodeString)"FAIL: DateFormat::parse(4/5/2001) failed at " +
1190 str = UnicodeString("5:45 PM", "");
1194 errln((UnicodeString)"FAIL: DateFormat::parse(17:45) failed at " +
1202 errln((UnicodeString)"FAIL: cal->getTime() failed with " + u_errorName(ec));
1283 SimpleDateFormat f(UnicodeString("Yesterday"), ec);
1288 UnicodeString out;
1304 UnicodeString str;
1597 const UnicodeString FAIL_STR("parse failure");
1621 UnicodeString gotstr(FAIL_STR);
1631 UnicodeString expstr(FAIL_STR);
1644 logln((UnicodeString)"Ok: " + input + " x " +
1647 errln((UnicodeString)"FAIL: " + input + " x " +
1684 UnicodeString str, str2;
1693 UnicodeString currentPat;
1709 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1717 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1718 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1731 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1732 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1738 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1748 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1753 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1754 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1761 errln((UnicodeString)"FAIL: Invalid control string " + control);
1788 UnicodeString str, str2;
1797 UnicodeString currentPat;
1810 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1864 UnicodeString basepat("yy/MM/dd H:mm ");
1877 UnicodeString test;
1880 const UnicodeString times[] = {
1887 logln(UnicodeString("\ntime: ") + d);
1896 errln((UnicodeString)"FAIL: format " + k +
1901 logln((UnicodeString)"OK: format " + k + " parsed ok");
1904 errln((UnicodeString)"FAIL: format " + k +
1947 UnicodeString test;
1957 UnicodeString input;
1958 UnicodeString expected_result;
1966 UnicodeString result;
2003 UnicodeString bannerStr(banner, "");
2008 UnicodeString test;
2038 UnicodeString result;
2039 UnicodeString normalResult;
2040 UnicodeString expect;
2041 UnicodeString parseResult;
2073 UnicodeString parseFormat; // parse rel->format full
2076 UnicodeString origFormat;
2121 UnicodeString result1;
2127 UnicodeString result2;
2151 UnicodeString result1;
2157 UnicodeString result2;
2948 UnicodeString info[5];
2950 info[j] = UnicodeString(testLine[j], -1, US_INV);
2966 UnicodeString result;
3013 UnicodeString buf;
3026 UnicodeString refStr(buf);
3041 errln((UnicodeString)"FAIL: Different format result with a different calendar for the same time -"
3072 UnicodeString tzid;
3073 errln((UnicodeString)"FAIL: Different parse result with a different calendar for the same string -"
3084 errln((UnicodeString)"FAIL: " + u_errorName(status));
3124 SimpleDateFormat *fmt1 = new SimpleDateFormat(UnicodeString("y-M-d"), Locale("ar"), status);
3128 UnicodeString str1;
3135 UnicodeString str11;
3140 errln((UnicodeString)"FAIL: Different dates str1:" + str1
3148 SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("y M d"), Locale("ar"), status);
3152 UnicodeString str2;
3159 UnicodeString str22;
3164 errln((UnicodeString)"FAIL: Different dates str1:" + str2
3172 SimpleDateFormat *fmt3 = new SimpleDateFormat(UnicodeString("y-M-d"), Locale("en-us"), status);
3176 UnicodeString str3;
3183 UnicodeString str33;
3188 errln((UnicodeString)"FAIL: Different dates str1:" + str3
3196 SimpleDateFormat *fmt4 = new SimpleDateFormat(UnicodeString("y M d"), Locale("en-us"), status);
3200 UnicodeString str4;
3207 UnicodeString str44;
3212 errln((UnicodeString)"FAIL: Different dates str1:" + str4
3225 UnicodeString strf, strl, strm, strs;
3251 errln((UnicodeString)"FAIL: Improper formatted date: " + strf);
3254 errln((UnicodeString)"FAIL: Improper formatted date: " + strl);
3259 errln((UnicodeString)"FAIL: Improper formatted date: " + strm );
3263 errln((UnicodeString)"FAIL: Improper formatted date: " + strs);
3301 UnicodeString s1, s2;
3366 SimpleDateFormat *fmt1 = new SimpleDateFormat(UnicodeString("GGG yyyy-MM-dd'T'HH:mm:ss'Z"), status);
3371 UnicodeString in = data[i];
3378 UnicodeString out;
3383 UnicodeString expected = data[i+1];
3385 dataerrln((UnicodeString)"FAIL: " + in + " -> " + out + " expected -> " + expected);
3394 UnicodeString pattern ("y\\u5e74M\\u6708d\\u65e5", -1, US_INV );
3396 UnicodeString override ("y=hanidec;M=hans;d=hans", -1, US_INV );
3404 UnicodeString result;
3407 UnicodeString expected = "\\u4e8c\\u3007\\u3007\\u4e5d\\u5e74\\u4e03\\u6708\\u4e8c\\u5341\\u516b\\u65e5";
3410 dataerrln((UnicodeString)"FAIL: -> " + result + " expected -> " + expected);
3415 UnicodeString pat1 ("yyyy-MM-dd'T'HH:mm:ss'Z'", -1, US_INV );
3417 UnicodeString parsedres,expres;
3420 errln((UnicodeString)"FAIL: parsed -> " + parsedres + " expected -> " + expres);