summaryrefslogtreecommitdiff
path: root/android_icu4j/src/main/tests
diff options
context:
space:
mode:
authorNikita Iashchenko <nikitai@google.com>2018-10-17 19:47:35 -0700
committerNikita Iashchenko <nikitai@google.com>2019-04-16 18:21:54 +0100
commitac597cb5fc74a5f878fda9310da33c82cdc1af79 (patch)
tree9cd682036f1fc8ad1a4aa8cc4b98820dcfd24e4f /android_icu4j/src/main/tests
parent8b9f2e015690e8952446385dbf5d07e71ea5ae95 (diff)
downloadicu-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 'android_icu4j/src/main/tests')
-rw-r--r--android_icu4j/src/main/tests/android/icu/dev/test/calendar/JapaneseTest.java35
-rw-r--r--android_icu4j/src/main/tests/android/icu/dev/test/format/NumberFormatTest.java5
-rw-r--r--android_icu4j/src/main/tests/android/icu/dev/test/util/DebugUtilitiesData.java2
-rw-r--r--android_icu4j/src/main/tests/android/icu/extratest/android_icu_version.properties2
4 files changed, 37 insertions, 7 deletions
diff --git a/android_icu4j/src/main/tests/android/icu/dev/test/calendar/JapaneseTest.java b/android_icu4j/src/main/tests/android/icu/dev/test/calendar/JapaneseTest.java
index 7ada8bb41..77a24553d 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/calendar/JapaneseTest.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/calendar/JapaneseTest.java
@@ -157,9 +157,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();
@@ -168,7 +168,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);
@@ -176,7 +176,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);
@@ -200,7 +200,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 +")");
@@ -382,5 +382,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/android_icu4j/src/main/tests/android/icu/dev/test/format/NumberFormatTest.java b/android_icu4j/src/main/tests/android/icu/dev/test/format/NumberFormatTest.java
index 1162301a7..e8093d273 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/format/NumberFormatTest.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/format/NumberFormatTest.java
@@ -6328,6 +6328,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/android_icu4j/src/main/tests/android/icu/dev/test/util/DebugUtilitiesData.java b/android_icu4j/src/main/tests/android/icu/dev/test/util/DebugUtilitiesData.java
index 269051acf..084aecd5c 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/util/DebugUtilitiesData.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/util/DebugUtilitiesData.java
@@ -14,7 +14,7 @@ import android.icu.testsharding.MainTestShard;
@MainTestShard
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;
diff --git a/android_icu4j/src/main/tests/android/icu/extratest/android_icu_version.properties b/android_icu4j/src/main/tests/android/icu/extratest/android_icu_version.properties
index 049c16089..dc60326cf 100644
--- a/android_icu4j/src/main/tests/android/icu/extratest/android_icu_version.properties
+++ b/android_icu4j/src/main/tests/android/icu/extratest/android_icu_version.properties
@@ -1,2 +1,2 @@
# Property file for AndroidICUVersionTest.
-version=63.1.0.0
+version=63.2.0.0