use of android.icu.text.RuleBasedCollator in project j2objc by google.
the class CollationRegressionTest method TestTrailingComment.
@Test
public void TestTrailingComment() throws Exception {
// ICU ticket #8070:
// Check that the rule parser handles a comment without terminating end-of-line.
RuleBasedCollator coll = new RuleBasedCollator("&c<b#comment1\n<a#comment2");
assertTrue("c<b", coll.compare("c", "b") < 0);
assertTrue("b<a", coll.compare("b", "a") < 0);
}
use of android.icu.text.RuleBasedCollator in project j2objc by google.
the class CollationRegressionTest method Test4051866.
// @bug 4051866
//
// Collator -> rules -> Collator round-trip broken for expanding characters
//
@Test
public void Test4051866() {
String rules = "&n < o & oe ,o\u3080& oe ,\u1530 ,O& OE ,O\u3080& OE ,\u1520< p ,P";
// Build a collator containing expanding characters
RuleBasedCollator c1 = null;
try {
c1 = new RuleBasedCollator(rules);
} catch (Exception e) {
errln("Fail to create RuleBasedCollator with rules:" + rules);
return;
}
// Build another using the rules from the first
RuleBasedCollator c2 = null;
try {
c2 = new RuleBasedCollator(c1.getRules());
} catch (Exception e) {
errln("Fail to create RuleBasedCollator with rules:" + rules);
return;
}
// Make sure they're the same
if (!(c1.getRules().equals(c2.getRules()))) {
errln("Rules are not equal");
}
}
use of android.icu.text.RuleBasedCollator in project j2objc by google.
the class CollationRegressionTest method Test4114076.
// @bug 4114076
//
// Collation not Unicode conformant with Hangul syllables
//
@Test
public void Test4114076() /* char* par */
{
RuleBasedCollator c = (RuleBasedCollator) Collator.getInstance(Locale.US);
c.setStrength(Collator.TERTIARY);
//
// With Canonical decomposition, Hangul syllables should get decomposed
// into Jamo, but Jamo characters should not be decomposed into
// conjoining Jamo
//
String[] test1 = { "\ud4db", "\u003d", "\u1111\u1171\u11b6" };
c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
compareArray(c, test1);
// From UTR #15:
// *In earlier versions of Unicode, jamo characters like ksf
// had compatibility mappings to kf + sf. These mappings were
// removed in Unicode 2.1.9 to ensure that Hangul syllables are maintained.)
// That is, the following test is obsolete as of 2.1.9
// obsolete- // With Full decomposition, it should go all the way down to
// obsolete- // conjoining Jamo characters.
// obsolete- //
// obsolete- static const UChar test2[][CollationRegressionTest::MAX_TOKEN_LEN] =
// obsolete- {
// obsolete- {0xd4db, 0}, {0x3d, 0}, {0x1111, 0x116e, 0x1175, 0x11af, 0x11c2, 0}
// obsolete- };
// obsolete-
// obsolete- c->setDecomposition(Normalizer::DECOMP_COMPAT);
// obsolete- compareArray(*c, test2, ARRAY_LENGTH(test2));
}
use of android.icu.text.RuleBasedCollator in project j2objc by google.
the class CollationRegressionTest method TestBengaliSortKey.
@Test
public void TestBengaliSortKey() throws Exception {
char[] rules = { 0x26, 0x9fa, 0x3c, 0x98c, 0x3c, 0x9e1, 0x3c, 0x98f, 0x3c, 0x990, 0x3c, 0x993, 0x3c, 0x994, 0x3c, 0x9bc, 0x3c, 0x982, 0x3c, 0x983, 0x3c, 0x981, 0x3c, 0x9b0, 0x3c, 0x9b8, 0x3c, 0x9b9, 0x3c, 0x9bd, 0x3c, 0x9be, 0x3c, 0x9bf, 0x3c, 0x9c8, 0x3c, 0x9cb, 0x3d, 0x9cb };
Collator col = new RuleBasedCollator(String.copyValueOf(rules));
String str1 = "\u09be";
String str2 = "\u0b70";
int result = col.compare(str1, str2);
System.out.flush();
if (result >= 0) {
errln("\nERROR: result is " + result + " , wanted negative.");
errln(printKey(col, str1).toString());
errln(printKey(col, str2).toString());
} else {
logln("Pass: result is OK.");
}
}
use of android.icu.text.RuleBasedCollator in project j2objc by google.
the class CollationRegressionTest method Test4054736.
// @bug 4054736
//
// Full Decomposition mode not implemented
//
@Test
public void Test4054736() /* char* par */
{
RuleBasedCollator c = (RuleBasedCollator) Collator.getInstance(Locale.US);
c.setStrength(Collator.SECONDARY);
c.setDecomposition(Collator.NO_DECOMPOSITION);
// Alef-Lamed vs. Alef, Lamed
final String[] tests = { "\uFB4F", "\u003d", "\u05D0\u05DC" };
compareArray(c, tests);
}
Aggregations