Skip to content

Commit

Permalink
ICU-22407 Suppress Calendar Consistency
Browse files Browse the repository at this point in the history
Similar to changes to C++ in
#2298
  • Loading branch information
FrankYFTang committed Aug 1, 2023
1 parent d511cad commit 9511fff
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2104,8 +2104,8 @@ public void TestConsistencyEthiopicAmeteAlem() {

public void checkConsistency(String locale) {
boolean quick = getExhaustiveness() <= 5;
// Check 3 years in quick mode and 8000 years in exhaustive mode.
int numOfDaysToTest = (quick ? 3 * 365 : 8000 * 365);
// Check 3 years in quick mode and 6000 years in exhaustive mode.
int numOfDaysToTest = (quick ? 3 * 365 : 6000 * 365);
int msInADay = 1000*60*60*24;

// g is just for debugging messages.
Expand All @@ -2115,6 +2115,9 @@ public void checkConsistency(String locale) {

Calendar r = (Calendar)base.clone();
int lastDay = 1;
String type = base.getType();
boolean ignoreOrdinaryMonth12Bug = (!quick) && (type.equals("chinese") || type.equals("dangi"));
boolean ignoreICU22258 = (!quick) && type.equals("dangi");
for (int j = 0; j < numOfDaysToTest; j++, test.setTime(test.getTime() - msInADay)) {
g.setTime(test);
base.clear();
Expand Down Expand Up @@ -2159,6 +2162,19 @@ public void checkConsistency(String locale) {
}
Date result = r.getTime();
if (!test.equals(result)) {
if (ignoreOrdinaryMonth12Bug && base.get(Calendar.ORDINAL_MONTH) == 12) {
logKnownIssue("ICU-22230", "Problem December in Leap Year");
continue;
}
int year = base.get(Calendar.YEAR);
int month = base.get(Calendar.MONTH) + 1;
int date = base.get(Calendar.DATE);
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");
continue;
}

errln("Round trip conversion produces different time from " + test + " to " +
result + " delta: " + (result.getTime() - test.getTime()) +
" Gregorian(e=" + g.get(Calendar.ERA) + " " + g.get(Calendar.YEAR) + "/" +
Expand Down

0 comments on commit 9511fff

Please sign in to comment.