From a47717934aee8e9581aefa68a917f60a3348375c Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Fri, 3 Feb 2023 00:50:21 +0000 Subject: [PATCH] ICU-22252 Suppress Calendar Consistency See #2298 --- icu4c/source/test/intltest/incaltst.cpp | 32 ++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/icu4c/source/test/intltest/incaltst.cpp b/icu4c/source/test/intltest/incaltst.cpp index 4de2063c109..1ae2a4f94be 100644 --- a/icu4c/source/test/intltest/incaltst.cpp +++ b/icu4c/source/test/intltest/incaltst.cpp @@ -987,8 +987,8 @@ void IntlCalendarTest::TestConsistencyEthiopicAmeteAlem() { checkConsistency("en@calendar=ethiopic-amete-alem"); } void IntlCalendarTest::checkConsistency(const char* locale) { - // Check 2.5 years in quick mode and 8000 years in exhaustive mode. - int32_t numOfDaysToTest = static_cast((quick ? 2.5 : 8000) * 365); + // Check 2.5 years in quick mode and 6000 years in exhaustive mode. + int32_t numOfDaysToTest = static_cast((quick ? 2.5 : 6000) * 365); constexpr int32_t msInADay = 1000*60*60*24; std::string msg("TestConsistency"); IcuTestErrorCode status(*this, (msg + locale).c_str()); @@ -999,6 +999,10 @@ void IntlCalendarTest::checkConsistency(const char* locale) { if (status.errIfFailureAndReset("Cannot create calendar %s", locale)) { return; } + const char* type = base->getType(); + // Do not ignore in quick mode + bool ignoreOrdinaryMonth12Bug = (!quick) && (strcmp("chinese", type) == 0 || strcmp("dangi", type) == 0); + bool ignoreICU22258 = (!quick) && (strcmp("dangi", type) == 0); UDate test = Calendar::getNow(); base->setTimeZone(*(TimeZone::getGMT())); int32_t j; @@ -1085,6 +1089,22 @@ void IntlCalendarTest::checkConsistency(const char* locale) { return; } if (test != result) { + if (ignoreOrdinaryMonth12Bug && + base->get(UCAL_ORDINAL_MONTH, status) == 12) { + logKnownIssue("ICU-22230", "Problem December in Leap Year"); + status.reset(); + continue; + } + int32_t year = base->get(UCAL_YEAR, status); + int32_t month = base->get(UCAL_MONTH, status) + 1; + int32_t date = base->get(UCAL_DATE, status); + if (ignoreICU22258 && (year == 4 || year == 34) && month == 12 && date == 30) { + logKnownIssue("ICU-22258", + "Dangi Problem in 1988/2/17=>4/12/30 and 1958/2/18=>34/12/30"); + status.reset(); + continue; + } + errln((UnicodeString)"Round trip conversion produces different " "time from " + test + " to " + result + " delta: " + (result - test) + @@ -1094,16 +1114,12 @@ void IntlCalendarTest::checkConsistency(const char* locale) { g->get(UCAL_DATE, status) + ") \n" + " Calendar[" + base->getType() + "](e=" + base->get(UCAL_ERA, status) + " " + - base->get(UCAL_YEAR, status) + "/" + - (base->get(UCAL_MONTH, status) + 1) + "/" + - base->get(UCAL_DATE, status) + ") ordinalMonth=" + + year + "/" + month + "/" + date + + ") ordinalMonth=" + base->get(UCAL_ORDINAL_MONTH, status)); - status.errIfFailureAndReset(); - return; } } - status.errIfFailureAndReset(); } void IntlCalendarTest::simpleTest(const Locale& loc, const UnicodeString& expect, UDate expectDate, UErrorCode& status)