diff options
author | Nikita Iashchenko <nikitai@google.com> | 2019-04-18 02:49:05 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-04-18 02:49:05 -0700 |
commit | 32e237b9507e231d15ff3aeba072ecf15cc26009 (patch) | |
tree | 67395e00d2f962345a257dcffec07221bfc5c104 /icu4j/main/tests | |
parent | c9af3e4ca52297e59a3526b56c1c4c2862bf218b (diff) | |
parent | ac597cb5fc74a5f878fda9310da33c82cdc1af79 (diff) | |
download | icu-32e237b9507e231d15ff3aeba072ecf15cc26009.tar.gz |
Upgrade ICU from 63.1 up to 63.2
am: ac597cb5fc
Change-Id: I28a0960d94b87ccf999e4e642b4b1fcaa66ba7c7
Diffstat (limited to 'icu4j/main/tests')
3 files changed, 36 insertions, 6 deletions
diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/JapaneseTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/JapaneseTest.java index 6ec96f48c..1c90f3ac2 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/JapaneseTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/JapaneseTest.java @@ -154,9 +154,9 @@ public class JapaneseTest extends CalendarTestFmwk { Calendar cal = new JapaneseCalendar(loc); DateFormat enjformat = cal.getDateTimeFormat(0,0,new ULocale("en_JP@calendar=japanese")); DateFormat format = cal.getDateTimeFormat(0,0,loc); - ((SimpleDateFormat)format).applyPattern("y.M.d"); // Note: just 'y' doesn't work here. + ((SimpleDateFormat)format).applyPattern("y/M/d"); // Note: just 'y' doesn't work here. ParsePosition pos = new ParsePosition(0); - Date aDate = format.parse("1.1.9", pos); // after the start of heisei accession. Jan 1, 1H wouldn't work because it is actually showa 64 + Date aDate = format.parse("1/5/9", pos); // after the start of Reiwa accession. Jan 1, R1 wouldn't work because it is actually Heisei 31 String inEn = enjformat.format(aDate); cal.clear(); @@ -165,7 +165,7 @@ public class JapaneseTest extends CalendarTestFmwk { int gotEra = cal.get(Calendar.ERA); int expectYear = 1; - int expectEra = JapaneseCalendar.CURRENT_ERA; + int expectEra = JapaneseCalendar.CURRENT_ERA; // Reiwa if((gotYear != expectYear) || (gotEra != expectEra)) { errln("Expected year " + expectYear + ", era " + expectEra +", but got year " + gotYear + " and era " + gotEra + ", == " + inEn); @@ -173,7 +173,7 @@ public class JapaneseTest extends CalendarTestFmwk { logln("Got year " + gotYear + " and era " + gotEra + ", == " + inEn); } - // Test parse with missing era (should default to current era, heisei) + // Test parse with missing era (should default to current era) // Test parse with incomplete information logln("Testing parse w/ just year..."); Calendar cal2 = new JapaneseCalendar(loc); @@ -197,7 +197,7 @@ public class JapaneseTest extends CalendarTestFmwk { gotYear = cal2.get(Calendar.YEAR); gotEra = cal2.get(Calendar.ERA); expectYear = 1; - expectEra = JapaneseCalendar.CURRENT_ERA; + expectEra = JapaneseCalendar.CURRENT_ERA; // Reiwa if((gotYear != 1) || (gotEra != expectEra)) { errln("parse "+ samplestr + " of 'y' as Japanese Calendar, expected year " + expectYear + " and era " + expectEra + ", but got year " + gotYear + " and era " + gotEra + " (Gregorian:" + str +")"); @@ -379,5 +379,30 @@ public class JapaneseTest extends CalendarTestFmwk { doLimitsTest(jcal, null, cal.getTime()); doTheoreticalLimitsTest(jcal, true); } + + public void TestHeiseiToReiwa() { + Calendar cal = Calendar.getInstance(); + cal.set(2019, Calendar.APRIL, 29); + + DateFormat jfmt = DateFormat.getDateInstance(DateFormat.LONG, new ULocale("ja@calendar=japanese")); + + final String[] EXPECTED_FORMAT = { + "\u5E73\u621031\u5E744\u670829\u65E5", // Heisei 31 April 29 + "\u5E73\u621031\u5E744\u670830\u65E5", // Heisei 31 April 30 + "\u4EE4\u548C1\u5E745\u67081\u65E5", // Reiwa 1 May 1 + "\u4EE4\u548C1\u5E745\u67082\u65E5", // Reiwa 1 May 2 + }; + + for (int i = 0; i < EXPECTED_FORMAT.length; i++) { + Date d = cal.getTime(); + String dateStr = jfmt.format(d); + if (!EXPECTED_FORMAT[i].equals(dateStr)) { + errln("Formatting year:" + cal.get(Calendar.YEAR) + " month:" + (cal.get(Calendar.MONTH) + 1) + + " day:" + cal.get(Calendar.DATE) + " - expected: " + EXPECTED_FORMAT[i] + + " / actual: " + dateStr); + } + cal.add(Calendar.DATE, 1); + } + } } diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTest.java index 3e96242d3..63e956c01 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTest.java @@ -6325,6 +6325,11 @@ public class NumberFormatTest extends TestFmwk { result = nf.parse("1E-547483647"); assertEquals("Should *not* snap to zero", "1E-547483647", result.toString()); + + // Test edge case overflow of exponent + result = nf.parse(".0003e-2147483644"); + assertEquals("Should not overflow", + "0", result.toString()); } @Test diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java index 7b965197f..17105ecd7 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java @@ -10,7 +10,7 @@ package com.ibm.icu.dev.test.util; public class DebugUtilitiesData extends Object { - public static final String ICU4C_VERSION="63.1"; + public static final String ICU4C_VERSION="63.2"; public static final int UDebugEnumType = 0; public static final int UCalendarDateFields = 1; public static final int UCalendarMonths = 2; |