diff --git a/icu4c/source/test/intltest/calregts.cpp b/icu4c/source/test/intltest/calregts.cpp index 5f35e43c0a..f59e375985 100644 --- a/icu4c/source/test/intltest/calregts.cpp +++ b/icu4c/source/test/intltest/calregts.cpp @@ -1956,8 +1956,10 @@ void CalendarRegressionTest::TestJ81() { fmt.setCalendar(cal); // Get the Gregorian cutover UDate cutover = cal.getGregorianChange(); + UDate days = ONE_DAY; + days = cutover/days; logln(UnicodeString("Cutover: {") + - fmt.format(cutover, temp) + "}(" + cutover/ONE_DAY + ")"); + fmt.format(cutover, temp) + "}(epoch days-" + (int)days + ", jd" + (2440588 + days) +")"); // Check woy and doy handling. Reference data: /* w40 d274 Mon 1 Oct 1582 @@ -1993,25 +1995,12 @@ void CalendarRegressionTest::TestJ81() { 26, 42, 289, UCAL_TUESDAY, 27, 42, 290, UCAL_WEDNESDAY, 28, 42, 291, UCAL_THURSDAY, - -#ifdef _TMP_ROLLOVER_28 29, 42, 292, UCAL_FRIDAY, 30, 42, 293, UCAL_SATURDAY, 31, 43, 294, UCAL_SUNDAY -#endif }; int32_t DOY_DATA_length = (int32_t)(sizeof(DOY_DATA) / sizeof(DOY_DATA[0])); -#ifndef _TMP_ROLLOVER_28 - static const UDate kExpire = 1067480869000.0; - - if(Calendar::getNow() >= kExpire) { - errln("FAIL: please remove #ifdef _TMP_ROLLOVER_28 and fix this code - [%s:%d]", __FILE__, __LINE__); - } else { - logln("WARNING: %.0lf days until gregorian cutover test reenabled - please #define _TMP_ROLLOVER_28 or remove these #ifdefs [%s:%d]\n", (kExpire-Calendar::getNow())/86400000.0, __FILE__, __LINE__); - } -#endif - for (i=0; ifields cal.set(1582, UCAL_OCTOBER, DOY_DATA[i]); @@ -2025,7 +2014,8 @@ void CalendarRegressionTest::TestJ81() { if (woy != DOY_DATA[i+1] || doy != DOY_DATA[i+2] || dow != DOY_DATA[i+3]) { errln((UnicodeString)"Fail: expect woy=" + DOY_DATA[i+1] + ", doy=" + DOY_DATA[i+2] + ", dow=" + DOY_DATA[i+3] + " on " + - fmt.format(cal.getTime(status), temp.remove())); + fmt.format(cal.getTime(status), temp.remove()) + + " set(1582,OCTOBER, " + DOY_DATA[i] + ")"); logln(CalendarTest::calToStr(cal)); status = U_ZERO_ERROR; } else { @@ -2035,7 +2025,6 @@ void CalendarRegressionTest::TestJ81() { logln(CalendarTest::calToStr(cal)); status = U_ZERO_ERROR; } - // Test fields->time for WOY cal.clear(); cal.set(UCAL_YEAR, 1582); @@ -2051,6 +2040,7 @@ void CalendarRegressionTest::TestJ81() { " dow=" + DOY_DATA[i+3] + " => " + fmt.format(cal.getTime(status), temp.remove()) + ", expected 1582 Oct " + DOY_DATA[i]); + logln(CalendarTest::calToStr(cal)); status = U_ZERO_ERROR; } @@ -2073,11 +2063,6 @@ void CalendarRegressionTest::TestJ81() { } status = U_ZERO_ERROR; -#ifndef _TMP_ROLLOVER_28 - logln("warning: %s:%d exitting early\n", __FILE__, __LINE__); - return; -#endif - #define ADD_ROLL ADD|ROLL #define PLUS_MINUS PLUS|MINUS // Test cases diff --git a/icu4c/source/test/intltest/caltest.cpp b/icu4c/source/test/intltest/caltest.cpp index 8724602cb0..d3def76f28 100644 --- a/icu4c/source/test/intltest/caltest.cpp +++ b/icu4c/source/test/intltest/caltest.cpp @@ -1294,17 +1294,7 @@ CalendarTest::TestDOW_LOCALandYEAR_WOY() yearAddTest(*cal, status); // aliu loop_addroll(cal, /*sdf,*/ times, UCAL_DOW_LOCAL, UCAL_DAY_OF_WEEK, status); if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1998"); return; } -#ifndef _TMP_ROLLOVER_28 - static const UDate kExpire = 1067480869000.0; - - if(Calendar::getNow() >= kExpire) { - errln("FAIL: please remove #ifdef _TMP_ROLLOVER_28 and fix this code - [%s:%d]", __FILE__, __LINE__); - } else { - logln("WARNING: %.0lf days until gregorian cutover test reenabled - please #define _TMP_ROLLOVER_28 or remove these #ifdefs [%s:%d]\n", (kExpire-Calendar::getNow())/86400000.0, __FILE__, __LINE__); - } -#endif -#ifdef _TMP_ROLLOVER_28 cal->clear(); cal->set(1582, UCAL_OCTOBER, 1); doYEAR_WOYLoop(cal, sdf, times, status); @@ -1312,7 +1302,6 @@ CalendarTest::TestDOW_LOCALandYEAR_WOY() yearAddTest(*cal, status); // aliu loop_addroll(cal, /*sdf,*/ times, UCAL_DOW_LOCAL, UCAL_DAY_OF_WEEK, status); if (U_FAILURE(status)) { errln("Error in parse/calculate test for 1582"); return; } -#endif delete sdf; delete cal; @@ -1453,28 +1442,29 @@ CalendarTest::doYEAR_WOYLoop(Calendar *cal, SimpleDateFormat *sdf, if(original!=tst) { us.remove(); sdf->format(Formattable(original, Formattable::kIsDate), us, errorCode); - errln("Parsed time doesn't match with regular"); - logln("expected "+us); + errln("FAIL: Parsed time doesn't match with regular"); + logln("expected "+us + " " + calToStr(*cal)); us.remove(); sdf->format(Formattable(tst, Formattable::kIsDate), us, errorCode); - logln("got "+us); + logln("got "+us + " " + calToStr(*tstres)); } tstres->clear(); tstres->set(UCAL_YEAR_WOY, cal->get(UCAL_YEAR_WOY, errorCode)); tstres->set(UCAL_WEEK_OF_YEAR, cal->get(UCAL_WEEK_OF_YEAR, errorCode)); tstres->set(UCAL_DOW_LOCAL, cal->get(UCAL_DOW_LOCAL, errorCode)); if(cal->get(UCAL_YEAR, errorCode) != tstres->get(UCAL_YEAR, errorCode)) { - errln("Different Year!"); + errln("FAIL: Different Year!"); logln((UnicodeString)"Expected "+cal->get(UCAL_YEAR, errorCode)); logln((UnicodeString)"Got "+tstres->get(UCAL_YEAR, errorCode)); return; } if(cal->get(UCAL_DAY_OF_YEAR, errorCode) != tstres->get(UCAL_DAY_OF_YEAR, errorCode)) { - errln("Different Day Of Year!"); + errln("FAIL: Different Day Of Year!"); logln((UnicodeString)"Expected "+cal->get(UCAL_DAY_OF_YEAR, errorCode)); logln((UnicodeString)"Got "+tstres->get(UCAL_DAY_OF_YEAR, errorCode)); return; } + //logln(calToStr(*cal)); cal->add(UCAL_DATE, 1, errorCode); if (U_FAILURE(errorCode)) { errln("Add error"); return; } us.remove();