summaryrefslogtreecommitdiffstats
path: root/luni/src
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-05-05 18:47:45 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-05 18:47:45 +0000
commite6d696416a50b60d97a9fccff6adb806396e69fa (patch)
treec74267c9a5a27e2ef8a6db1aca3a74d7ccb4a656 /luni/src
parent82ae08aec4c150b8cb2d909b2067e080556774c5 (diff)
parent87b72cd75fad2dfed1134a26b41d54e64cc48d49 (diff)
downloadlibcore-e6d696416a50b60d97a9fccff6adb806396e69fa.zip
libcore-e6d696416a50b60d97a9fccff6adb806396e69fa.tar.gz
libcore-e6d696416a50b60d97a9fccff6adb806396e69fa.tar.bz2
am 87b72cd7: Merge "Relax the chen/shen test."
* commit '87b72cd75fad2dfed1134a26b41d54e64cc48d49': Relax the chen/shen test.
Diffstat (limited to 'luni/src')
-rw-r--r--luni/src/test/java/libcore/icu/AlphabeticIndexTest.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/luni/src/test/java/libcore/icu/AlphabeticIndexTest.java b/luni/src/test/java/libcore/icu/AlphabeticIndexTest.java
index 8b8c729..6c7452d 100644
--- a/luni/src/test/java/libcore/icu/AlphabeticIndexTest.java
+++ b/luni/src/test/java/libcore/icu/AlphabeticIndexTest.java
@@ -20,8 +20,7 @@ import java.util.Locale;
public class AlphabeticIndexTest extends junit.framework.TestCase {
private static AlphabeticIndex.ImmutableIndex createIndex(Locale locale) {
- return new AlphabeticIndex(locale).addLabels(Locale.US)
- .getImmutableIndex();
+ return new AlphabeticIndex(locale).addLabels(Locale.US).getImmutableIndex();
}
private static void assertHasLabel(AlphabeticIndex.ImmutableIndex ii, String string, String expectedLabel) {
@@ -111,8 +110,8 @@ public class AlphabeticIndexTest extends junit.framework.TestCase {
// German: [A-Z] (no ß or umlauted characters in standard alphabet)
AlphabeticIndex.ImmutableIndex de = createIndex(Locale.GERMAN);
assertHasLabel(de, "ßind", "S");
+ // We no longer split out "S", "Sch", and "St".
assertHasLabel(de, "Sacher", "S");
- // "Sch" and "St" are also options for lists by last name.
assertHasLabel(de, "Schiller", "S");
assertHasLabel(de, "Steiff", "S");
}
@@ -141,14 +140,19 @@ public class AlphabeticIndexTest extends junit.framework.TestCase {
public void test_zh_CN() throws Exception {
// Simplified Chinese (default collator Pinyin): [A-Z]
- // Shen/Chen (simplified): should be, usually, 'S' for name collator and 'C' for apps/other
AlphabeticIndex.ImmutableIndex zh_CN = createIndex(new Locale("zh", "CN"));
// Jia/Gu: should be, usually, 'J' for name collator and 'G' for apps/other
assertHasLabel(zh_CN, "\u8d3e", "J");
- // Shen/Chen
- assertHasLabel(zh_CN, "\u6c88", "C"); // icu4c 50 does not specialize for names.
+ // Shen/Chen (simplified): should usually be 'S' for names and 'C' for apps/other.
+ // icu4c does not specialize for names and defaults to 'C'.
+ // Some OEMs prefer to default to 'S'.
+ // We allow either to pass CTS since neither choice is right all the time.
+ // assertHasLabel(zh_CN, "\u6c88", "C");
+ String shenChenLabel = zh_CN.getBucketLabel(zh_CN.getBucketIndex("\u6c88"));
+ assertTrue(shenChenLabel.equals("C") || shenChenLabel.equals("S"));
+
// Shen/Chen (traditional)
assertHasLabel(zh_CN, "\u700b", "S");
}