public void TestBreakAllChars() { // Make a "word" from each code point, separated by spaces. // For dictionary based breaking, runs the start-of-range // logic with all possible dictionary characters. StringBuilder sb = new StringBuilder(); for (int c = 0; c < 0x110000; ++c) { sb.AppendCodePoint(c); sb.AppendCodePoint(c); sb.AppendCodePoint(c); sb.AppendCodePoint(c); sb.Append(' '); } String s = sb.ToString(); for (int breakKind = BreakIterator.KIND_CHARACTER; breakKind <= BreakIterator.KIND_TITLE; ++breakKind) { RuleBasedBreakIterator bi = (RuleBasedBreakIterator)BreakIterator.GetBreakInstance(ULocale.ENGLISH, breakKind); bi.SetText(s); int lastb = -1; for (int b = bi.First(); b != BreakIterator.Done; b = bi.Next()) { assertTrue("(lastb < b) : (" + lastb + " < " + b + ")", lastb < b); } } }
public void TestT5615() { ULocale[] ulocales = BreakIterator.GetAvailableULocales(); int type = 0; ULocale loc = null; try { for (int i = 0; i < ulocales.Length; i++) { loc = ulocales[i]; for (type = 0; type < 5 /* 5 = BreakIterator.KIND_COUNT */; ++type) { BreakIterator brk = BreakIterator.GetBreakInstance(loc, type); if (brk == null) { Errln("ERR: Failed to create an instance type: " + type + " / locale: " + loc); } } } } catch (Exception e) { Errln("ERR: Failed to create an instance type: " + type + " / locale: " + loc + " / exception: " + e.ToString()); } }