Home | History | Annotate | Download | only in intltest

Lines Matching refs:status

113 CalendarRegressionTest::failure(UErrorCode status, const char* msg)
115 if(U_FAILURE(status)) {
116 errcheckln(status, UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
129 UErrorCode status = U_ZERO_ERROR;
130 GregorianCalendar *cal = (GregorianCalendar*)Calendar::createInstance(status);
131 if(U_FAILURE(status)) {
132 dataerrln("Error creating Calendar: %s", u_errorName(status));
136 failure(status, "Calendar::createInstance(status)");
139 UDate d = cal->getTime(status); // Should be Jan 1
140 failure(status, "cal->getTime");
152 UErrorCode status = U_ZERO_ERROR;
153 GregorianCalendar *cal = new GregorianCalendar(status);
154 if(U_FAILURE(status)) {
155 dataerrln("Error creating Calendar: %s", u_errorName(status));
159 failure(status, "new GregorianCalendar");
163 logln(UnicodeString("HOUR=") + cal->get(UCAL_HOUR, status)); //prints 0
164 failure(status, "cal->get");
165 logln(UnicodeString("HOUR_OF_DAY=") + cal->get(UCAL_HOUR_OF_DAY, status));
166 failure(status, "cal->get");
175 UErrorCode status = U_ZERO_ERROR;
176 GregorianCalendar *cal1 = new GregorianCalendar(status) ;
177 if(U_FAILURE(status)) {
178 dataerrln("Error creating Calendar: %s", u_errorName(status));
182 failure(status, "new GregorianCalendar");
187 cal1->add(UCAL_DATE, 1, status) ;
188 failure(status, "cal1->add");
198 UErrorCode status = U_ZERO_ERROR;
200 log(UnicodeString("") + cal->get(UCAL_MONTH, status)) ;
201 failure(status, "cal->get");
202 int32_t date = cal->get(UCAL_DATE, status) + 1 ;
203 failure(status, "cal->get");
205 logln(UnicodeString("/") + cal->get(UCAL_YEAR, status)) ;
206 failure(status, "cal->get");
217 UErrorCode status = U_ZERO_ERROR;
221 failure(status, "new TimeZone");
222 GregorianCalendar *cl = new GregorianCalendar(tz, status);
223 if (U_FAILURE(status)) {
224 dataerrln("Fail new GregorianCalendar: %s", u_errorName(status));
230 cl->get(UCAL_HOUR, status);
231 failure(status, "cl->get(UCAL_HOUR, status)");
232 status = U_ZERO_ERROR;
234 for (int32_t i=0; i<ids->count(status); ++i) {
235 TimeZone *zone = TimeZone::createTimeZone(*ids->snext(status));
236 GregorianCalendar *cal = new GregorianCalendar(zone, status);
237 failure(status, "new GregorianCalendar");
240 if (cal->get(UCAL_HOUR, status) != 5 || U_FAILURE(status)) {
244 cal->get(UCAL_DST_OFFSET,status) / (60*60*1000) + " " +
246 ": HOUR = " + cal->get(UCAL_HOUR,status));
262 UErrorCode status = U_ZERO_ERROR;
263 GregorianCalendar *c = new GregorianCalendar(98, 8, 7,status);
264 GregorianCalendar *d = new GregorianCalendar(98, 8, 7,status);
265 if (c->after(*d,status) ||
266 c->after(*c,status) ||
267 c->before(*d,status) ||
268 c->before(*c,status) ||
283 UErrorCode status = U_ZERO_ERROR;
284 count = ids->count(status);
285 SimpleTimeZone *pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, *ids->snext(status));
286 pdt->setStartRule(UCAL_APRIL, 1, UCAL_SUNDAY, 2 * 60 * 60 * 1000, status);
287 pdt->setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2 * 60 * 60 * 1000, status);
288 Calendar *calendar = new GregorianCalendar(pdt, status);
289 if (U_FAILURE(status)) {
290 dataerrln("Fail new GregorianCalendar: %s", u_errorName(status));
297 logln(UnicodeString("MONTH: ") + calendar->get(UCAL_MONTH, status));
299 calendar->get(UCAL_DATE, status));
300 logln(UnicodeString("MINUTE: ") + calendar->get(UCAL_MINUTE, status));
301 logln(UnicodeString("SECOND: ") + calendar->get(UCAL_SECOND, status));
303 calendar->add(UCAL_SECOND,6, status);
307 logln(UnicodeString("MONTH: ") + calendar->get(UCAL_MONTH, status));
309 calendar->get(UCAL_DATE, status));
310 logln(UnicodeString("MINUTE: ") + calendar->get(UCAL_MINUTE, status));
311 logln(UnicodeString("SECOND: ") + calendar->get(UCAL_SECOND, status));
312 if (calendar->get(UCAL_MONTH, status) != 3 ||
313 calendar->get(UCAL_DATE, status) != 18 ||
314 calendar->get(UCAL_SECOND, status) != 36)
327 UErrorCode status = U_ZERO_ERROR;
328 Calendar *cal = Calendar::createInstance(status);
329 if(U_FAILURE(status)) {
330 dataerrln("Error creating Calendar: %s", u_errorName(status));
337 cal->getTime(status);
338 if( ! U_FAILURE(status))
351 GregorianCalendar calendar = new GregorianCalendar(status);
410 UErrorCode status = U_ZERO_ERROR;
411 GregorianCalendar *gc = new GregorianCalendar(status);
412 if(U_FAILURE(status)) {
413 dataerrln("Error creating Calendar: %s", u_errorName(status));
426 UDate cd = gc->getTime(status);
427 GregorianCalendar *exp = new GregorianCalendar(1997, 3, 1, 0, 0, 0, status);
428 if (cd != exp->getTime(status))
429 errln(UnicodeString("Fail: Calendar::set broken. Got ") + cd + " Want " + exp->getTime(status));
440 UErrorCode status = U_ZERO_ERROR;
441 SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("ddMMMyy"), Locale::getUK(),status);
443 Locale::getUK(),status);
444 if(U_FAILURE(status)) {
445 dataerrln("Error creating Calendar: %s", u_errorName(status));
452 UDate date = fmt->parse("29MAY97", status);
453 failure(status, "fmt->parse");
454 cal->setTime(date, status);
455 failure(status, "cal->setTime");
459 logln(UnicodeString("Hour: ")+cal->get(UCAL_HOUR_OF_DAY, status));
460 cal->add(UCAL_HOUR_OF_DAY, 6,status);
461 logln(UnicodeString("Hour: ")+cal->get(UCAL_HOUR_OF_DAY, status));
462 if (cal->get(UCAL_HOUR_OF_DAY, status) != 19)
463 errln(UnicodeString("Fail: Want 19 Got ") + cal->get(UCAL_HOUR_OF_DAY, status));
473 UErrorCode status = U_ZERO_ERROR;
474 Calendar *cal = new GregorianCalendar(status);
475 if(status == U_USING_FALLBACK_WARNING || U_FAILURE(status)) {
476 dataerrln("Error creating Calendar: %s", u_errorName(status));
480 UDate d = getAssociatedDate(makeDate(1998,0,30), status);
481 cal->setTime(d,status);
482 if (cal->get(UCAL_DAY_OF_WEEK,status) == UCAL_SATURDAY ||
483 cal->get(UCAL_DAY_OF_WEEK,status) == UCAL_SUNDAY)
497 CalendarRegressionTest::getAssociatedDate(UDate d, UErrorCode& status)
499 GregorianCalendar *cal = new GregorianCalendar(status);
500 cal->setTime(d,status);
504 int32_t wd = cal->get(UCAL_DAY_OF_WEEK, status);
506 cal->add(UCAL_DATE, 1, status);
513 UDate dd = cal->getTime(status);
529 UErrorCode status = U_ZERO_ERROR;
530 GregorianCalendar *cal = new GregorianCalendar(status);
531 if(U_FAILURE(status)) {
532 dataerrln("Error creating Calendar: %s", u_errorName(status));
540 int32_t dow = cal->get(UCAL_DAY_OF_WEEK, status);
551 if(U_FAILURE(status)) {
552 errln("Error checking Calendar: %s", u_errorName(status));
557 if(cal->getActualMinimum(UCAL_DAY_OF_WEEK, status) != min) {
560 if(cal->getActualMinimum(Calendar::DAY_OF_WEEK, status) != min) {
561 errln("FAIL: actual minimum (Calendar::DAY_OF_WEEK, status) differs from minimum");
566 if(((Calendar*)cal)->getActualMinimum(UCAL_DAY_OF_WEEK, status) != min) {
567 errln("FAIL: actual minimum (UCAL_DAY_OF_WEEK, status) differs from minimum");
570 // if(((Calendar*)cal)->getActualMinimum(Calendar::DAY_OF_WEEK, status) != min) {
571 // errln("FAIL: actual minimum (Calendar::DAY_OF_WEEK, status) differs from minimum");
573 if(U_FAILURE(status)) {
574 errln("Error getting actual minimum: %s", u_errorName(status));
586 UErrorCode status = U_ZERO_ERROR;
587 Calendar *cal = Calendar::createInstance(status);
588 if(U_FAILURE(status)) {
589 dataerrln("Error creating Calendar: %s", u_errorName(status));
593 cal->setTime(makeDate(1998, UCAL_JUNE, 24),status);
596 if (cal->getTime(status) != makeDate(1998, UCAL_NOVEMBER, 24))
607 UErrorCode status = U_ZERO_ERROR;
608 GregorianCalendar *foo1 = new GregorianCalendar(1997, 8, 27,status);
609 if(U_FAILURE(status)) {
610 dataerrln("Error creating Calendar: %s", u_errorName(status));
614 logln("foo1@%.0f - %d-%d-%d %d:%d:%d.%ds\n", foo1->getTime(status),
615 foo1->get(UCAL_YEAR, status),
616 foo1->get(UCAL_MONTH, status),
617 foo1->get(UCAL_DATE, status),
618 foo1->get(UCAL_HOUR, status),
619 foo1->get(UCAL_MINUTE, status),
620 foo1->get(UCAL_SECOND, status),
621 foo1->get(UCAL_MILLISECOND,status));
622 foo1->add(UCAL_DATE, + 1, status);
623 logln("foo1@%.0f - %d-%d-%d %d:%d:%d.%ds after +\n", foo1->getTime(status),
624 foo1->get(UCAL_YEAR, status),
625 foo1->get(UCAL_MONTH, status),
626 foo1->get(UCAL_DATE, status),
627 foo1->get(UCAL_HOUR, status),
628 foo1->get(UCAL_MINUTE, status),
629 foo1->get(UCAL_SECOND, status),
630 foo1->get(UCAL_MILLISECOND ,status));
631 foo1->add(UCAL_DATE, - 1, status);
632 logln("foo1@%.0f - %d-%d-%d %d:%d:%d.%ds after -\n", foo1->getTime(status),
633 foo1->get(UCAL_YEAR, status),
634 foo1->get(UCAL_MONTH, status),
635 foo1->get(UCAL_DATE, status),
636 foo1->get(UCAL_HOUR, status),
637 foo1->get(UCAL_MINUTE, status),
638 foo1->get(UCAL_SECOND, status),
639 foo1->get(UCAL_MILLISECOND, status));
641 foo1->add(UCAL_DATE, + 1, status);
642 int32_t testyear = foo1->get(UCAL_YEAR, status);
643 int32_t testmonth = foo1->get(UCAL_MONTH, status);
644 int32_t testday = foo1->get(UCAL_DATE, status);
658 UErrorCode status = U_ZERO_ERROR;
664 Calendar *cal = new GregorianCalendar(status);
665 if(U_FAILURE(status)) {
666 dataerrln("Error creating Calendar: %s", u_errorName(status));
670 cal->setTime(firstDate,status);
671 int32_t hr = cal->get(UCAL_HOUR_OF_DAY, status);
672 int32_t min = cal->get(UCAL_MINUTE, status);
673 int32_t sec = cal->get(UCAL_SECOND, status);
674 int32_t msec = cal->get(UCAL_MILLISECOND, status);
681 cal->setTime(lastDate, status);
682 hr = cal->get(UCAL_HOUR_OF_DAY, status);
683 min = cal->get(UCAL_MINUTE, status);
684 sec = cal->get(UCAL_SECOND, status);
685 msec = cal->get(UCAL_MILLISECOND, status);
705 UErrorCode status = U_ZERO_ERROR;
710 Locale::setDefault(Locale::getUK(),status);
713 date = new SimpleDateFormat(UnicodeString("dd MMM yyy (zzzz) 'is in week' ww"),status);
714 Calendar *cal = Calendar::createInstance(status);
715 if(U_FAILURE(status)) {
716 dataerrln("Error creating Calendar: %s", u_errorName(status));
723 UDate now = cal->getTime(status);
728 now=cal->getTime(status);
731 now=cal->getTime(status);
734 now=cal->getTime(status);
738 Locale::setDefault(saveLocale,status);
753 UErrorCode status = U_ZERO_ERROR;
754 GregorianCalendar *cal1 = new GregorianCalendar(1997, 10, 11, 10, 20, 40,status);
755 if (U_FAILURE(status)) {
756 dataerrln("Fail new GregorianCalendar: %s", u_errorName(status));
767 logln( UnicodeString(" Cal1 = ") + cal1->getTime(status) );
768 logln( UnicodeString(" Cal1 time in ms = ") + cal1->get(UCAL_MILLISECOND,status) );
771 GregorianCalendar *cal2 = new GregorianCalendar(1997, 10, 11, 10, 20, 40,status);
779 logln( UnicodeString(" Cal2 = ") + cal2->getTime(status) );
780 logln( UnicodeString(" Cal2 time in ms = ") + cal2->get(UCAL_MILLISECOND,status) );
793 UErrorCode status = U_ZERO_ERROR;
794 GregorianCalendar *a = new GregorianCalendar(1997,UCAL_NOVEMBER, 13,status);
795 if (U_FAILURE(status)) {
796 dataerrln("Fail new GregorianCalendar: %s", u_errorName(status));
800 int32_t dow = a->get(UCAL_DAY_OF_WEEK, status);
812 UErrorCode status = U_ZERO_ERROR;
817 Calendar *cal1 = new GregorianCalendar(*PST,status);
818 if (U_FAILURE(status)) {
819 dataerrln("Failure new GregorianCalendar: %s", u_errorName(status));
825 cal1->setTime(880698639000.0,status);
831 logln(UnicodeString("PST 1 is: ") + (h1=cal1->get(UCAL_HOUR_OF_DAY, status)));
833 logln(UnicodeString("GMT 2 is: ") + (h2=cal1->get(UCAL_HOUR_OF_DAY, status)));
837 Calendar *cal2 = new GregorianCalendar(*GMT,status);
838 Calendar *cal3 = new GregorianCalendar(*PST,status);
842 cal2->set(cal1->get(UCAL_YEAR,status),
843 cal1->get(UCAL_MONTH,status),
844 cal1->get(UCAL_DATE,status),
845 cal1->get(UCAL_HOUR_OF_DAY,status),
846 cal1->get(UCAL_MINUTE,status),
847 cal1->get(UCAL_SECOND,status));
850 logln(UnicodeString("RGMT 1 is: ") + (t1=cal2->getTime(status)));
852 logln(UnicodeString("RPST 1 is: ") + (t2=cal3->getTime(status)));
854 logln(UnicodeString("RGMT 2 is: ") + (t3=cal3->getTime(status)));
855 cal3->set(cal1->get(UCAL_YEAR,status),
856 cal1->get(UCAL_MONTH,status),
857 cal1->get(UCAL_DATE,status),
858 cal1->get(UCAL_HOUR_OF_DAY,status),
859 cal1->get(UCAL_MINUTE,status),
860 cal1->get(UCAL_SECOND,status));
864 logln(UnicodeString("RGMT 3 is: ") + (t4=cal3->getTime(status)));
882 UErrorCode status = U_ZERO_ERROR;
887 GregorianCalendar(1997,x,y[x], status);
888 if (U_FAILURE(status)) {
889 dataerrln("Fail new GregorianCalendar: %s", u_errorName(status));
894 log(UnicodeString("") + (m1=gc->get(UCAL_MONTH,status)+1)+UnicodeString("/")+
895 gc->get(UCAL_DATE,status)+"/"+gc->get(UCAL_YEAR,status)+
898 gc->add(UCAL_MONTH, 1,status);
899 logln(UnicodeString("") + (m2=gc->get(UCAL_MONTH,status)+1)+UnicodeString("/")+
900 gc->get(UCAL_DATE,status)+"/"+gc->get(UCAL_YEAR,status)
915 UErrorCode status = U_ZERO_ERROR;
916 GregorianCalendar *cal = (GregorianCalendar*)Calendar::createInstance(status);
917 if(U_FAILURE(status)) {
918 dataerrln("Error creating calendar: %s", u_errorName(status));
924 //UDate d = cal->getTime(status); // Should be Jan 1
926 if (cal->get(UCAL_DAY_OF_YEAR, status) != 1)
936 UErrorCode status = U_ZERO_ERROR;
937 SimpleDateFormat sdf(status);
940 GregorianCalendar *testCal = (GregorianCalendar*)Calendar::createInstance(status);
941 if(U_FAILURE(status)) {
942 dataerrln("Error creating calendar: %s", u_errorName(status));
962 testCal->add(UCAL_DATE,1,status);
964 int32_t actWOY = testCal->get(UCAL_WEEK_OF_YEAR,status);
966 status);
995 int32_t woy = testCal->get(UCAL_WEEK_OF_YEAR,status);
997 log(UnicodeString("") + sdf.format(testCal->getTime(status), str) +
1007 UDate save = testCal->getTime(status);
1012 if (testCal->getTime(status) != save) {
1015 sdf.format(testCal->getTime(status), str));
1019 testCal->setTime(save,status);
1020 testCal->add(UCAL_DATE, 1,status);
1048 UDate got = testCal->getTime(status);
1054 UDate got = testCal->getTime(status);
1060 UDate got = testCal->getTime(status);
1076 UDate got = testCal->getTime(status);
1085 testCal->setTime(exp, status);
1095 got = testCal->getTime(status);
1137 testCal->setTime(before,status);
1139 testCal->add(UCAL_WEEK_OF_YEAR, amount,status);
1141 testCal->roll(UCAL_WEEK_OF_YEAR, amount,status);
1142 UDate got = testCal->getTime(status);
1160 testCal->setTime(after,status);
1162 testCal->add(UCAL_WEEK_OF_YEAR, -amount,status);
1164 testCal->roll(UCAL_WEEK_OF_YEAR, -amount,status);
1165 got = testCal->getTime(status);
1186 UErrorCode status = U_ZERO_ERROR;
1191 Locale::setDefault(locales[i], status);
1192 failure(status, "Locale::setDefault");
1208 Locale::setDefault(saveLocale,status);
1217 UErrorCode status = U_ZERO_ERROR;
1218 Calendar *cal = Calendar::createInstance(status);
1219 if(U_FAILURE(status)) {
1220 dataerrln("Error creating calendar %s", u_errorName(status));
1230 cal->setTime(d11,status);
1233 logln(UnicodeString("") + cal->getTime(status));
1234 if (cal->getTime(status) != d01)
1238 logln(UnicodeString("") + cal->getTime(status));
1239 if (cal->getTime(status) != d00)
1242 cal->setTime(d11,status);
1244 logln(UnicodeString("") + cal->getTime(status));
1245 if (cal->getTime(status) != d10)
1249 logln(UnicodeString("") + cal->getTime(status));
1250 if (cal->getTime(status) != d00)
1254 logln(UnicodeString("") + cal->getTime(status));
1255 if (cal->getTime(status) != epoch)
1266 UErrorCode status = U_ZERO_ERROR;
1268 Calendar *cal = Calendar::createInstance(status);
1269 if(U_FAILURE(status)) {
1270 dataerrln("Error creating calendar %s", u_errorName(status));
1301 cal->setTime(date,status);
1306 cal->add(UCAL_HOUR, amt,status);
1310 cal->roll(UCAL_HOUR, amt,status);
1314 log(UnicodeString("") + cal->getTime(status));
1316 double change = cal->getTime(status) - date;
1335 UErrorCode status = U_ZERO_ERROR;
1336 Calendar *cal = Calendar::createInstance(status);
1337 if(U_FAILURE(status)) {
1338 dataerrln("Error creating calendar %s", u_errorName(status));
1344 cal->getActualMaximum(UCAL_HOUR,status) != 11)
1359 cal = Calendar::createInstance(Locale("th_TH@calendar=buddhist"),status);
1373 cal = Calendar::createInstance(Locale("ja_JP@calendar=japanese"),status);
1393 UErrorCode status = U_ZERO_ERROR;
1394 GregorianCalendar *cal = (GregorianCalendar*) Calendar::createInstance(status);
1395 if(U_FAILURE(status)) {
1396 dataerrln("Error creating calendar %s", u_errorName(status));
1400 DateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"),status);
1401 if(!assertSuccess("trying to construct", status))return;
1407 logln(UnicodeString("") + y + UnicodeString(" = ") + fmt->format(cal->getTime(status), temp) + " " +
1423 UErrorCode status = U_ZERO_ERROR;
1424 GregorianCalendar *cal = (GregorianCalendar*) Calendar::createInstance(status);
1425 if(U_FAILURE(status)) {
1426 dataerrln("Error creating calendar %s", u_errorName(status));
1430 DateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"),status);
1431 if(!assertSuccess("trying to construct", status))return;
1437 cal->add(UCAL_DATE, 1,status);
1438 if(U_FAILURE(status))
1440 if (cal->get(UCAL_DATE,status) != 29 ||
1454 status = U_ZERO_ERROR;
1455 GregorianCalendar *cal = new GregorianCalendar(status);
1456 if(U_FAILURE(status)) {
1457 dataerrln("Error creating calendar %s", u_errorName(status));
1467 cal2->setGregorianChange(cut2,status);
1483 UErrorCode status = U_ZERO_ERROR;
1484 GregorianCalendar *calendar = new GregorianCalendar(status);
1485 if(U_FAILURE(status)) {
1486 dataerrln("Error creating calendar %s", u_errorName(status));
1491 calendar->roll((UCalendarDateFields)-1, TRUE, status);
1492 if(U_SUCCESS(status))
1517 UErrorCode status = U_ZERO_ERROR;
1518 GregorianCalendar *calendar = new GregorianCalendar(status);
1519 if(status == U_USING_FALLBACK_WARNING || U_FAILURE(status)) {
1520 dataerrln("Error creating calendar %s", u_errorName(status));
1527 calendar->setTime(makeDate(INT32_MIN),status);
1528 int32_t year1 = calendar->get(UCAL_YEAR,status);
1529 int32_t era1 = calendar->get(UCAL_ERA,status);
1531 calendar->setTime(makeDate(INT32_MAX),status);
1532 int32_t year2 = calendar->get(UCAL_YEAR,status);
1533 int32_t era2 = calendar->get(UCAL_ERA,status);
1556 UErrorCode status = U_ZERO_ERROR;
1557 GregorianCalendar *calendar = new GregorianCalendar(status);
1558 if(U_FAILURE(status)) {
1559 dataerrln("Error creating calendar %s", u_errorName(status));
1566 calendar->setTime(DATES[i], status);
1567 int32_t year = calendar->get(UCAL_YEAR,status);
1587 UErrorCode status = U_ZERO_ERROR;
1588 GregorianCalendar *calendar = new GregorianCalendar(status);
1589 if(status == U_USING_FALLBACK_WARNING || U_FAILURE(status)) {
1590 dataerrln("Error creating calendar %s", u_errorName(status));
1597 calendar->setTime(date,status);
1605 calendar->getTime(status); // Force time computation
1608 if(U_SUCCESS(status))
1611 ", date after: " + calendar->getTime(status) +
1628 UErrorCode status = U_ZERO_ERROR;
1635 if(U_FAILURE(status)) {
1642 GregorianCalendar *calendar = new GregorianCalendar(zones[i], status);
1643 if(U_FAILURE(status)) {
1644 dataerrln("Couldnt' create calendar.: %s", u_errorName(status));
1649 calendar->setTime(EARLIEST_SUPPORTED_MILLIS, status);
1650 if(U_FAILURE(status))
1652 if (calendar->get(UCAL_ERA, status) != GregorianCalendar::BC || U_FAILURE(status)) {
1655 calendar->setTime(LATEST_SUPPORTED_MILLIS, status);
1656 if(U_FAILURE(status))
1658 if (calendar->get(UCAL_ERA, status) != GregorianCalendar::AD || U_FAILURE(status)) {
1662 calendar->setGregorianChange(LATEST_SUPPORTED_MILLIS, status);
1663 if(U_FAILURE(status))
1688 UErrorCode status = U_ZERO_ERROR;
1694 GregorianCalendar *cal = new GregorianCalendar(tz, status);
1695 if(U_FAILURE(status)) {
1696 dataerrln("Couldn't create calendar.: %s", u_errorName(status));
1706 d0 = cal->getTime(status);
1707 if(U_FAILURE(status))
1714 dPlus = cal->getTime(status);
1715 if(U_FAILURE(status))
1722 dMinus = cal->getTime(status);
1723 if(U_FAILURE(status))
1745 UErrorCode status = U_ZERO_ERROR;
1746 GregorianCalendar *calendar = new GregorianCalendar(1996, UCAL_FEBRUARY, 29, status);
1747 if(U_FAILURE(status)) {
1748 dataerrln("Couldn't create calendar.: %s", u_errorName(status));
1751 UDate start = calendar->getTime(status);
1752 if(U_FAILURE(status))
1755 calendar->add(UCAL_MONTH, 12, status);
1756 if(U_FAILURE(status))
1758 UDate date1 = calendar->getTime(status);
1759 if(U_FAILURE(status))
1762 calendar->setTime(start, status);
1763 if(U_FAILURE(status))
1765 calendar->add(UCAL_YEAR, 1, status);
1766 if(U_FAILURE(status))
1768 UDate date2 = calendar->getTime(status);
1769 if(U_FAILURE(status))
1798 UErrorCode status = U_ZERO_ERROR;
1801 GregorianCalendar *calendar = new GregorianCalendar(Locale::getUS(), status);
1802 if(U_FAILURE(status)) {
1803 dataerrln("Couldn't create calendar.: %s", u_errorName(status));
1808 logln(UnicodeString("Date: ") + calendar->getTime(status)); // 888817448000
1810 int32_t firstInMonth = calendar->get(UCAL_DATE, status);
1811 if(U_FAILURE(status))
1816 int32_t returned = calendar->getActualMaximum(field, status);
1820 " getActualMaximum(WEEK_OF_MONTH, status) = " + returned +
1842 UErrorCode status = U_ZERO_ERROR;
1845 Locale::getUS(), status);
1846 if(U_FAILURE(status)) {
1847 dataerrln("Couldn't create SimpleDateFormat - %s", u_errorName(status));
1852 new GregorianCalendar(100, UCAL_NOVEMBER, 1, status),
1853 new GregorianCalendar(-99 /*100BC*/, UCAL_JANUARY, 1, status),
1854 new GregorianCalendar(1996, UCAL_FEBRUARY, 29, status),
1856 if(U_FAILURE(status)) {
1870 calendar->setGregorianChange(EARLIEST_SUPPORTED_MILLIS, status);
1873 calendar->setGregorianChange(LATEST_SUPPORTED_MILLIS, status);
1876 if(U_FAILURE(status))
1880 UDate dateBefore = calendar->getTime(status);
1881 if(U_FAILURE(status))
1884 int32_t maxYear = calendar->getActualMaximum(field, status);
1886 logln(UnicodeString("maxYear: ") + maxYear + " for " + format->format(calendar->getTime(status), temp));
1895 UDate dateAfter = calendar->getTime(status);
1896 if(U_FAILURE(status))
1898 int32_t newYear = calendar->get(field, status);
1899 if(U_FAILURE(status))
1901 calendar->setTime(dateBefore, status); // restore calendar for next use
1902 if(U_FAILURE(status))
1930 UErrorCode status = U_ZERO_ERROR;
1931 GregorianCalendar cal(status);
1935 Locale::getUS(), status);
1937 if (U_FAILURE(status)) {
1938 dataerrln("Couldn't initialize test - %s", u_errorName(status));
1955 int32_t actWOY = cal.get(UCAL_WEEK_OF_YEAR, status);
1957 logln(UnicodeString("Ok: ") + dfmt.format(cal.getTime(status), str.remove()));
1959 errln(UnicodeString("FAIL: ") + dfmt.format(cal.getTime(status), str.remove())
1961 cal.add(UCAL_DATE, -8, status);
1963 cal.add(UCAL_DATE, 1, status);
1964 logln(dfmt.format(cal.getTime(status), str.remove()));
1967 if (U_FAILURE(status)) {
1994 UErrorCode status = U_ZERO_ERROR;
1997 GregorianCalendar cal(TimeZone::createTimeZone("GMT"), Locale::getUS(), status);
1998 SimpleDateFormat fmt("HH:mm 'w'w 'd'D E d MMM yyyy", Locale::getUS(), status);
1999 if (U_FAILURE(status)) {
2000 dataerrln("Error: Cannot create calendar or format - %s", u_errorName(status));
2054 int32_t woy = cal.get(UCAL_WEEK_OF_YEAR, status);
2055 int32_t doy = cal.get(UCAL_DAY_OF_YEAR, status);
2056 int32_t dow = cal.get(UCAL_DAY_OF_WEEK, status);
2057 if (U_FAILURE(status)) {
2064 fmt.format(cal.getTime(status), temp.remove()) +
2067 status = U_ZERO_ERROR;
2071 fmt.format(cal.getTime(status), temp.remove()));
2073 status = U_ZERO_ERROR;
2080 int32_t dom = cal.get(UCAL_DATE, status);
2081 if (U_FAILURE(status)) {
2088 fmt.format(cal.getTime(status), temp.remove()) +
2091 status = U_ZERO_ERROR;
2098 dom = cal.get(UCAL_DATE, status);
2099 if (U_FAILURE(status)) {
2106 fmt.format(cal.getTime(status), temp.remove()) +
2108 status = U_ZERO_ERROR;
2111 status = U_ZERO_ERROR;
2151 status = U_ZERO_ERROR;
2157 cal.setTime(date, status);
2158 if (U_FAILURE(status)) {
2159 errln((UnicodeString)"FAIL: setTime returned error code " + u_errorName(status));
2163 cal.add(DATA[i].field, amount, status);
2165 cal.roll(DATA[i].field, amount, status);
2167 if (U_FAILURE(status)) {
2170 " returned error code " + u_errorName(status));
2173 UDate result = cal.getTime(status);
2174 if (U_FAILURE(status)) {
2175 errln((UnicodeString)"FAIL: getTime returned error code " + u_errorName(status));
2385 UErrorCode status = U_ZERO_ERROR;
2386 Calendar *cal = Calendar::createInstance(Locale(testLocalePtr->locale), status);
2387 if ( U_FAILURE(status) ) {
2388 dataerrln((UnicodeString)"FAIL: Calendar::createInstance, locale " + testLocalePtr->locale + ", status " + u_errorName(status));
2393 status = U_ZERO_ERROR;
2395 cal->add( testItemPtr->fieldToChange, testItemPtr->fieldDelta, status );
2396 if ( U_FAILURE(status) ) {
2398 testItemPtr->fieldToChange + "/" + testItemPtr->fieldDelta + ", status " + u_errorName(status));
2402 int32_t year = cal->get(UCAL_YEAR, status);
2403 int32_t month = cal->get(UCAL_MONTH, status);
2404 int32_t day = cal->get(UCAL_DATE, status);
2405 if ( U_FAILURE(status) || year != endYear || month != testItemPtr->endMonth || day != testItemPtr->endDay ) {
2407 testItemPtr->fieldToChange + "/" + testItemPtr->fieldDelta + ", status " + u_errorName(status) +
2653 UErrorCode status = U_ZERO_ERROR;
2654 Calendar *cal = Calendar::createInstance(status);
2665 result = cal->getTime(status);
2674 UErrorCode status = U_ZERO_ERROR;
2675 Calendar *c1 = Calendar::createInstance("ja_JP@calendar=japanese",status);
2676 Calendar *c2 = Calendar::createInstance("ja_JP_TRADITIONAL",status);
2678 if(!c1 || !c2 || U_FAILURE(status)) {
2679 dataerrln("Couldn't create calendars for roll of HOUR: %s", u_errorName(status));
2684 c1->setTime(c2->getTime(status),status);
2687 c1->roll(Calendar::HOUR,(int32_t)3,status);
2688 c2->roll(UCAL_HOUR,(int32_t)3,status);
2690 if(U_FAILURE(status)) {
2696 c1->setTime(c2->getTime(status),status);
2697 c1->roll(Calendar::HOUR,(UBool)FALSE,status);
2698 c2->roll(UCAL_HOUR,(UBool)FALSE,status);
2700 if(U_FAILURE(status)) {
2709 status = U_ZERO_ERROR;
2711 c1 = Calendar::createInstance("th_TH_TRADITIONAL",status);
2712 c2 = Calendar::createInstance("th_TH@calendar=buddhist",status);
2714 if(!c1 || !c2 || U_FAILURE(status)) {
2720 c1->setTime(c2->getTime(status),status);
2723 c1->add(Calendar::HOUR,(int32_t)1,status);
2725 if(U_FAILURE(status)) {
2726 errln("Error code when trying to add Calendar::HOUR - %s", u_errorName(status));
2729 c2->add(UCAL_HOUR,(int32_t)1,status);
2731 if(U_FAILURE(status)) {
2732 errln("Error code when trying to add - UCAL_HOUR %s", u_errorName(status));
2740 status = U_ZERO_ERROR;
2742 c1 = Calendar::createInstance("es_ES",status);
2743 c2 = Calendar::createInstance("es_ES",status);
2745 if(!c1 || !c2 || U_FAILURE(status)) {
2751 c1->setTime(c2->getTime(status),status);
2754 c1->add(Calendar::YEAR,(int32_t)9,status);
2755 c2->add(UCAL_YEAR,(int32_t)9,status);
2757 if(U_FAILURE(status)) {