summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android_icu4j/src/main/tests/android/icu/dev/test/translit/UnicodeMapTest.java30
-rw-r--r--icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java30
2 files changed, 34 insertions, 26 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 ba55ee909..89e9d9535 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,28 +346,33 @@ 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");
- // 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) {
+ 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;;) {
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);
@@ -390,7 +395,6 @@ public class UnicodeMapTest extends TestFmwk {
}
}
}
- // Android patch end. b/79168307 Reduce the heap memory needed for the test
@Test
public void TestAUnicodeMap2() {
diff --git a/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java b/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java
index 34346d1fd..00383048d 100644
--- a/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java
+++ b/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java
@@ -343,28 +343,33 @@ 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");
- // 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) {
+ 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;;) {
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);
@@ -387,7 +392,6 @@ public class UnicodeMapTest extends TestFmwk {
}
}
}
- // Android patch end. b/79168307 Reduce the heap memory needed for the test
@Test
public void TestAUnicodeMap2() {