]> granicus.if.org Git - icu/commitdiff
ICU-22252 Suppress Calendar Consistency
authorFrank Tang <ftang@chromium.org>
Fri, 3 Feb 2023 00:50:21 +0000 (00:50 +0000)
committerFredrik Roubert <fredrik@roubert.name>
Fri, 3 Feb 2023 15:38:50 +0000 (16:38 +0100)
See #2298

icu4c/source/test/intltest/incaltst.cpp

index 4de2063c109b20399d9791b5f2d9f3b310533118..1ae2a4f94be7d9e51ac09934cd1f9058d9bd8e37 100644 (file)
@@ -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<int32_t>((quick ? 2.5 : 8000) * 365);
+    // Check 2.5 years in quick mode and 6000 years in exhaustive mode.
+    int32_t numOfDaysToTest = static_cast<int32_t>((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)