Lines Matching refs:status
29 if (U_FAILURE(status)) { \
30 if (status == U_MISSING_RESOURCE_ERROR) { \
31 dataerrln("%s:%d: Test failure. status=%s", __FILE__, __LINE__, u_errorName(status)); \
33 errln("%s:%d: Test failure. status=%s", __FILE__, __LINE__, u_errorName(status)); \
37 if (U_FAILURE(status)) { \
38 if (status == U_MISSING_RESOURCE_ERROR) { \
39 …s:%d: Test failure, locale %s. status=%s", __FILE__, __LINE__, testlocale, u_errorName(status)); \
41 …s:%d: Test failure, locale %s. status=%s", __FILE__, __LINE__, testlocale, u_errorName(status)); \
53 UErrorCode status = U_ZERO_ERROR; in calToStr() local
57 …eldName((UCalendarDateFields)i) + "=" + cal.get((UCalendarDateFields)i, status) + UnicodeString("… in calToStr()
61 if(cal.inDaylightTime(status)) { in calToStr()
70 d = cal.getTime(status); in calToStr()
382 UErrorCode status = U_ZERO_ERROR; in TestGenericAPI() local
393 Calendar *cal = Calendar::createInstance(zone->clone(), status); in TestGenericAPI()
394 if (failure(status, "Calendar::createInstance #1", TRUE)) return; in TestGenericAPI()
398 Calendar *cal2 = Calendar::createInstance(cal->getTimeZone(), status); in TestGenericAPI()
399 if (failure(status, "Calendar::createInstance #2")) return; in TestGenericAPI()
400 cal->setTime(when, status); in TestGenericAPI()
401 cal2->setTime(when, status); in TestGenericAPI()
402 if (failure(status, "Calendar::setTime")) return; in TestGenericAPI()
406 if (!cal->equals(*cal2, status) || in TestGenericAPI()
407 cal->before(*cal2, status) || in TestGenericAPI()
408 cal->after(*cal2, status) || in TestGenericAPI()
409 U_FAILURE(status)) errln("FAIL: equals/before/after failed"); in TestGenericAPI()
411 logln(UnicodeString("cal=") +cal->getTime(status) + UnicodeString(calToStr(*cal))); in TestGenericAPI()
412 logln(UnicodeString("cal2=") +cal2->getTime(status) + UnicodeString(calToStr(*cal2))); in TestGenericAPI()
414 cal2->setTime(when + 1000, status); in TestGenericAPI()
415 logln(UnicodeString("cal2=") +cal2->getTime(status) + UnicodeString(calToStr(*cal2))); in TestGenericAPI()
417 if (failure(status, "Calendar::setTime")) return; in TestGenericAPI()
418 if (cal->equals(*cal2, status) || in TestGenericAPI()
419 cal2->before(*cal, status) || in TestGenericAPI()
420 cal->after(*cal2, status) || in TestGenericAPI()
421 U_FAILURE(status)) errln("FAIL: equals/before/after failed after setTime(+1000)"); in TestGenericAPI()
424 cal->roll(UCAL_SECOND, (UBool) TRUE, status); in TestGenericAPI()
425 logln(UnicodeString("cal=") +cal->getTime(status) + UnicodeString(calToStr(*cal))); in TestGenericAPI()
426 cal->roll(UCAL_SECOND, (int32_t)0, status); in TestGenericAPI()
427 logln(UnicodeString("cal=") +cal->getTime(status) + UnicodeString(calToStr(*cal))); in TestGenericAPI()
428 if (failure(status, "Calendar::roll")) return; in TestGenericAPI()
430 if (!(eq=cal->equals(*cal2, status)) || in TestGenericAPI()
431 (b4=cal->before(*cal2, status)) || in TestGenericAPI()
432 (af=cal->after(*cal2, status)) || in TestGenericAPI()
433 U_FAILURE(status)) { in TestGenericAPI()
438 logln(UnicodeString("cal=") +cal->getTime(status) + UnicodeString(calToStr(*cal))); in TestGenericAPI()
439 logln(UnicodeString("cal2=") +cal2->getTime(status) + UnicodeString(calToStr(*cal2))); in TestGenericAPI()
443 cal->roll(UCAL_MONTH, (int32_t)(1 + UCAL_DECEMBER - cal->get(UCAL_MONTH, status)), status); in TestGenericAPI()
444 if (failure(status, "Calendar::roll")) return; in TestGenericAPI()
445 if (cal->equals(*cal2, status) || in TestGenericAPI()
446 cal2->before(*cal, status) || in TestGenericAPI()
447 cal->after(*cal2, status) || in TestGenericAPI()
448 U_FAILURE(status)) errln("FAIL: equals/before/after failed after rollback to January"); in TestGenericAPI()
491 if (cal->getTime(status) != date(84, 5, 24) || U_FAILURE(status)) in TestGenericAPI()
496 if (cal->getTime(status) != date(85, 3, 2, 11, 49) || U_FAILURE(status)) in TestGenericAPI()
501 if (cal->getTime(status) != date(95, 9, 12, 1, 39, 55) || U_FAILURE(status)) in TestGenericAPI()
504 cal->getTime(status); in TestGenericAPI()
505 if (failure(status, "Calendar::getTime")) return; in TestGenericAPI()
521 if(cal->getActualMinimum(Calendar::SECOND, status) != 0){ in TestGenericAPI()
525 Calendar *cal3 = Calendar::createInstance(status); in TestGenericAPI()
526 cal3->roll(Calendar::SECOND, (int32_t)0, status); in TestGenericAPI()
527 if (failure(status, "Calendar::roll(EDateFields, int32_t, UErrorCode)")) return; in TestGenericAPI()
543 cal = Calendar::createInstance(loc[i], status); in TestGenericAPI()
544 if (U_FAILURE(status)) { in TestGenericAPI()
545 …errcheckln(status, UnicodeString("FAIL: Calendar::createInstance #3, locale ") + loc[i].getName()… in TestGenericAPI()
552 cal = Calendar::createInstance(TimeZone::createDefault(), Locale::getEnglish(), status); in TestGenericAPI()
553 if (failure(status, "Calendar::createInstance #4")) return; in TestGenericAPI()
556 cal = Calendar::createInstance(*zone, Locale::getEnglish(), status); in TestGenericAPI()
557 if (failure(status, "Calendar::createInstance #5")) return; in TestGenericAPI()
560 GregorianCalendar *gc = new GregorianCalendar(*zone, status); in TestGenericAPI()
561 if (failure(status, "new GregorianCalendar")) return; in TestGenericAPI()
564 gc = new GregorianCalendar(Locale::getEnglish(), status); in TestGenericAPI()
565 if (failure(status, "new GregorianCalendar")) return; in TestGenericAPI()
568 gc = new GregorianCalendar(Locale::getEnglish(), status); in TestGenericAPI()
571 gc = new GregorianCalendar(*zone, Locale::getEnglish(), status); in TestGenericAPI()
572 if (failure(status, "new GregorianCalendar")) return; in TestGenericAPI()
575 gc = new GregorianCalendar(zone, status); in TestGenericAPI()
576 if (failure(status, "new GregorianCalendar")) return; in TestGenericAPI()
579 gc = new GregorianCalendar(1998, 10, 14, 21, 43, status); in TestGenericAPI()
580 if (gc->getTime(status) != (d =date(98, 10, 14, 21, 43) )|| U_FAILURE(status)) in TestGenericAPI()
581 …endar(ymdhm) failed with " + UnicodeString(u_errorName(status)) + ", cal=" + gc->getTime(status)… in TestGenericAPI()
583 …logln(UnicodeString("GOOD: cal=") +gc->getTime(status) + UnicodeString(calToStr(*gc)) + ", d=" +… in TestGenericAPI()
586 gc = new GregorianCalendar(1998, 10, 14, 21, 43, 55, status); in TestGenericAPI()
587 if (gc->getTime(status) != (d=date(98, 10, 14, 21, 43, 55)) || U_FAILURE(status)) in TestGenericAPI()
588 … errln("FAIL: new GregorianCalendar(ymdhms) failed with " + UnicodeString(u_errorName(status))); in TestGenericAPI()
590 GregorianCalendar gc2(Locale::getEnglish(), status); in TestGenericAPI()
591 if (failure(status, "new GregorianCalendar")) return; in TestGenericAPI()
598 cal = Calendar::createInstance(status); in TestGenericAPI()
599 if (failure(status, "Calendar::createInstance #6")) { in TestGenericAPI()
602 ((Calendar *)cal)->roll(UCAL_HOUR, (int32_t)100, status); in TestGenericAPI()
605 URegistryKey key = cal->registerFactory(NULL, status); in TestGenericAPI()
606 cal->unregister(key, status); in TestGenericAPI()
611 status = U_ZERO_ERROR; in TestGenericAPI()
612 cal = Calendar::createInstance(Locale("he_IL@calendar=hebrew"), status); in TestGenericAPI()
613 if (failure(status, "Calendar::createInstance #7")) { in TestGenericAPI()
616 cal->roll(Calendar::MONTH, (int32_t)100, status); in TestGenericAPI()
620 Calendar::getKeywordValuesForLocale("calendar", Locale("he"), FALSE, status)); in TestGenericAPI()
621 if (values.isNull() || U_FAILURE(status)) { in TestGenericAPI()
622 dataerrln("FAIL: Calendar::getKeywordValuesForLocale(he): %s", u_errorName(status)); in TestGenericAPI()
627 while ((charValue = values->next(&valueLength, status)) != NULL) { in TestGenericAPI()
636 values->reset(status); in TestGenericAPI()
640 while ((ucharValue = values->unext(&valueLength, status)) != NULL) { in TestGenericAPI()
650 values->reset(status); in TestGenericAPI()
653 while ((stringValue = values->snext(status)) != NULL) { in TestGenericAPI()
674 UErrorCode status = U_ZERO_ERROR; in TestRog() local
675 GregorianCalendar* gc = new GregorianCalendar(status); in TestRog()
676 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestRog()
683 for (int32_t i = 0; i < 9; i++, gc->add(UCAL_DATE, 1, status)) { in TestRog()
684 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestRog()
685 if (gc->get(UCAL_YEAR, status) != year || in TestRog()
686 gc->get(UCAL_MONTH, status) != month || in TestRog()
687 gc->get(UCAL_DATE, status) != (date + i)) errln("FAIL: Date wrong"); in TestRog()
688 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in TestRog()
708 UErrorCode status = U_ZERO_ERROR; in dowTest() local
709 GregorianCalendar* cal = new GregorianCalendar(status); in dowTest()
710 if (failure(status, "new GregorianCalendar", TRUE)) return; in dowTest()
713 cal->getTime(status); in dowTest()
714 if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; } in dowTest()
720 int32_t dow = cal->get(UCAL_DAY_OF_WEEK, status); in dowTest()
721 if (U_FAILURE(status)) { errln("Calendar::get failed [%s]", u_errorName(status)); return; } in dowTest()
740 UErrorCode status = U_ZERO_ERROR; in TestClonesUnique908() local
741 Calendar *c = Calendar::createInstance(status); in TestClonesUnique908()
742 if (failure(status, "Calendar::createInstance", TRUE)) return; in TestClonesUnique908()
746 if (c->get(UCAL_MILLISECOND, status) != 123 || in TestClonesUnique908()
747 d->get(UCAL_MILLISECOND, status) != 456) { in TestClonesUnique908()
750 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in TestClonesUnique908()
764 UErrorCode status = U_ZERO_ERROR; in TestGregorianChange768() local
766 GregorianCalendar* c = new GregorianCalendar(status); in TestGregorianChange768()
767 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestGregorianChange768()
773 c->setGregorianChange(date(0, 0, 1), status); in TestGregorianChange768()
774 if (U_FAILURE(status)) { errln("GregorianCalendar::setGregorianChange failed"); return; } in TestGregorianChange768()
791 UErrorCode status = U_ZERO_ERROR; in TestDisambiguation765() local
792 Calendar *c = Calendar::createInstance("en_US", status); in TestDisambiguation765()
793 if (failure(status, "Calendar::createInstance", TRUE)) return; in TestDisambiguation765()
813 status = U_ZERO_ERROR; in TestDisambiguation765()
819 c->getTime(status); in TestDisambiguation765()
820 verify765("1997 zero-th Tuesday in June = ", status); in TestDisambiguation765()
835 status = U_ZERO_ERROR; in TestDisambiguation765()
842 c->getTime(status); in TestDisambiguation765()
843 verify765("1997 Tuesday in week 0 of June = ", status); in TestDisambiguation765()
895 UErrorCode status = U_ZERO_ERROR; in verify765() local
896 int32_t y = c->get(UCAL_YEAR, status); in verify765()
897 int32_t m = c->get(UCAL_MONTH, status); in verify765()
898 int32_t d = c->get(UCAL_DATE, status); in verify765()
902 if (U_FAILURE(status)) { errln("FAIL: Calendar::get failed"); return; } in verify765()
903 logln("PASS: " + msg + dateToString(c->getTime(status), str)); in verify765()
904 if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; } in verify765()
907 …errln("FAIL: " + msg + dateToString(c->getTime(status), str) + "; expected " + (int32_t)year + "/"… in verify765()
908 …(int32_t)(m + 1) + "/" + (int32_t)d + " for Locale: " + c->getLocaleID(ULOC_ACTUAL_LOCALE,status)); in verify765()
909 if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; } in verify765()
916 CalendarTest::verify765(const UnicodeString& msg/*, IllegalArgumentException e*/, UErrorCode status) in verify765() argument
918 if (status != U_ILLEGAL_ARGUMENT_ERROR) errln("FAIL: No IllegalArgumentException for " + msg); in verify765()
940 UErrorCode status = U_ZERO_ERROR; in test4064654() local
942 Calendar *gmtcal = Calendar::createInstance(status); in test4064654()
943 if (failure(status, "Calendar::createInstance", TRUE)) return; in test4064654()
947 date = gmtcal->getTime(status); in test4064654()
948 if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; } in test4064654()
950 Calendar *cal = Calendar::createInstance(status); in test4064654()
951 if (U_FAILURE(status)) { errln("Calendar::createInstance failed"); return; } in test4064654()
952 cal->setTime(date, status); in test4064654()
953 if (U_FAILURE(status)) { errln("Calendar::setTime failed"); return; } in test4064654()
954 int32_t offset = cal->getTimeZone().getOffset((uint8_t)cal->get(UCAL_ERA, status), in test4064654()
955 cal->get(UCAL_YEAR, status), in test4064654()
956 cal->get(UCAL_MONTH, status), in test4064654()
957 cal->get(UCAL_DATE, status), in test4064654()
958 (uint8_t)cal->get(UCAL_DAY_OF_WEEK, status), in test4064654()
959 cal->get(UCAL_MILLISECOND, status), status); in test4064654()
960 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in test4064654()
962 int32_t utc = ((cal->get(UCAL_HOUR_OF_DAY, status) * 60 + in test4064654()
963 cal->get(UCAL_MINUTE, status)) * 60 + in test4064654()
964 cal->get(UCAL_SECOND, status)) * 1000 + in test4064654()
965 cal->get(UCAL_MILLISECOND, status) - offset; in test4064654()
966 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in test4064654()
984 UErrorCode status = U_ZERO_ERROR; in TestAddSetOrder621() local
985 Calendar *cal = Calendar::createInstance(status); in TestAddSetOrder621()
986 if (failure(status, "Calendar::createInstance", TRUE)) return; in TestAddSetOrder621()
988 cal->setTime(d, status); in TestAddSetOrder621()
989 if (U_FAILURE(status)) { in TestAddSetOrder621()
994 cal->add(UCAL_DATE, - 5, status); in TestAddSetOrder621()
995 if (U_FAILURE(status)) { in TestAddSetOrder621()
1004 dateToString(cal->getTime(status), s); in TestAddSetOrder621()
1005 if (U_FAILURE(status)) { in TestAddSetOrder621()
1012 cal = Calendar::createInstance(status); in TestAddSetOrder621()
1013 if (U_FAILURE(status)) { in TestAddSetOrder621()
1018 cal->setTime(d, status); in TestAddSetOrder621()
1019 if (U_FAILURE(status)) { in TestAddSetOrder621()
1027 cal->add(UCAL_DATE, - 5, status); in TestAddSetOrder621()
1028 if (U_FAILURE(status)) { in TestAddSetOrder621()
1034 dateToString(cal->getTime(status), s2); in TestAddSetOrder621()
1035 if (U_FAILURE(status)) { in TestAddSetOrder621()
1056 UErrorCode status = U_ZERO_ERROR; in TestAdd520() local
1057 GregorianCalendar *temp = new GregorianCalendar(y, m, d, status); in TestAdd520()
1058 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestAdd520()
1060 temp->add(UCAL_YEAR, 1, status); in TestAdd520()
1061 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestAdd520()
1064 temp->add(UCAL_MONTH, 1, status); in TestAdd520()
1065 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestAdd520()
1068 temp->add(UCAL_DATE, 1, status); in TestAdd520()
1069 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestAdd520()
1072 temp->add(UCAL_DATE, 2, status); in TestAdd520()
1073 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestAdd520()
1076 temp->add(UCAL_DATE, 28, status); in TestAdd520()
1077 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestAdd520()
1093 UErrorCode status = U_ZERO_ERROR; in TestAddRollExtensive() local
1094 GregorianCalendar *temp = new GregorianCalendar(y, m, d, status); in TestAddRollExtensive()
1095 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestAddRollExtensive()
1110 status = U_ZERO_ERROR; in TestAddRollExtensive()
1112 temp->add(e, 1, status); in TestAddRollExtensive()
1113 if (U_FAILURE(status)) { limit = i; status = U_ZERO_ERROR; } in TestAddRollExtensive()
1116 temp->add(e, -1, status); in TestAddRollExtensive()
1117 if (U_FAILURE(status)) { errln("GregorianCalendar::add -1 failed"); return; } in TestAddRollExtensive()
1129 status = U_ZERO_ERROR; in TestAddRollExtensive()
1132 temp->roll(e, 1, status); in TestAddRollExtensive()
1133 if (U_FAILURE(status)) { in TestAddRollExtensive()
1134 …("caltest.cpp:%d e=%d, i=%d - roll(+) err %s\n", __LINE__, (int) e, (int) i, u_errorName(status)); in TestAddRollExtensive()
1136 limit = i; status = U_ZERO_ERROR; in TestAddRollExtensive()
1142 temp->roll(e, -1, status); in TestAddRollExtensive()
1143 …status)) { errln(UnicodeString("GregorianCalendar::roll ") + CalendarTest::fieldName(e) + " count=… in TestAddRollExtensive()
1161 UErrorCode status = U_ZERO_ERROR; in check520() local
1162 if (c->get(UCAL_YEAR, status) != y || in check520()
1163 c->get(UCAL_MONTH, status) != m || in check520()
1164 c->get(UCAL_DATE, status) != d || in check520()
1165 c->get(UCAL_HOUR, status) != hr || in check520()
1166 c->get(UCAL_MINUTE, status) != min || in check520()
1167 c->get(UCAL_SECOND, status) != sec || in check520()
1168 c->get(UCAL_MILLISECOND, status) != ms) { in check520()
1173 "; got " + c->get(UCAL_YEAR, status) + in check520()
1174 "/" + (c->get(UCAL_MONTH, status) + 1) + in check520()
1175 "/" + c->get(UCAL_DATE, status) + in check520()
1176 " " + c->get(UCAL_HOUR, status) + ":" + in check520()
1177 c->get(UCAL_MINUTE, status) + ":" + in check520()
1178 c->get(UCAL_SECOND, status) + ":" + in check520()
1179 c->get(UCAL_MILLISECOND, status) in check520()
1182 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in check520()
1196 UErrorCode status = U_ZERO_ERROR; in check520() local
1197 if (c->get(UCAL_YEAR, status) != y || in check520()
1198 c->get(UCAL_MONTH, status) != m || in check520()
1199 c->get(UCAL_DATE, status) != d) { in check520()
1202 "; got " + c->get(UCAL_YEAR, status) + in check520()
1203 "/" + (c->get(UCAL_MONTH, status) + 1) + in check520()
1204 "/" + c->get(UCAL_DATE, status) in check520()
1207 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in check520()
1224 UErrorCode status = U_ZERO_ERROR; in TestFieldSet4781() local
1225 GregorianCalendar *g = new GregorianCalendar(status); in TestFieldSet4781()
1226 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestFieldSet4781()
1227 GregorianCalendar *g2 = new GregorianCalendar(status); in TestFieldSet4781()
1228 if (U_FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } in TestFieldSet4781()
1229 g2->set(UCAL_HOUR, 12, status); in TestFieldSet4781()
1230 g2->set(UCAL_MINUTE, 0, status); in TestFieldSet4781()
1231 g2->set(UCAL_SECOND, 0, status); in TestFieldSet4781()
1232 if (U_FAILURE(status)) { errln("Calendar::set failed"); return; } in TestFieldSet4781()
1297 UErrorCode status = U_ZERO_ERROR; in TestSecondsZero121() local
1298 Calendar *cal = new GregorianCalendar(status); in TestSecondsZero121()
1299 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestSecondsZero121()
1300 cal->setTime(Calendar::getNow(), status); in TestSecondsZero121()
1301 if (U_FAILURE(status)) { errln("Calendar::setTime failed"); return; } in TestSecondsZero121()
1303 if (U_FAILURE(status)) { errln("Calendar::set failed"); return; } in TestSecondsZero121()
1304 UDate d = cal->getTime(status); in TestSecondsZero121()
1305 if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; } in TestSecondsZero121()
1327 UErrorCode status = U_ZERO_ERROR; in TestAddSetGet0610() local
1329 Calendar *calendar = new GregorianCalendar(status); in TestAddSetGet0610()
1330 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestAddSetGet0610()
1333 calendar->add(UCAL_DATE, 1, status); in TestAddSetGet0610()
1334 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestAddSetGet0610()
1342 Calendar *calendar = new GregorianCalendar(1993, UCAL_JANUARY, 4, status); in TestAddSetGet0610()
1343 if (U_FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } in TestAddSetGet0610()
1345 calendar->add(UCAL_DATE, 1, status); in TestAddSetGet0610()
1346 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestAddSetGet0610()
1354 Calendar *calendar = new GregorianCalendar(1993, UCAL_JANUARY, 4, status); in TestAddSetGet0610()
1355 if (U_FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } in TestAddSetGet0610()
1357 calendar->getTime(status); in TestAddSetGet0610()
1358 if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; } in TestAddSetGet0610()
1359 calendar->add(UCAL_DATE, 1, status); in TestAddSetGet0610()
1360 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in TestAddSetGet0610()
1374 UErrorCode status = U_ZERO_ERROR; in value() local
1375 return UnicodeString("") + (int32_t)calendar->get(UCAL_YEAR, status) + in value()
1376 "/" + (int32_t)calendar->get(UCAL_MONTH, status) + in value()
1377 "/" + (int32_t)calendar->get(UCAL_DATE, status) + in value()
1378 (U_FAILURE(status) ? " FAIL: Calendar::get failed" : ""); in value()
1390 UErrorCode status = U_ZERO_ERROR; in TestFields060() local
1395 calendar = new GregorianCalendar(year, month, dDate, status); in TestFields060()
1396 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestFields060()
1400 if (calendar->get(field, status) != expected) { in TestFields060()
1402 "; received " + (int32_t)calendar->get(field, status) + " instead"); in TestFields060()
1403 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in TestFields060()
1430 UErrorCode status = U_ZERO_ERROR; in TestEpochStartFields() local
1432 Calendar *c = Calendar::createInstance(status); in TestEpochStartFields()
1433 if (failure(status, "Calendar::createInstance", TRUE)) return; in TestEpochStartFields()
1435 GregorianCalendar *gc = new GregorianCalendar(status); in TestEpochStartFields()
1436 if (U_FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } in TestEpochStartFields()
1438 gc->setTime(d, status); in TestEpochStartFields()
1439 if (U_FAILURE(status)) { errln("Calendar::setTime failed"); return; } in TestEpochStartFields()
1440 UBool idt = gc->inDaylightTime(status); in TestEpochStartFields()
1441 if (U_FAILURE(status)) { errln("GregorianCalendar::inDaylightTime failed"); return; } in TestEpochStartFields()
1447 c->setTime(d, status); in TestEpochStartFields()
1448 if (U_FAILURE(status)) { errln("Calendar::setTime failed"); return; } in TestEpochStartFields()
1450 if (c->get((UCalendarDateFields)i, status) != EPOCH_FIELDS[i]) in TestEpochStartFields()
1452 "; saw " + c->get((UCalendarDateFields)i, status) + " instead"); in TestEpochStartFields()
1453 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in TestEpochStartFields()
1455 if (c->get(UCAL_ZONE_OFFSET, status) != z->getRawOffset()) in TestEpochStartFields()
1458 "; saw " + c->get(UCAL_ZONE_OFFSET, status) + " instead"); in TestEpochStartFields()
1459 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in TestEpochStartFields()
1461 if (c->get(UCAL_DST_OFFSET, status) != 0) in TestEpochStartFields()
1464 "; saw " + c->get(UCAL_DST_OFFSET, status) + " instead"); in TestEpochStartFields()
1465 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in TestEpochStartFields()
1486 UErrorCode status = U_ZERO_ERROR; in TestDOWProgression() local
1487 Calendar *cal = new GregorianCalendar(1972, UCAL_OCTOBER, 26, status); in TestDOWProgression()
1488 if (failure(status, "new GregorianCalendar", TRUE)) return; in TestDOWProgression()
1504 UErrorCode status = U_ZERO_ERROR; in TestDOW_LOCALandYEAR_WOY() local
1506 Calendar *cal=Calendar::createInstance(Locale::getGermany(), status); in TestDOW_LOCALandYEAR_WOY()
1507 if (failure(status, "Calendar::createInstance", TRUE)) return; in TestDOW_LOCALandYEAR_WOY()
1508 …DateFormat *sdf=new SimpleDateFormat(UnicodeString("YYYY'-W'ww-ee"), Locale::getGermany(), status); in TestDOW_LOCALandYEAR_WOY()
1509 …if (U_FAILURE(status)) { dataerrln("Couldn't create SimpleDateFormat - %s", u_errorName(status)); … in TestDOW_LOCALandYEAR_WOY()
1513 DateFormatSymbols *dfs = new DateFormatSymbols(Locale::getGermany(), status); in TestDOW_LOCALandYEAR_WOY()
1516 sdf->applyLocalizedPattern(UnicodeString("JJJJ'-W'ww-ee"), status); in TestDOW_LOCALandYEAR_WOY()
1517 if (U_FAILURE(status)) { errln("Couldn't apply localized pattern"); return; } in TestDOW_LOCALandYEAR_WOY()
1521 doYEAR_WOYLoop(cal, sdf, times, status); in TestDOW_LOCALandYEAR_WOY()
1523 yearAddTest(*cal, status); // aliu in TestDOW_LOCALandYEAR_WOY()
1524 loop_addroll(cal, /*sdf,*/ times, UCAL_DOW_LOCAL, UCAL_DAY_OF_WEEK, status); in TestDOW_LOCALandYEAR_WOY()
1525 if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1997"); return; } in TestDOW_LOCALandYEAR_WOY()
1529 doYEAR_WOYLoop(cal, sdf, times, status); in TestDOW_LOCALandYEAR_WOY()
1531 yearAddTest(*cal, status); // aliu in TestDOW_LOCALandYEAR_WOY()
1532 loop_addroll(cal, /*sdf,*/ times, UCAL_DOW_LOCAL, UCAL_DAY_OF_WEEK, status); in TestDOW_LOCALandYEAR_WOY()
1533 if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1998"); return; } in TestDOW_LOCALandYEAR_WOY()
1537 doYEAR_WOYLoop(cal, sdf, times, status); in TestDOW_LOCALandYEAR_WOY()
1539 yearAddTest(*cal, status); // aliu in TestDOW_LOCALandYEAR_WOY()
1540 loop_addroll(cal, /*sdf,*/ times, UCAL_DOW_LOCAL, UCAL_DAY_OF_WEEK, status); in TestDOW_LOCALandYEAR_WOY()
1541 if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1582"); return; } in TestDOW_LOCALandYEAR_WOY()
1552 void CalendarTest::yearAddTest(Calendar& cal, UErrorCode& status) { in yearAddTest() argument
1564 int32_t y = cal.get(UCAL_YEAR, status); in yearAddTest()
1565 int32_t mon = cal.get(UCAL_MONTH, status); in yearAddTest()
1566 int32_t day = cal.get(UCAL_DATE, status); in yearAddTest()
1567 int32_t ywy = cal.get(UCAL_YEAR_WOY, status); in yearAddTest()
1568 int32_t woy = cal.get(UCAL_WEEK_OF_YEAR, status); in yearAddTest()
1569 int32_t dow = cal.get(UCAL_DOW_LOCAL, status); in yearAddTest()
1570 UDate t = cal.getTime(status); in yearAddTest()
1572 if(U_FAILURE(status)){ in yearAddTest()
1573 …icodeString("Failed to create Calendar for locale. Error: ") + UnicodeString(u_errorName(status))); in yearAddTest()
1577 SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy / YYYY'-W'ww-ee"), status); in yearAddTest()
1582 cal.add(UCAL_YEAR, 1, status); in yearAddTest()
1583 int32_t y2 = cal.get(UCAL_YEAR, status); in yearAddTest()
1584 int32_t mon2 = cal.get(UCAL_MONTH, status); in yearAddTest()
1585 int32_t day2 = cal.get(UCAL_DATE, status); in yearAddTest()
1586 fmt.format(cal.getTime(status), str); in yearAddTest()
1598 cal.setTime(t, status); in yearAddTest()
1600 cal.add(UCAL_YEAR_WOY, 1, status); in yearAddTest()
1601 int32_t ywy2 = cal.get(UCAL_YEAR_WOY, status); in yearAddTest()
1602 int32_t woy2 = cal.get(UCAL_WEEK_OF_YEAR, status); in yearAddTest()
1603 int32_t dow2 = cal.get(UCAL_DOW_LOCAL, status); in yearAddTest()
1604 fmt.format(cal.getTime(status), str); in yearAddTest()
1720 UErrorCode status = U_ZERO_ERROR; in marchByDelta() local
1722 int32_t initialDOW = cur->get(UCAL_DAY_OF_WEEK, status); in marchByDelta()
1723 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in marchByDelta()
1728 logln(UnicodeString("DOW = ") + DOW + " " + dateToString(cur->getTime(status), str)); in marchByDelta()
1729 if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; } in marchByDelta()
1730 cur->add(UCAL_DAY_OF_WEEK, delta, status); in marchByDelta()
1731 if (U_FAILURE(status)) { errln("Calendar::add failed"); return; } in marchByDelta()
1732 newDOW = cur->get(UCAL_DAY_OF_WEEK, status); in marchByDelta()
1733 if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } in marchByDelta()
1737 " on " + dateToString(cur->getTime(status), str)); in marchByDelta()
1738 if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; } in marchByDelta()
1746 #define CHECK(status, msg) \ argument
1747 if (U_FAILURE(status)) { \
1748 errcheckln(status, msg); \
1792 UErrorCode status = U_ZERO_ERROR; in TestWOY() local
1795 GregorianCalendar cal(status); in TestWOY()
1796 SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy', WOY' w"), status); in TestWOY()
1797 if (failure(status, "Cannot construct calendar/format", TRUE)) return; in TestWOY()
1824 fmt.format(t = cal.getTime(status), str.remove()); in TestWOY()
1825 CHECK(status, "Fail: getTime failed"); in TestWOY()
1827 int32_t dow = cal.get(UCAL_DAY_OF_WEEK, status); in TestWOY()
1828 int32_t woy = cal.get(UCAL_WEEK_OF_YEAR, status); in TestWOY()
1829 int32_t year = cal.get(UCAL_YEAR, status); in TestWOY()
1830 int32_t mon = cal.get(UCAL_MONTH, status); in TestWOY()
1832 CHECK(status, "Fail: get failed"); in TestWOY()
1850 t_y = cal.get(UCAL_YEAR, status); in TestWOY()
1851 t_woy = cal.get(UCAL_WEEK_OF_YEAR, status); in TestWOY()
1852 t_dow = cal.get(UCAL_DAY_OF_WEEK, status); in TestWOY()
1853 CHECK(status, "Fail: get failed"); in TestWOY()
1856 fmt.format(cal.getTime(status), str); in TestWOY()
1872 t_y = cal.get(UCAL_YEAR, status); in TestWOY()
1873 t_woy = cal.get(UCAL_WEEK_OF_YEAR, status); in TestWOY()
1874 t_dow = cal.get(UCAL_DOW_LOCAL, status); in TestWOY()
1875 CHECK(status, "Fail: get failed"); in TestWOY()
1878 fmt.format(cal.getTime(status), str); in TestWOY()
1887 t2 = cal.getTime(status); in TestWOY()
1888 CHECK(status, "Fail: getTime failed"); in TestWOY()
1904 t2 = cal.getTime(status); in TestWOY()
1905 CHECK(status, "Fail: getTime failed"); in TestWOY()
1916 cal.setTime(t, status); in TestWOY()
1919 t2 = cal.getTime(status); in TestWOY()
1920 CHECK(status, "Fail: set/getTime failed"); in TestWOY()
1933 cal.setTime(t, status); in TestWOY()
1936 t2 = cal.getTime(status); in TestWOY()
1937 CHECK(status, "Fail: set/getTime failed"); in TestWOY()
1945 cal.setTime(t, status); in TestWOY()
1948 t2 = cal.getTime(status); in TestWOY()
1949 CHECK(status, "Fail: set/getTime failed"); in TestWOY()
1957 cal.setTime(t, status); in TestWOY()
1960 t2 = cal.getTime(status); in TestWOY()
1961 CHECK(status, "Fail: set/getTime failed"); in TestWOY()
1989 fmt.format(cal.getTime(status), str); in TestWOY()
1990 CHECK(status, "Fail: getTime failed"); in TestWOY()
1993 cal.roll(UCAL_DOW_LOCAL, amount, status); in TestWOY()
1994 CHECK(status, "Fail: roll failed"); in TestWOY()
1996 t = cal.getTime(status); in TestWOY()
2001 t2 = cal.getTime(status); in TestWOY()
2002 CHECK(status, "Fail: getTime failed"); in TestWOY()
2019 UErrorCode status = U_ZERO_ERROR; in TestYWOY() local
2021 GregorianCalendar cal(status); in TestYWOY()
2022 if (failure(status, "construct GregorianCalendar", TRUE)) return; in TestYWOY()
2034 if(cal.get(UCAL_YEAR, status) != 2003) { in TestYWOY()
2045 if(cal.get(UCAL_YEAR, status) != 2004) { in TestYWOY()
2057 if(cal.get(UCAL_YEAR, status) != 2003) { in TestYWOY()
2064 cal.setTime(t, status); in TestYWOY()
2067 if(cal.getTime(status) != t) { in TestYWOY()
2078 UErrorCode status = U_ZERO_ERROR; in TestJD() local
2079 GregorianCalendar cal(status); in TestJD()
2080 if (failure(status, "construct GregorianCalendar", TRUE)) return; in TestJD()
2083 jd = cal.get(UCAL_JULIAN_DAY, status); in TestJD()
2090 cal.setTime(Calendar::getNow(), status); in TestJD()
2093 UDate epochTime = cal.getTime(status); in TestJD()
2179 static UDate doMinDateOfCalendar(Calendar* adopt, UBool &isGregorian, UErrorCode& status) { in doMinDateOfCalendar() argument
2180 if(U_FAILURE(status)) return 0.0; in doMinDateOfCalendar()
2183 adopt->set(UCAL_EXTENDED_YEAR, adopt->getActualMinimum(UCAL_EXTENDED_YEAR, status)); in doMinDateOfCalendar()
2184 UDate ret = adopt->getTime(status); in doMinDateOfCalendar()
2190 UDate CalendarTest::minDateOfCalendar(const Locale& locale, UBool &isGregorian, UErrorCode& status)… in minDateOfCalendar() argument
2191 if(U_FAILURE(status)) return 0.0; in minDateOfCalendar()
2192 return doMinDateOfCalendar(Calendar::createInstance(locale, status), isGregorian, status); in minDateOfCalendar()
2195 UDate CalendarTest::minDateOfCalendar(const Calendar& cal, UBool &isGregorian, UErrorCode& status) { in minDateOfCalendar() argument
2196 if(U_FAILURE(status)) return 0.0; in minDateOfCalendar()
2197 return doMinDateOfCalendar(cal.clone(), isGregorian, status); in minDateOfCalendar()
2202 UErrorCode status = U_ZERO_ERROR; in Test6703() local
2206 cal = Calendar::createInstance(loc1, status); in Test6703()
2207 if (failure(status, "Calendar::createInstance", TRUE)) return; in Test6703()
2210 status = U_ZERO_ERROR; in Test6703()
2212 cal = Calendar::createInstance(loc2, status); in Test6703()
2213 if (failure(status, "Calendar::createInstance")) return; in Test6703()
2216 status = U_ZERO_ERROR; in Test6703()
2218 cal = Calendar::createInstance(loc3, status); in Test6703()
2219 if (failure(status, "Calendar::createInstance")) return; in Test6703()
2227 UErrorCode status = U_ZERO_ERROR; in Test3785() local
2233 uzone.length(), NULL, 0, &status)); in Test3785()
2234 if (df.isNull() || U_FAILURE(status)) return; in Test3785()
2243 status = U_ZERO_ERROR; in Test3785()
2244 udat_format(df.getAlias(), ud0, ubuffer, 1024, NULL, &status); in Test3785()
2245 if (U_FAILURE(status)) { in Test3785()
2257 status = U_ZERO_ERROR; in Test3785()
2258 udat_format(df.getAlias(), ud0, ubuffer, 1024, NULL, &status); in Test3785()
2259 if (U_FAILURE(status)) { in Test3785()
2273 UErrorCode status = U_ZERO_ERROR; in Test1624() local
2275 HebrewCalendar hc(loc,status); in Test1624()
2286 int32_t dayHC = hc.get(UCAL_DATE,status); in Test1624()
2287 int32_t monthHC = hc.get(UCAL_MONTH,status); in Test1624()
2288 int32_t yearHC = hc.get(UCAL_YEAR,status); in Test1624()
2290 if (failure(status, "HebrewCalendar.get()", TRUE)) continue; in Test1624()
2310 UErrorCode status = U_ZERO_ERROR; in TestTimeStamp() local
2315 cal = Calendar::createInstance("en_US@calender=gregorian", status); in TestTimeStamp()
2316 if (U_FAILURE(status)) { in TestTimeStamp()
2325 time = cal->getTime(status); in TestTimeStamp()
2326 if (U_FAILURE(status)) { in TestTimeStamp()
2365 UErrorCode status = U_ZERO_ERROR; in TestISO8601() local
2366 Calendar *cal = Calendar::createInstance(TEST_LOCALES[i], status); in TestISO8601()
2367 if (U_FAILURE(status)) { in TestISO8601()
2377 int32_t weekNum = cal->get(UCAL_WEEK_OF_YEAR, status); in TestISO8601()
2378 int32_t weekYear = cal->get(UCAL_YEAR_WOY, status); in TestISO8601()
2379 if (U_FAILURE(status)) { in TestISO8601()
2395 UErrorCode status = U_ZERO_ERROR; in TestAmbiguousWallTimeAPIs() local
2396 Calendar* cal = Calendar::createInstance(status); in TestAmbiguousWallTimeAPIs()
2397 if (U_FAILURE(status)) { in TestAmbiguousWallTimeAPIs()
2414 if (!cal->equals(*cal2, status)) { in TestAmbiguousWallTimeAPIs()
2416 } else if (U_FAILURE(status)) { in TestAmbiguousWallTimeAPIs()
2419 status = U_ZERO_ERROR; in TestAmbiguousWallTimeAPIs()
2427 if (!cal->equals(*cal2, status)) { in TestAmbiguousWallTimeAPIs()
2429 } else if (U_FAILURE(status)) { in TestAmbiguousWallTimeAPIs()
2432 status = U_ZERO_ERROR; in TestAmbiguousWallTimeAPIs()
2453 CalFields(const Calendar& cal, UErrorCode& status);
2458 UBool isEquivalentTo(const Calendar& cal, UErrorCode& status) const;
2474 CalFields::CalFields(const Calendar& cal, UErrorCode& status) { in CalFields() argument
2475 year = cal.get(UCAL_YEAR, status); in CalFields()
2476 month = cal.get(UCAL_MONTH, status) + 1; in CalFields()
2477 day = cal.get(UCAL_DAY_OF_MONTH, status); in CalFields()
2478 hour = cal.get(UCAL_HOUR_OF_DAY, status); in CalFields()
2479 min = cal.get(UCAL_MINUTE, status); in CalFields()
2480 sec = cal.get(UCAL_SECOND, status); in CalFields()
2481 ms = cal.get(UCAL_MILLISECOND, status); in CalFields()
2517 CalFields::isEquivalentTo(const Calendar& cal, UErrorCode& status) const { in isEquivalentTo()
2518 return year == cal.get(UCAL_YEAR, status) in isEquivalentTo()
2519 && month == cal.get(UCAL_MONTH, status) + 1 in isEquivalentTo()
2520 && day == cal.get(UCAL_DAY_OF_MONTH, status) in isEquivalentTo()
2521 && hour == cal.get(UCAL_HOUR_OF_DAY, status) in isEquivalentTo()
2522 && min == cal.get(UCAL_MINUTE, status) in isEquivalentTo()
2523 && sec == cal.get(UCAL_SECOND, status) in isEquivalentTo()
2524 && ms == cal.get(UCAL_MILLISECOND, status); in isEquivalentTo()
2556 UErrorCode status = U_ZERO_ERROR; in TestRepeatedWallTime() local
2557 GregorianCalendar calGMT((const TimeZone&)*TimeZone::getGMT(), status); in TestRepeatedWallTime()
2558 GregorianCalendar calDefault(status); in TestRepeatedWallTime()
2559 GregorianCalendar calLast(status); in TestRepeatedWallTime()
2560 GregorianCalendar calFirst(status); in TestRepeatedWallTime()
2562 if (U_FAILURE(status)) { in TestRepeatedWallTime()
2575 status = U_ZERO_ERROR; in TestRepeatedWallTime()
2578 calGMT.setTime(calLast.getTime(status), status); in TestRepeatedWallTime()
2579 CalFields outLastGMT(calGMT, status); in TestRepeatedWallTime()
2580 if (U_FAILURE(status)) { in TestRepeatedWallTime()
2591 status = U_ZERO_ERROR; in TestRepeatedWallTime()
2594 calGMT.setTime(calDefault.getTime(status), status); in TestRepeatedWallTime()
2595 CalFields outDefGMT(calGMT, status); in TestRepeatedWallTime()
2596 if (U_FAILURE(status)) { in TestRepeatedWallTime()
2607 status = U_ZERO_ERROR; in TestRepeatedWallTime()
2610 calGMT.setTime(calFirst.getTime(status), status); in TestRepeatedWallTime()
2611 CalFields outFirstGMT(calGMT, status); in TestRepeatedWallTime()
2612 if (U_FAILURE(status)) { in TestRepeatedWallTime()
2655 UErrorCode status = U_ZERO_ERROR; in TestSkippedWallTime() local
2656 GregorianCalendar calGMT((const TimeZone&)*TimeZone::getGMT(), status); in TestSkippedWallTime()
2657 GregorianCalendar calDefault(status); in TestSkippedWallTime()
2658 GregorianCalendar calLast(status); in TestSkippedWallTime()
2659 GregorianCalendar calFirst(status); in TestSkippedWallTime()
2660 GregorianCalendar calNextAvail(status); in TestSkippedWallTime()
2662 if (U_FAILURE(status)) { in TestSkippedWallTime()
2680 status = U_ZERO_ERROR; in TestSkippedWallTime()
2684 d = calLast.getTime(status); in TestSkippedWallTime()
2686 calGMT.setTime(d, status); in TestSkippedWallTime()
2687 CalFields outLastGMT(calGMT, status); in TestSkippedWallTime()
2688 if (U_FAILURE(status)) { in TestSkippedWallTime()
2697 } else if (U_SUCCESS(status)) { in TestSkippedWallTime()
2704 status = U_ZERO_ERROR; in TestSkippedWallTime()
2708 d = calDefault.getTime(status); in TestSkippedWallTime()
2710 calGMT.setTime(d, status); in TestSkippedWallTime()
2711 CalFields outDefGMT(calGMT, status); in TestSkippedWallTime()
2712 if (U_FAILURE(status)) { in TestSkippedWallTime()
2721 } else if (U_SUCCESS(status)) { in TestSkippedWallTime()
2728 status = U_ZERO_ERROR; in TestSkippedWallTime()
2732 d = calFirst.getTime(status); in TestSkippedWallTime()
2734 calGMT.setTime(d, status); in TestSkippedWallTime()
2735 CalFields outFirstGMT(calGMT, status); in TestSkippedWallTime()
2736 if (U_FAILURE(status)) { in TestSkippedWallTime()
2745 } else if (U_SUCCESS(status)) { in TestSkippedWallTime()
2752 status = U_ZERO_ERROR; in TestSkippedWallTime()
2756 d = calNextAvail.getTime(status); in TestSkippedWallTime()
2758 calGMT.setTime(d, status); in TestSkippedWallTime()
2759 CalFields outNextAvailGMT(calGMT, status); in TestSkippedWallTime()
2760 if (U_FAILURE(status)) { in TestSkippedWallTime()
2769 } else if (U_SUCCESS(status)) { in TestSkippedWallTime()
2781 UErrorCode status = U_ZERO_ERROR; in TestCloneLocale() local
2783 Locale::createFromName("en"), status)); in TestCloneLocale()
2785 Locale l0 = cal->getLocale(ULOC_VALID_LOCALE, status); in TestCloneLocale()
2788 Locale l = cal2->getLocale(ULOC_VALID_LOCALE, status); in TestCloneLocale()
2790 …ned locale %s != original locale %s, status %s\n", l0.getName(), l.getName(), u_errorName(status)); in TestCloneLocale()
2795 …Calendar(Calendar* cal, int32_t initMonth, int32_t initDay, int32_t initYear, UErrorCode& status) { in setAndTestCalendar() argument
2799 int32_t day = cal->get(UCAL_DAY_OF_MONTH, status); in setAndTestCalendar()
2800 int32_t month = cal->get(UCAL_MONTH, status); in setAndTestCalendar()
2801 int32_t year = cal->get(UCAL_YEAR, status); in setAndTestCalendar()
2802 if(U_FAILURE(status)) in setAndTestCalendar()
2812 void CalendarTest::setAndTestWholeYear(Calendar* cal, int32_t startYear, UErrorCode& status) { in setAndTestWholeYear() argument
2815 setAndTestCalendar(cal, startMonth, startDay, startYear, status); in setAndTestWholeYear()
2816 if(U_FAILURE(status) && startDay == 30) { in setAndTestWholeYear()
2817 status = U_ZERO_ERROR; in setAndTestWholeYear()
3249 UErrorCode status = U_ZERO_ERROR; in TestIslamicUmAlQura() local
3253 Calendar* tstCal = Calendar::createInstance(*((const TimeZone *)tzSA), umalquraLoc, status); in TestIslamicUmAlQura()
3254 Calendar* gregCal = Calendar::createInstance(*((const TimeZone *)tzSA), gregoLoc, status); in TestIslamicUmAlQura()
3271 setAndTestWholeYear(tstCal, startYear, status); in TestIslamicUmAlQura()
3272 status = U_ZERO_ERROR; in TestIslamicUmAlQura()
3279 setAndTestCalendar( tstCal, initMonth, initDay, initYear, status); in TestIslamicUmAlQura()
3283 day = tstCal->get(UCAL_DAY_OF_MONTH,status); in TestIslamicUmAlQura()
3284 month = tstCal->get(UCAL_MONTH,status); in TestIslamicUmAlQura()
3285 year = tstCal->get(UCAL_YEAR,status); in TestIslamicUmAlQura()
3287 tstCal->roll(UCAL_DAY_OF_MONTH, (UBool)TRUE, status); in TestIslamicUmAlQura()
3294 status = U_ZERO_ERROR; in TestIslamicUmAlQura()
3298 setAndTestCalendar( tstCal, initMonth, initDay, initYear, status); in TestIslamicUmAlQura()
3299 if(U_SUCCESS(status)) { in TestIslamicUmAlQura()
3300 errln("error NOT detected status %i",status); in TestIslamicUmAlQura()
3302 int32_t day = tstCal->get(UCAL_DAY_OF_MONTH, status); in TestIslamicUmAlQura()
3303 int32_t month = tstCal->get(UCAL_MONTH, status); in TestIslamicUmAlQura()
3304 int32_t year = tstCal->get(UCAL_YEAR, status); in TestIslamicUmAlQura()
3308 status = U_ZERO_ERROR; in TestIslamicUmAlQura()
3312 setAndTestCalendar( tstCal, initMonth, initDay, initYear, status); in TestIslamicUmAlQura()
3315 SimpleDateFormat* formatter = new SimpleDateFormat("yyyy-MM-dd", Locale::getUS(), status); in TestIslamicUmAlQura()
3316 UDate date = formatter->parse("1975-05-06", status); in TestIslamicUmAlQura()
3317 Calendar* is_cal = Calendar::createInstance(umalquraLoc, status); in TestIslamicUmAlQura()
3318 is_cal->setTime(date, status); in TestIslamicUmAlQura()
3319 int32_t is_day = is_cal->get(UCAL_DAY_OF_MONTH,status); in TestIslamicUmAlQura()
3320 int32_t is_month = is_cal->get(UCAL_MONTH,status); in TestIslamicUmAlQura()
3321 int32_t is_year = is_cal->get(UCAL_YEAR,status); in TestIslamicUmAlQura()
3326 UDate date2 = is_cal->getTime(status); in TestIslamicUmAlQura()
3337 status = U_ZERO_ERROR; in TestIslamicUmAlQura()
3339 date = gregCal->getTime(status); in TestIslamicUmAlQura()
3340 tstCal->setTime(date, status); in TestIslamicUmAlQura()
3341 int32_t uYear = tstCal->get(UCAL_YEAR, status); in TestIslamicUmAlQura()
3342 int32_t uMon = tstCal->get(UCAL_MONTH, status) + 1; in TestIslamicUmAlQura()
3343 int32_t uDay = tstCal->get(UCAL_DATE, status); in TestIslamicUmAlQura()
3344 if(U_FAILURE(status)) { in TestIslamicUmAlQura()
3346 guMapPtr->gYear, guMapPtr->gMon, guMapPtr->gDay, u_errorName(status) ); in TestIslamicUmAlQura()
3362 UErrorCode status = U_ZERO_ERROR; in TestIslamicTabularDates() local
3365 SimpleDateFormat* formatter = new SimpleDateFormat("yyyy-MM-dd", Locale::getUS(), status); in TestIslamicTabularDates()
3366 UDate date = formatter->parse("1975-05-06", status); in TestIslamicTabularDates()
3368 Calendar* tstCal = Calendar::createInstance(islamicLoc, status); in TestIslamicTabularDates()
3369 tstCal->setTime(date, status); in TestIslamicTabularDates()
3370 int32_t is_day = tstCal->get(UCAL_DAY_OF_MONTH,status); in TestIslamicTabularDates()
3371 int32_t is_month = tstCal->get(UCAL_MONTH,status); in TestIslamicTabularDates()
3372 int32_t is_year = tstCal->get(UCAL_YEAR,status); in TestIslamicTabularDates()
3376 tstCal = Calendar::createInstance(tblaLoc, status); in TestIslamicTabularDates()
3377 tstCal->setTime(date, status); in TestIslamicTabularDates()
3378 int32_t tbla_day = tstCal->get(UCAL_DAY_OF_MONTH,status); in TestIslamicTabularDates()
3379 int32_t tbla_month = tstCal->get(UCAL_MONTH,status); in TestIslamicTabularDates()
3380 int32_t tbla_year = tstCal->get(UCAL_YEAR,status); in TestIslamicTabularDates()
3393 UErrorCode status = U_ZERO_ERROR; in TestHebrewMonthValidation() local
3394 …<Calendar> cal(Calendar::createInstance(Locale::createFromName("he_IL@calendar=hebrew"), status)); in TestHebrewMonthValidation()
3395 if (failure(status, "Calendar::createInstance, locale:he_IL@calendar=hebrew", TRUE)) return; in TestHebrewMonthValidation()
3403 d = pCal->getTime(status); in TestHebrewMonthValidation()
3404 if (U_FAILURE(status)) { in TestHebrewMonthValidation()
3407 status = U_ZERO_ERROR; in TestHebrewMonthValidation()
3411 d = pCal->getTime(status); in TestHebrewMonthValidation()
3413 if (status == U_ILLEGAL_ARGUMENT_ERROR) { in TestHebrewMonthValidation()
3432 UErrorCode status; in TestWeekData() local
3435 status = U_ZERO_ERROR; in TestWeekData()
3436 LocalPointer<Calendar> cal1(Calendar::createInstance(LOCALE_PAIRS[i], status)); in TestWeekData()
3437 LocalPointer<Calendar> cal2(Calendar::createInstance(LOCALE_PAIRS[i + 1], status)); in TestWeekData()
3441 UCalendarDaysOfWeek dow1 = cal1->getFirstDayOfWeek(status); in TestWeekData()
3442 UCalendarDaysOfWeek dow2 = cal2->getFirstDayOfWeek(status); in TestWeekData()
3453 status = U_ZERO_ERROR; in TestWeekData()
3454 UCalendarWeekdayType wdt1 = cal1->getDayOfWeekType((UCalendarDaysOfWeek)d, status); in TestWeekData()
3455 UCalendarWeekdayType wdt2 = cal2->getDayOfWeekType((UCalendarDaysOfWeek)d, status); in TestWeekData()
3612 UErrorCode status = U_ZERO_ERROR; in TestAddAcrossZoneTransition() local
3613 GregorianCalendar cal(status); in TestAddAcrossZoneTransition()
3617 status = U_ZERO_ERROR; in TestAddAcrossZoneTransition()
3622 cal.add(UCAL_DATE, AAZTDATA[i].deltaDays, status); in TestAddAcrossZoneTransition()
3625 if (!AAZTDATA[i].expected.isEquivalentTo(cal, status)) { in TestAddAcrossZoneTransition()
3626 CalFields res(cal, status); in TestAddAcrossZoneTransition()
3644 UErrorCode status = U_ZERO_ERROR; in TestChineseCalendarMapping() local
3648 …calPointer<Calendar> calGregory(Calendar::createInstance(zone->clone(), locEnCalGregory, status)); in TestChineseCalendarMapping()
3649 …calPointer<Calendar> calChinese(Calendar::createInstance(zone.orphan(), locEnCalChinese, status)); in TestChineseCalendarMapping()
3650 if ( U_FAILURE(status) ) { in TestChineseCalendarMapping()
3651 …createInstance fails for en with calendar=gregorian or calendar=chinese: %s", u_errorName(status)); in TestChineseCalendarMapping()
3657 status = U_ZERO_ERROR; in TestChineseCalendarMapping()
3659 UDate date = calGregory->getTime(status); in TestChineseCalendarMapping()
3660 calChinese->setTime(date, status); in TestChineseCalendarMapping()
3661 if ( U_FAILURE(status) ) { in TestChineseCalendarMapping()
3663 mapPtr->gyr, mapPtr->gmo, mapPtr->gda, u_errorName(status)); in TestChineseCalendarMapping()
3666 int32_t era = calChinese->get(UCAL_ERA, status); in TestChineseCalendarMapping()
3667 int32_t yr = calChinese->get(UCAL_YEAR, status); in TestChineseCalendarMapping()
3668 int32_t mo = calChinese->get(UCAL_MONTH, status) + 1; in TestChineseCalendarMapping()
3669 int32_t lp = calChinese->get(UCAL_IS_LEAP_MONTH, status); in TestChineseCalendarMapping()
3670 int32_t da = calChinese->get(UCAL_DATE, status); in TestChineseCalendarMapping()
3671 if ( U_FAILURE(status) ) { in TestChineseCalendarMapping()
3673 mapPtr->gyr, mapPtr->gmo, mapPtr->gda, u_errorName(status)); in TestChineseCalendarMapping()
3688 date = calChinese->getTime(status); in TestChineseCalendarMapping()
3689 calGregory->setTime(date, status); in TestChineseCalendarMapping()
3690 if ( U_FAILURE(status) ) { in TestChineseCalendarMapping()
3692 mapPtr->cyr, mapPtr->cmo, mapPtr->clp, mapPtr->cda, u_errorName(status)); in TestChineseCalendarMapping()
3695 yr = calGregory->get(UCAL_YEAR, status); in TestChineseCalendarMapping()
3696 mo = calGregory->get(UCAL_MONTH, status) + 1; in TestChineseCalendarMapping()
3697 da = calGregory->get(UCAL_DATE, status); in TestChineseCalendarMapping()
3698 if ( U_FAILURE(status) ) { in TestChineseCalendarMapping()
3700 mapPtr->cyr, mapPtr->cmo, mapPtr->clp, mapPtr->cda, u_errorName(status)); in TestChineseCalendarMapping()