diff options
author | Nikita Iashchenko <nikitai@google.com> | 2018-10-17 19:47:35 -0700 |
---|---|---|
committer | Nikita Iashchenko <nikitai@google.com> | 2019-04-16 18:21:54 +0100 |
commit | ac597cb5fc74a5f878fda9310da33c82cdc1af79 (patch) | |
tree | 9cd682036f1fc8ad1a4aa8cc4b98820dcfd24e4f /icu4j/main/tests | |
parent | 8b9f2e015690e8952446385dbf5d07e71ea5ae95 (diff) | |
download | icu-ac597cb5fc74a5f878fda9310da33c82cdc1af79.tar.gz |
Upgrade ICU from 63.1 up to 63.2
Commits are taken from https://github.com/unicode-org/icu/commits/release-63-2.
This includes cherry-picking the following upstream commits:
1. ICU-20208 uspoof.cpp function checkImpl should be static, regenerate urename.h
(cherry picked from commit 9ec2c332c1c9156323944ea2b15c2b91952efae4)
2. ICU-20240 Fix Windows build failure in japancal.cpp
(cherry picked from commit 3d86d24a682e8073f9c0073f63e208f2d9f58e0c)
4. ICU-20246 Fixing another integer overflow in number parsing.
(cherry picked from commit 53d8c8f3d181d87a6aa925b449b51c4a2c922a51)
5. ICU-20255 revert to reflection for methods not yet in Android API level 21..23
(cherry picked from commit cee3c150ab648b6cee46fb377598c157824d3a61)
5. ICU-20536 Japanese era Reiwa support in ICU4C 63
6. ICU-20536 Japanese era Reiwa support in ICU4J 63
7. ICU-20536 ICU 63.2 release tasks + tzdata2019a
The following commits should have been cherry-picked normally, but were skipped since
they have already been merged:
1. ICU-20214 Fix namespace error on Cygwin
(cherry picked from commit 31b89b54840361fdfc367ef02019b10424cdb75c)
(merged in http://r.android.com/840834)
2. ICU-20209 Fix build failures on Windows with std::atomic not in enclosing namespace std
(cherry picked from commit 5a34bfb1516a6719b5f470063c6be2f47446f0b2)
(merged in http://r.android.com/840835)
3. ICU-20250 faster MutableCodePointTrie.build(): use a hashtable to find equal blocks in earlier parts of the compacted data & index arrays
(cherry picked from commit 59006770ed0a11d197cf39cbee92e4c96ab00ed8)
(merged in http://r.android.com/819398)
4. ICU-20250 make UnicodeSet(intprop=value) faster
- fastpath for UnicodeSet.add(new last range)
- fewer UnicodeSet memory allocations:
initial internal list array, exponential array growth,
allocate strings list/set only when first one is added
- faster CodePointTrie.getRange(): fewer calls to filter function
- revert UnicodeSet(intprop=value) from trie ranges to range starts + lookup
- cache per-int-prop range starts: fewer lookups
(cherry picked from commit 98f9170004c29388d756a8a283573164a7a26bef)
(merged in http://r.android.com/829900)
The following things were done to update all CLDR and ICU related files:
* Run ./updateicudata.py after upgrading ICU to 63.2
* Run ./updatecldrdata.py after updating external/cldr
* Update libandroidicu with ./tools/icu4c_srcgen/generate_libandroidicu.py
* Update README.version to 63.2
* Generate android_icu4j sources with ./tools/srcgen/generate_android_icu4j.sh
* Run system/timezone/update-tzdata.py, but no tzdata was changed
Bug: 77858319
Test: ./tools/updatecldrdata.py
Test: ./tools/updateicudata.py
Test: ./tools/srcgen/generate_android_icu4j.sh
Test: system/timezone/update-tzdata.py
Test: m droid cts
Test: cts-tradefed run cts-dev -m CtsLibcoreTestCases
Test: cts-tradefed run cts-dev -m CtsLibcoreOjTestCases
Test: cts-tradefed run cts-dev -m CtsIcuTestCases
Change-Id: I6c1190c364176977e6aed8fda18e63f4cc8df667
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; |