mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 04:29:31 +00:00
ICU-843
New test cases added X-SVN-Rev: 3974
This commit is contained in:
parent
bfe6561358
commit
5ce6b2d362
2 changed files with 192 additions and 4 deletions
|
@ -10,6 +10,9 @@
|
|||
* Modification History:
|
||||
* Name Description
|
||||
* Madhu Katragadda Ported for C API
|
||||
* synwee Added TestBase, TestPlainDakutenHandakuten,
|
||||
* TestSmallLarge, TestKatakanaHiragana,
|
||||
* TestChooonKigoo
|
||||
*********************************************************************************/
|
||||
/**
|
||||
* CollationKannaTest is a third level test class. This tests the locale
|
||||
|
@ -72,12 +75,54 @@ const static UCollationResult results[] = {
|
|||
UCOL_LESS /* 11 */
|
||||
};
|
||||
|
||||
const static UChar testBaseCases[][MAX_TOKEN_LEN] = {
|
||||
{0x30AB, 0x0000},
|
||||
{0x30AB, 0x30AD, 0x0000},
|
||||
{0x30AD, 0x0000},
|
||||
{0x30AD, 0x30AD, 0x0000}
|
||||
};
|
||||
|
||||
const static UChar testPlainDakutenHandakutenCases[][MAX_TOKEN_LEN] = {
|
||||
{0x30CF, 0x30AB, 0x0000},
|
||||
{0x30D0, 0x30CF, 0x0000},
|
||||
{0x30CF, 0x30AD, 0x0000},
|
||||
{0x30D0, 0x30AD, 0x0000}
|
||||
};
|
||||
|
||||
const static UChar testSmallLargeCases[][MAX_TOKEN_LEN] = {
|
||||
{0x30C3, 0x30CF, 0x0000},
|
||||
{0x30C4, 0x30CF, 0x0000},
|
||||
{0x30C3, 0x30D0, 0x0000},
|
||||
{0x30C4, 0x30D0, 0x0000}
|
||||
};
|
||||
|
||||
const static UChar testKatakanaHiraganaCases[][MAX_TOKEN_LEN] = {
|
||||
{0x30A2, 0x30C3, 0x0000},
|
||||
{0x3042, 0x30C3, 0x0000},
|
||||
{0x30A2, 0x30C4, 0x0000},
|
||||
{0x3042, 0x30C4, 0x0000}
|
||||
};
|
||||
|
||||
const static UChar testChooonKigooCases[][MAX_TOKEN_LEN] = {
|
||||
{0x30AB, 0x30FC, 0x30A2, 0x0000},
|
||||
{0x30AB, 0x30FC, 0x3042, 0x0000},
|
||||
{0x30AB, 0x30A4, 0x30A2, 0x0000},
|
||||
{0x30AB, 0x30A4, 0x3042, 0x0000},
|
||||
{0x30AD, 0x30A4, 0x30A2, 0x0000},
|
||||
{0x30AD, 0x30A4, 0x3042, 0x0000},
|
||||
{0x30AD, 0x30FC, 0x30A2, 0x0000},
|
||||
{0x30AD, 0x30FC, 0x3042, 0x0000}
|
||||
};
|
||||
|
||||
void addKannaCollTest(TestNode** root)
|
||||
{
|
||||
|
||||
addTest(root, &TestTertiary, "tscoll/cjacoll/TestTertiary");
|
||||
|
||||
addTest(root, &TestTertiary, "tscoll/cjacoll/TestTertiary");
|
||||
addTest(root, &TestBase, "tscoll/cjacoll/TestBase");
|
||||
addTest(root, &TestPlainDakutenHandakuten,
|
||||
"tscoll/cjacoll/TestPlainDakutenHandakuten");
|
||||
addTest(root, &TestSmallLarge, "tscoll/cjacoll/TestSmallLarge");
|
||||
addTest(root, &TestKatakanaHiragana, "tscoll/cjacoll/TestKatakanaHiragana");
|
||||
addTest(root, &TestChooonKigoo, "tscoll/cjacoll/TestChooonKigoo");
|
||||
}
|
||||
|
||||
static void TestTertiary( )
|
||||
|
@ -93,6 +138,7 @@ static void TestTertiary( )
|
|||
log_verbose("Testing Kanna(Japan) Collation with Tertiary strength\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DECOMP_COMPAT);
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, UCOL_ON, &status);
|
||||
for (i = 0; i < 11 ; i++)
|
||||
{
|
||||
doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
|
||||
|
@ -100,4 +146,125 @@ static void TestTertiary( )
|
|||
ucol_close(myCollation);
|
||||
}
|
||||
|
||||
/* Testing base letters */
|
||||
static void TestBase()
|
||||
{
|
||||
int32_t i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("ja_JP", &status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
log_err("ERROR: in creation of rule based collator: %s\n",
|
||||
myErrorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
log_verbose("Testing Japanese Base Characters Collation\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DECOMP_COMPAT);
|
||||
ucol_setStrength(myCollation, UCOL_PRIMARY);
|
||||
for (i = 0; i < 3 ; i++)
|
||||
doTest(myCollation, testBaseCases[i], testBaseCases[i + 1], UCOL_LESS);
|
||||
|
||||
ucol_close(myCollation);
|
||||
}
|
||||
|
||||
/* Testing plain, Daku-ten, Handaku-ten letters */
|
||||
static void TestPlainDakutenHandakuten(void)
|
||||
{
|
||||
int32_t i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("ja_JP", &status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
log_err("ERROR: in creation of rule based collator: %s\n",
|
||||
myErrorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
log_verbose("Testing plain, Daku-ten, Handaku-ten letters Japanese Characters Collation\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DECOMP_COMPAT);
|
||||
ucol_setStrength(myCollation, UCOL_SECONDARY);
|
||||
ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, UCOL_ON, &status);
|
||||
for (i = 0; i < 3 ; i++)
|
||||
doTest(myCollation, testPlainDakutenHandakutenCases[i],
|
||||
testPlainDakutenHandakutenCases[i + 1], UCOL_LESS);
|
||||
|
||||
ucol_close(myCollation);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test Small, Large letters
|
||||
*/
|
||||
static void TestSmallLarge(void)
|
||||
{
|
||||
int32_t i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("ja_JP", &status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
log_err("ERROR: in creation of rule based collator: %s\n",
|
||||
myErrorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
log_verbose("Testing Japanese Small and Large Characters Collation\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DECOMP_COMPAT);
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, UCOL_ON, &status);
|
||||
for (i = 0; i < 3 ; i++)
|
||||
doTest(myCollation, testSmallLargeCases[i], testSmallLargeCases[i + 1],
|
||||
UCOL_LESS);
|
||||
|
||||
ucol_close(myCollation);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test Katakana, Hiragana letters
|
||||
*/
|
||||
static void TestKatakanaHiragana(void)
|
||||
{
|
||||
int32_t i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("ja_JP", &status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
log_err("ERROR: in creation of rule based collator: %s\n",
|
||||
myErrorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
log_verbose("Testing Japanese Katakana, Hiragana Characters Collation\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DECOMP_COMPAT);
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, UCOL_ON, &status);
|
||||
for (i = 0; i < 3 ; i++)
|
||||
doTest(myCollation, testKatakanaHiraganaCases[i],
|
||||
testKatakanaHiraganaCases[i + 1], UCOL_LESS);
|
||||
|
||||
ucol_close(myCollation);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test Choo-on kigoo
|
||||
*/
|
||||
static void TestChooonKigoo(void)
|
||||
{
|
||||
int32_t i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("ja_JP", &status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
log_err("ERROR: in creation of rule based collator: %s\n",
|
||||
myErrorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
log_verbose("Testing Japanese Choo-on Kigoo Characters Collation\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DECOMP_COMPAT);
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
ucol_setAttribute(myCollation, UCOL_CASE_LEVEL, UCOL_ON, &status);
|
||||
for (i = 0; i < 6 ; i++)
|
||||
doTest(myCollation, testBaseCases[i], testBaseCases[i + 1], UCOL_LESS);
|
||||
|
||||
ucol_close(myCollation);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
* Modification History:
|
||||
* Name Description
|
||||
* Madhu Katragadda Converted to C
|
||||
* synwee Added TestBase, TestPlainDakutenHandakuten,
|
||||
* TestSmallLarge, TestKatakanaHiragana,
|
||||
* TestChooonKigoo
|
||||
*********************************************************************************/
|
||||
/**
|
||||
* CollationKannaTest(JAPAN) is a third level test class. This tests the locale
|
||||
|
@ -31,7 +34,25 @@
|
|||
/*perform test with strength TERTIARY*/
|
||||
static void TestTertiary(void);
|
||||
|
||||
/* Testing base letters */
|
||||
static void TestBase(void);
|
||||
|
||||
|
||||
/* Testing plain, Daku-ten, Handaku-ten letters */
|
||||
static void TestPlainDakutenHandakuten(void);
|
||||
|
||||
/*
|
||||
* Test Small, Large letters
|
||||
*/
|
||||
static void TestSmallLarge(void);
|
||||
|
||||
/*
|
||||
* Test Katakana, Hiragana letters
|
||||
*/
|
||||
static void TestKatakanaHiragana(void);
|
||||
|
||||
/*
|
||||
* Test Choo-on kigoo
|
||||
*/
|
||||
static void TestChooonKigoo(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue