use of android.icu.text.CollationElementIterator in project j2objc by google.
the class CollationThaiTest method TestInvalidThai.
@Test
public void TestInvalidThai() {
String[] tests = { "\u0E44\u0E01\u0E44\u0E01", "\u0E44\u0E01\u0E01\u0E44", "\u0E01\u0E44\u0E01\u0E44", "\u0E01\u0E01\u0E44\u0E44", "\u0E44\u0E44\u0E01\u0E01", "\u0E01\u0E44\u0E44\u0E01" };
RuleBasedCollator collator;
StrCmp comparator;
try {
collator = getThaiCollator();
comparator = new StrCmp();
} catch (Exception e) {
warnln("could not construct Thai collator");
return;
}
Arrays.sort(tests, comparator);
for (int i = 0; i < tests.length; i++) {
for (int j = i + 1; j < tests.length; j++) {
if (collator.compare(tests[i], tests[j]) > 0) {
// inconsistency ordering found!
errln("Inconsistent ordering between strings " + i + " and " + j);
}
}
CollationElementIterator iterator = collator.getCollationElementIterator(tests[i]);
CollationTest.backAndForth(this, iterator);
}
}
Aggregations