diff options
Diffstat (limited to 'android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java')
-rw-r--r-- | android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java b/android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java index 89e9d9535..ba55ee909 100644 --- a/android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java +++ b/android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java @@ -346,33 +346,28 @@ public class UnicodeMapTest extends TestFmwk { checkNext(map1, map2, LIMIT); } + private static final int SET_LIMIT = 0x10FFFF; private static final int propEnum = UProperty.GENERAL_CATEGORY; @Test public void TestUnicodeMapGeneralCategory() { logln("Setting General Category"); - UnicodeMap<String> map1 = new UnicodeMap(); - Map<Integer, String> map2 = new HashMap<Integer, String>(); - //Map<Integer, String> map3 = new TreeMap<Integer, String>(); - map1 = new UnicodeMap<String>(); - map2 = new TreeMap<Integer,String>(); - for (int cp = 0;;) { + // Android patch begin. b/79168307 Reduce the heap memory needed for the test + splitTestUnicodeMapGeneralCategory(0, SET_LIMIT / 2); + splitTestUnicodeMapGeneralCategory(SET_LIMIT / 2 + 1, SET_LIMIT); + // Android patch end. b/79168307 Reduce the heap memory needed for the test + } + + // Android patch begin. b/79168307 Reduce the heap memory needed for the test + private void splitTestUnicodeMapGeneralCategory(int startCodePoint, int endCodePoint) { + UnicodeMap<String> map1 = new UnicodeMap<String>(); + Map<Integer, String> map2 = new TreeMap<Integer,String>(); + for (int cp = startCodePoint; cp <= endCodePoint; ++cp) { int enumValue = UCharacter.getIntPropertyValue(cp, propEnum); //if (enumValue <= 0) continue; // for smaller set String value = UCharacter.getPropertyValueName(propEnum,enumValue, UProperty.NameChoice.LONG); map1.put(cp, value); map2.put(cp, value); - cp++; - // Unicode is huge, skip over large parts of it. - if (cp == 0x08FF) { // General Scripts Area. - cp = 0xD700; // Hangul Syllables Area. - } else if (cp == 0x100FF) { // General Scripts Area. - cp = 0x1F000; // Symbols Area. - } else if (cp == 0x200FF) { // CJK Unified Ideographs Extensions. - cp = 0x10FF00; // Supplementary Private Use Area-B. - } else if (cp == 0x10FFFF) { // The end of Unicode. - break; - } } checkNext(map1, map2, Integer.MAX_VALUE); @@ -395,6 +390,7 @@ public class UnicodeMapTest extends TestFmwk { } } } + // Android patch end. b/79168307 Reduce the heap memory needed for the test @Test public void TestAUnicodeMap2() { |