ICU-2711 make all the intltest collation test classes use doTest defined in IntlTestCollator class.

X-SVN-Rev: 11042
This commit is contained in:
Vladimir Weinstein 2003-02-14 07:14:02 +00:00
parent 6b0ec25200
commit 98f8e51686
22 changed files with 29 additions and 275 deletions

View File

@ -91,58 +91,6 @@ const Collator::EComparisonResult CollationDummyTest::results[] = {
Collator::LESS
};
void
CollationDummyTest::doTestVariant(const UnicodeString source, const UnicodeString target, Collator::EComparisonResult result)
{
UErrorCode status = U_ZERO_ERROR;
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey srckey, tgtkey;
myCollation->getCollationKey(source, srckey, status);
myCollation->getCollationKey(target, tgtkey, status);
if (U_FAILURE(status)){
errln("Creation of collation keys failed\n");
}
Collator::EComparisonResult keyResult = srckey.compareTo(tgtkey);
if (compareResult != result) {
errln("String comparison failed in variant test\n");
}
if (keyResult != result) {
errln("Collation key comparison failed in variant test\n");
}
}
void CollationDummyTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
/*
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
SimpleFwdCharIterator src(source);
SimpleFwdCharIterator trg(target);
Collator::EComparisonResult incResult = myCollation->compare(src, trg);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, sortKey1, key1status );
myCollation->getCollationKey(target, sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status))
{
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, incResult, result );
*/
doTestVariant(source, target, result);
if(result == Collator::LESS) {
doTestVariant(target, source, Collator::GREATER);
} else if (result == Collator::GREATER) {
doTestVariant(target, source, Collator::LESS);
} else {
doTestVariant(target, source, Collator::EQUAL);
}
}
void CollationDummyTest::TestTertiary(/* char* par */)
{
@ -150,7 +98,7 @@ void CollationDummyTest::TestTertiary(/* char* par */)
myCollation->setStrength(Collator::TERTIARY);
for (i = 0; i < 17 ; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
void CollationDummyTest::TestPrimary(/* char* par */)
@ -168,7 +116,7 @@ void CollationDummyTest::TestPrimary(/* char* par */)
for (int i = 17; i < 26 ; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
@ -178,7 +126,7 @@ void CollationDummyTest::TestSecondary(/* char* par */)
myCollation->setStrength(Collator::SECONDARY);
for (i = 26; i < 34; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
@ -190,7 +138,7 @@ void CollationDummyTest::TestExtra(/* char* par */)
{
for (j = i + 1; j < COUNT_TEST_CASES; j += 1)
{
doTest(testCases[i], testCases[j], Collator::LESS);
doTest(myCollation, testCases[i], testCases[j], Collator::LESS);
}
}
}
@ -201,7 +149,7 @@ void CollationDummyTest::TestIdentical()
myCollation->setStrength(Collator::IDENTICAL);
for (i= 34; i<37; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}

View File

@ -30,10 +30,6 @@ public:
virtual ~CollationDummyTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */);
// main test method called with different strengths,
// tests comparison of custum collation with different strengths
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// perform test with strength PRIMARY
void TestPrimary(/* char* par */);
@ -54,8 +50,6 @@ private:
static const Collator::EComparisonResult results[];
RuleBasedCollator *myCollation;
void doTestVariant(const UnicodeString source, const UnicodeString target, Collator::EComparisonResult result);
};
#endif /* #if !UCONFIG_NO_COLLATION */

View File

@ -99,26 +99,6 @@ const Collator::EComparisonResult CollationGermanTest::results[][2] =
{ Collator::EQUAL, Collator::GREATER }
};
void CollationGermanTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
if(myCollation == NULL ) {
errln("decoll: cannot start test, collator is null\n");
return;
}
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status))
{
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void CollationGermanTest::TestTertiary(/* char* par */)
{
@ -133,7 +113,7 @@ void CollationGermanTest::TestTertiary(/* char* par */)
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
for (i = 0; i < 12 ; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i][1]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i][1]);
}
}
void CollationGermanTest::TestPrimary(/* char* par */)
@ -148,7 +128,7 @@ void CollationGermanTest::TestPrimary(/* char* par */)
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
for (i = 0; i < 12 ; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i][0]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i][0]);
}
}

View File

@ -28,9 +28,6 @@ public:
virtual ~CollationGermanTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
//main test routine, tests rules specific to germa locale
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// perform test with strength PRIMARY
void TestPrimary(/* char* par */);

View File

@ -240,30 +240,13 @@ static const UChar testMore[][CollationEnglishTest::MAX_TOKEN_LEN] = {
{(UChar)0x006F /* 'o' */, (UChar)0x0066 /* 'f' */, 0},
};
void CollationEnglishTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status))
{
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void CollationEnglishTest::TestTertiary(/* char* par */)
{
int32_t i = 0;
myCollation->setStrength(Collator::TERTIARY);
for (i = 0; i < 38 ; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
int32_t j = 0;
@ -271,7 +254,7 @@ void CollationEnglishTest::TestTertiary(/* char* par */)
{
for (j = i+1; j < 10; j++)
{
doTest(testBugs[i], testBugs[j], Collator::LESS);
doTest(myCollation, testBugs[i], testBugs[j], Collator::LESS);
}
}
@ -288,7 +271,7 @@ void CollationEnglishTest::TestTertiary(/* char* par */)
expected = Collator::EQUAL;
else // (i > j)
expected = Collator::GREATER;
doTest(testMore[i], testMore[j], expected );
doTest(myCollation, testMore[i], testMore[j], expected );
}
}
@ -300,7 +283,7 @@ void CollationEnglishTest::TestPrimary(/* char* par */)
myCollation->setStrength(Collator::PRIMARY);
for (i = 38; i < 43 ; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
@ -310,7 +293,7 @@ void CollationEnglishTest::TestSecondary(/* char* par */)
myCollation->setStrength(Collator::SECONDARY);
for (i = 43; i < 49 ; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
//test acute and grave ordering (compare to french collation)
@ -327,7 +310,7 @@ void CollationEnglishTest::TestSecondary(/* char* par */)
expected = Collator::EQUAL;
else // (i > j)
expected = Collator::GREATER;
doTest(testAcute[i], testAcute[j], expected );
doTest(myCollation, testAcute[i], testAcute[j], expected );
}
}
}

View File

@ -30,9 +30,6 @@ public:
virtual ~CollationEnglishTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
// main test routine, tests rules defined by the "en" locale
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// performs test with strength PRIMARY
void TestPrimary(/* char* par */);

View File

@ -80,27 +80,12 @@ const Collator::EComparisonResult CollationSpanishTest::results[] = {
Collator::EQUAL
};
void CollationSpanishTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status)) {
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void CollationSpanishTest::TestTertiary(/* char* par */)
{
int32_t i = 0;
myCollation->setStrength(Collator::TERTIARY);
for (i = 0; i < 5 ; i++) {
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
void CollationSpanishTest::TestPrimary(/* char* par */)
@ -108,7 +93,7 @@ void CollationSpanishTest::TestPrimary(/* char* par */)
int32_t i;
myCollation->setStrength(Collator::PRIMARY);
for (i = 5; i < 9; i++) {
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}

View File

@ -30,9 +30,6 @@ public:
virtual ~CollationSpanishTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
// amin test routine, tests rules specific to the spanish locale
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// performs tests with strength PRIMARY
void TestPrimary(/* char* par */);

View File

@ -67,27 +67,12 @@ const Collator::EComparisonResult CollationFinnishTest::results[] = {
Collator::EQUAL,
};
void CollationFinnishTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status)) {
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void CollationFinnishTest::TestTertiary(/* char* par */)
{
int32_t i = 0;
myCollation->setStrength(Collator::TERTIARY);
for (i = 0; i < 4 ; i++) {
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
void CollationFinnishTest::TestPrimary(/* char* par */)
@ -95,7 +80,7 @@ void CollationFinnishTest::TestPrimary(/* char* par */)
int32_t i;
myCollation->setStrength(Collator::PRIMARY);
for (i = 4; i < 5; i++) {
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}

View File

@ -29,9 +29,6 @@ public:
virtual ~CollationFinnishTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
// main test routine, tests rules specific to the finish locale
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// perform tests with strength PRIMARY
void TestPrimary(/* char* par */);

View File

@ -134,23 +134,6 @@ const UChar CollationFrenchTest::testBugs[][CollationFrenchTest::MAX_TOKEN_LEN]
{0x0078/*'x'*/, 0x000}
};
void CollationFrenchTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status))
{
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void CollationFrenchTest::TestTertiary(/* char* par */)
{
int32_t i = 0;
@ -165,7 +148,7 @@ void CollationFrenchTest::TestTertiary(/* char* par */)
{
for (i = 0; i < 12 ; i++)
{
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
}
@ -194,7 +177,7 @@ void CollationFrenchTest::TestSecondary(/* char* par */)
expected = Collator::EQUAL;
else // (i > j)
expected = Collator::GREATER;
doTest(testAcute[i], testAcute[j], expected );
doTest(myCollation, testAcute[i], testAcute[j], expected );
}
}
}
@ -208,7 +191,7 @@ void CollationFrenchTest::TestExtra(/* char* par */)
{
for (j = i + 1; j < 10; j += 1)
{
doTest(testBugs[i], testBugs[j], Collator::LESS);
doTest(myCollation, testBugs[i], testBugs[j], Collator::LESS);
}
}
}

View File

@ -28,9 +28,6 @@ public:
virtual ~CollationFrenchTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
// amin test routine, test rules specific to the french locale
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// perform tests with strength SECONDARY
void TestSecondary(/* char* par */);

View File

@ -76,21 +76,6 @@ const int32_t G7CollationTest::results[G7CollationTest::TESTLOCALES][G7Collation
};
void G7CollationTest::doTest( Collator* myCollation, UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status)) {
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void G7CollationTest::TestG7Locales(/* char* par */)
{
int32_t i;

View File

@ -52,8 +52,6 @@ public:
virtual ~G7CollationTest() {}
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
// main test routine, tests comparisons for a set of strings against sets of expected results
void doTest( Collator* col, UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// perform test for G7 locales
void TestG7Locales(/* char* par */);

View File

@ -101,21 +101,6 @@ const UChar CollationKanaTest::testChooonKigooCases[][CollationKanaTest::MAX_TOK
/*5*/ {0x30AD, 0x30A4, 0x30A2, 0x0000},
};
void CollationKanaTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status)) {
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void CollationKanaTest::TestTertiary(/* char* par */)
{
int32_t i = 0;
@ -126,7 +111,7 @@ void CollationKanaTest::TestTertiary(/* char* par */)
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
for (i = 0; i < 6; i++) {
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
@ -136,7 +121,7 @@ void CollationKanaTest::TestBase()
int32_t i;
myCollation->setStrength(Collator::PRIMARY);
for (i = 0; i < 3 ; i++)
doTest(testBaseCases[i], testBaseCases[i + 1], Collator::LESS);
doTest(myCollation, testBaseCases[i], testBaseCases[i + 1], Collator::LESS);
}
/* Testing plain, Daku-ten, Handaku-ten letters */
@ -145,7 +130,7 @@ void CollationKanaTest::TestPlainDakutenHandakuten(void)
int32_t i;
myCollation->setStrength(Collator::SECONDARY);
for (i = 0; i < 3 ; i++)
doTest(testPlainDakutenHandakutenCases[i], testPlainDakutenHandakutenCases[i + 1],
doTest(myCollation, testPlainDakutenHandakutenCases[i], testPlainDakutenHandakutenCases[i + 1],
Collator::LESS);
}
@ -159,7 +144,7 @@ void CollationKanaTest::TestSmallLarge(void)
myCollation->setStrength(Collator::TERTIARY);
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
for (i = 0; i < 3 ; i++)
doTest(testSmallLargeCases[i], testSmallLargeCases[i + 1], Collator::LESS);
doTest(myCollation, testSmallLargeCases[i], testSmallLargeCases[i + 1], Collator::LESS);
}
/*
@ -172,7 +157,7 @@ void CollationKanaTest::TestKatakanaHiragana(void)
myCollation->setStrength(Collator::QUATERNARY);
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
for (i = 0; i < 3 ; i++) {
doTest(testKatakanaHiraganaCases[i], testKatakanaHiraganaCases[i + 1],
doTest(myCollation, testKatakanaHiraganaCases[i], testKatakanaHiraganaCases[i + 1],
Collator::LESS);
}
}
@ -187,7 +172,7 @@ void CollationKanaTest::TestChooonKigoo(void)
myCollation->setStrength(Collator::QUATERNARY);
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
for (i = 0; i < 7 ; i++) {
doTest(testChooonKigooCases[i], testChooonKigooCases[i + 1], Collator::LESS);
doTest(myCollation, testChooonKigooCases[i], testChooonKigooCases[i + 1], Collator::LESS);
}
}

View File

@ -29,9 +29,6 @@ public:
virtual ~CollationKanaTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
// main test routine, tests rules specific to "Kana" locale
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// performs test with strength TERIARY
void TestTertiary(/* char* par */);

View File

@ -54,28 +54,13 @@ const Collator::EComparisonResult LotusCollationKoreanTest::results[] = {
Collator::LESS
};
void LotusCollationKoreanTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status)) {
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void LotusCollationKoreanTest::TestTertiary(/* char* par */)
{
int32_t i = 0;
myCollation->setStrength(Collator::TERTIARY);
for (i = 0; i < 1; i++) {
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}

View File

@ -24,9 +24,6 @@ public:
virtual ~LotusCollationKoreanTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
// main test routine, tests rules specific to "Kana" locale
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// performs test with strength TERIARY
void TestTertiary(/* char* par */);

View File

@ -249,22 +249,6 @@ void CollationMonkeyTest::TestRules(/* char* par */){
delete col;
}
void CollationMonkeyTest::doTest(RuleBasedCollator *myCollation, UnicodeString mysource, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status))
{
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( mysource, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void CollationMonkeyTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{

View File

@ -44,8 +44,6 @@ public:
private:
void report(UnicodeString& s, UnicodeString& t, int32_t result, int32_t revResult);
void doTest(RuleBasedCollator *myCollation, UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
const UnicodeString source;
Collator *myCollator;

View File

@ -85,27 +85,12 @@ const Collator::EComparisonResult CollationTurkishTest::results[] = {
Collator::GREATER
};
void CollationTurkishTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
if (U_FAILURE(key1status) || U_FAILURE(key2status)) {
errln("SortKey generation Failed.\n");
return;
}
Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, compareResult, result );
}
void CollationTurkishTest::TestTertiary(/* char* par */)
{
int32_t i = 0;
myCollation->setStrength(Collator::TERTIARY);
for (i = 0; i < 8 ; i++) {
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}
void CollationTurkishTest::TestPrimary(/* char* par */)
@ -113,7 +98,7 @@ void CollationTurkishTest::TestPrimary(/* char* par */)
int32_t i;
myCollation->setStrength(Collator::PRIMARY);
for (i = 8; i < 11; i++) {
doTest(testSourceCases[i], testTargetCases[i], results[i]);
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
}
}

View File

@ -29,9 +29,6 @@ public:
virtual ~CollationTurkishTest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
// main test routine, tests rules specific to turkish locale
void doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
// perform tests for turkish locale with strength PRIMARY
void TestPrimary(/* char* par */);