ICU-865 This test is too slow.

X-SVN-Rev: 4051
This commit is contained in:
George Rhoten 2001-03-13 22:54:54 +00:00
parent 8b48bed373
commit 6ab34e4b7e

View File

@ -662,21 +662,23 @@ void IntlTestTextBoundary::TestLineInvariants()
doBreakInvariantTest(*e, testChars);
doOtherInvariantTest(*e, testChars);
int errCount = 0;
int32_t errCount = 0, testCharsLen, noBreakLen, dashesLen;
UTextOffset i, j, k;
// in addition to the other invariants, a line-break iterator should make sure that:
// it doesn't break around the non-breaking characters
UnicodeString noBreak = CharsToUnicodeString("\\u00a0\\u2007\\u2011\\ufeff");
UnicodeString work("aaa");
for (i = 0; i < testChars.length(); i++) {
testCharsLen = testChars.length();
noBreakLen = noBreak.length();
for (i = 0; i < testCharsLen; i++) {
UChar c = testChars[i];
if (c == '\r' || c == '\n' || c == 0x2029 || c == 0x2028 || c == 0x0003)
continue;
work[0] = c;
for (j = 0; j < noBreak.length(); j++) {
for (j = 0; j < noBreakLen; j++) {
work[1] = noBreak[j];
for (k = 0; k < testChars.length(); k++) {
for (k = 0; k < testCharsLen; k++) {
work[2] = testChars[k];
e->setText(work);
for (int l = e->first(); l != BreakIterator::DONE; l = e->next())
@ -694,31 +696,38 @@ void IntlTestTextBoundary::TestLineInvariants()
// it does break after hyphens (unless they're followed by a digit, a non-spacing mark,
// a currency symbol, a non-breaking space, or a line or paragraph separator)
UnicodeString dashes = CharsToUnicodeString("-\\u00ad\\u2010\\u2012\\u2013\\u2014");
for (i = 0; i < testChars.length(); i++) {
dashesLen = dashes.length();
for (i = 0; i < testCharsLen; i++) {
work[0] = testChars[i];
for (j = 0; j < dashes.length(); j++) {
for (j = 0; j < dashesLen; j++) {
work[1] = dashes[j];
for (k = 0; k < testChars.length(); k++) {
for (k = 0; k < testCharsLen; k++) {
UChar c = testChars[k];
if (Unicode::getType(c) == Unicode::DECIMAL_DIGIT_NUMBER ||
Unicode::getType(c) == Unicode::OTHER_NUMBER ||
Unicode::getType(c) == Unicode::NON_SPACING_MARK ||
Unicode::getType(c) == Unicode::ENCLOSING_MARK ||
Unicode::getType(c) == Unicode::CURRENCY_SYMBOL ||
Unicode::getType(c) == Unicode::SPACE_SEPARATOR ||
Unicode::getType(c) == Unicode::DASH_PUNCTUATION ||
Unicode::getType(c) == Unicode::CONTROL ||
Unicode::getType(c) == Unicode::FORMAT ||
int8_t type = Unicode::getType(c);
if (type == Unicode::DECIMAL_DIGIT_NUMBER ||
type == Unicode::OTHER_NUMBER ||
type == Unicode::NON_SPACING_MARK ||
type == Unicode::ENCLOSING_MARK ||
type == Unicode::CURRENCY_SYMBOL ||
type == Unicode::SPACE_SEPARATOR ||
type == Unicode::DASH_PUNCTUATION ||
type == Unicode::CONTROL ||
type == Unicode::FORMAT ||
c == '\n' || c == '\r' || c == 0x2028 || c == 0x2029 ||
c == 0x0003 || c == 0x00a0 || c == 0x2007 || c == 0x2011 ||
c == 0xfeff)
{
continue;
}
work[2] = c;
e->setText(work);
UBool saw2 = FALSE;
for (int l = e->first(); l != BreakIterator::DONE; l = e->next())
if (l == 2)
for (int l = e->first(); l != BreakIterator::DONE; l = e->next()) {
if (l == 2) {
saw2 = TRUE;
break;
}
}
if (!saw2) {
errln("Didn't get break between U+" + UCharToUnicodeString(work[1]) +
" and U+" + UCharToUnicodeString(work[2]));
@ -747,8 +756,8 @@ void IntlTestTextBoundary::TestThaiLineBreak() {
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e40\\u0e08\\u0e49\\u0e32"));
// thaiLineSelection->addElement(CharsToUnicodeString("\\u0e2b\\u0e19\\u0e49\\u0e32"));
// thaiLineSelection->addElement(CharsToUnicodeString("\\u0e17\\u0e35\\u0e48"));
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e2b\\u0e19\\u0e49\\u0e32\\u0e17\\u0e35\\u0e48"));
// the commented-out lines (I think) are the preferred result; this line is what our current dictionary is giving us
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e2b\\u0e19\\u0e49\\u0e32\\u0e17\\u0e35\\u0e48"));
// the commented-out lines (I think) are the preferred result; this line is what our current dictionary is giving us
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e2d\\u0e2d\\u0e01"));
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e21\\u0e32"));
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e40\\u0e23\\u0e48\\u0e07"));
@ -774,7 +783,7 @@ thaiLineSelection->addElement(CharsToUnicodeString("\\u0e2b\\u0e19\\u0e49\\u0e32
generalIteratorTest(*e, thaiLineSelection);
delete e;
delete thaiLineSelection;
}
}
void IntlTestTextBoundary::TestMixedThaiLineBreak()
{
@ -830,8 +839,7 @@ thaiLineSelection->addElement(CharsToUnicodeString("(\\u0e1b\\u0e23\\u0e30\\u0e4
thaiLineSelection->addElement(CharsToUnicodeString("\\u0e19\\u0e31\\u0e49\\u0e19 "));
thaiLineSelection->addElement(CharsToUnicodeString("(\"\\u0e2e\\u0e32\\u0e23\\u0e4c\\u0e14\\u0e14\\u0e34\\u0e2a\\u0e01\\u0e4c\")."));
BreakIterator* e = BreakIterator::createLineInstance(
Locale("th"), status);
BreakIterator* e = BreakIterator::createLineInstance(Locale("th"), status);
if (U_FAILURE(status))
{
errln("Failed to create the BreakIterator for default locale in TestMixedThaiLineBreak.\n");
@ -1080,14 +1088,12 @@ void IntlTestTextBoundary::runIndexedTest( int32_t index, UBool exec, const char
case 12: name = "TestBug4153072"; if (exec) TestBug4153072(); break;
case 13: name = "TestEndBehaviour"; if (exec) TestEndBehaviour(); break;
case 14: name = "TestJapaneseLineBreak"; if (exec) TestJapaneseLineBreak(); break;
case 15: name = "TestThaiLineBreak"; if(exec) TestThaiLineBreak(); break;
case 16: name = "TestMixedThaiLineBreak"; if(exec) TestMixedThaiLineBreak(); break;
case 17: name = "TestMaiyamok"; if(exec) TestMaiyamok(); break;
default: name = ""; break; //needed to end loop
}
}
@ -1260,7 +1266,8 @@ void IntlTestTextBoundary::testFollowing(BreakIterator& bi, UnicodeString& text,
{
logln("testFollowing():");
int p = 2;
for (int i = 0; i <= text.length(); i++) {
int32_t textLen = text.length();
for (int i = 0; i <= textLen; i++) {
if (i == boundaries[p])
++p;
@ -1275,7 +1282,8 @@ void IntlTestTextBoundary::testFollowing(BreakIterator& bi, UnicodeString& text,
void IntlTestTextBoundary::testPreceding(BreakIterator& bi, UnicodeString& text, int32_t *boundaries) {
logln("testPreceding():");
int p = 0;
for (int i = 0; i <= text.length(); i++) {
int32_t textLen = text.length();
for (int i = 0; i <= textLen; i++) {
int32_t b = bi.preceding(i);
logln((UnicodeString)"bi.preceding(" + i + ") -> " + b);
if (b != boundaries[p])
@ -1291,7 +1299,8 @@ void IntlTestTextBoundary::testIsBoundary(BreakIterator& bi, UnicodeString& text
logln("testIsBoundary():");
int p = 1;
UBool isB;
for (int i = 0; i < text.length(); i++) {
int32_t textLen = text.length();
for (int i = 0; i < textLen; i++) {
isB = bi.isBoundary(i);
logln((UnicodeString)"bi.isBoundary(" + i + ") -> " + isB);
@ -1358,17 +1367,18 @@ void IntlTestTextBoundary::doMultipleSelectionTest(BreakIterator& iterator,
void IntlTestTextBoundary::doBreakInvariantTest(BreakIterator& tb, UnicodeString& testChars)
{
UnicodeString work("aaa");
int errCount = 0;
int32_t errCount = 0, testCharsLen = testChars.length(), breaksLen;
// a break should always occur after CR (unless followed by LF), LF, PS, and LS
UnicodeString breaks = CharsToUnicodeString("\r\n\\u2029\\u2028");
UTextOffset i, j;
for (i = 0; i < breaks.length(); i++) {
breaksLen = breaks.length();
for (i = 0; i < breaksLen; i++) {
work[1] = breaks[i];
for (j = 0; j < testChars.length(); j++) {
for (j = 0; j < testCharsLen; j++) {
work[0] = testChars[j];
for (int k = 0; k < testChars.length(); k++) {
for (int k = 0; k < testCharsLen; k++) {
UChar c = testChars[k];
// if a cr is followed by lf, ps, ls or etx, don't do the check (that's
@ -1377,12 +1387,14 @@ void IntlTestTextBoundary::doBreakInvariantTest(BreakIterator& tb, UnicodeString
|| c == 0x2028 || c == 0x0003))
continue;
work[2] = testChars[k];
work[2] = c;
tb.setText(work);
UBool seen2 = FALSE;
for (int l = tb.first(); l != BreakIterator::DONE; l = tb.next()) {
if (l == 2)
if (l == 2) {
seen2 = TRUE;
break;
}
}
if (!seen2) {
errln("No break between U+" + UCharToUnicodeString(work[1])
@ -1399,13 +1411,14 @@ void IntlTestTextBoundary::doBreakInvariantTest(BreakIterator& tb, UnicodeString
void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString& testChars)
{
UnicodeString work("a\r\na");
int32_t errCount = 0;
int32_t errCount = 0, testCharsLen = testChars.length();
UTextOffset i, j;
int8_t type;
// a break should never occur between CR and LF
for (i = 0; i < testChars.length(); i++) {
for (i = 0; i < testCharsLen; i++) {
work[0] = testChars[i];
for (j = 0; j < testChars.length(); j++) {
for (j = 0; j < testCharsLen; j++) {
work[3] = testChars[j];
tb.setText(work);
for (int32_t k = tb.first(); k != BreakIterator::DONE; k = tb.next())
@ -1423,15 +1436,16 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString
// character is CR, LF, PS, or LS
work.remove();
work += "aaaa";
for (i = 0; i < testChars.length(); i++) {
for (i = 0; i < testCharsLen; i++) {
UChar c = testChars[i];
if (c == '\n' || c == '\r' || c == 0x2029 || c == 0x2028 || c == 0x0003)
continue;
work[1] = c;
for (j = 0; j < testChars.length(); j++) {
for (j = 0; j < testCharsLen; j++) {
c = testChars[j];
if ((Unicode::getType(c) != Unicode::NON_SPACING_MARK) &&
(Unicode::getType(c) != Unicode::ENCLOSING_MARK))
type = Unicode::getType(c);
if ((type != Unicode::NON_SPACING_MARK) &&
(type != Unicode::ENCLOSING_MARK))
continue;
work[2] = c;
tb.setText(work);