mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-856 don't crash when collation is unhappy
X-SVN-Rev: 3670
This commit is contained in:
parent
00cd7c0b17
commit
bff766b1f5
7 changed files with 28 additions and 4 deletions
|
@ -229,6 +229,7 @@ static void TestTertiary( )
|
|||
myCollation = ucol_open("da_DK", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
for (i = 0; i < 5 ; i++)
|
||||
|
@ -257,7 +258,8 @@ static void TestPrimary()
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("da_DK", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
|
||||
return;
|
||||
}
|
||||
ucol_setStrength(myCollation, UCOL_PRIMARY);
|
||||
for (i = 5; i < 8 ; i++)
|
||||
|
|
|
@ -132,6 +132,7 @@ static void TestTertiary( )
|
|||
myCollation = ucol_open("de_DE", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing German Collation with Tertiary strength\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DECOMP_CAN_COMP_COMPAT);
|
||||
|
@ -150,7 +151,8 @@ static void TestPrimary()
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("de_DE", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing German Collation with primary strength\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DEFAULT_NORMALIZATION);
|
||||
|
|
|
@ -115,7 +115,8 @@ static void TestTertiary( )
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("es_ES", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing Spanish Collation with Tertiary strength\n");
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
|
@ -133,7 +134,8 @@ static void TestPrimary()
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("es_ES", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing Spanish Collation with Primary strength\n");
|
||||
ucol_setStrength(myCollation, UCOL_PRIMARY);
|
||||
|
|
|
@ -177,10 +177,16 @@ static void TestTertiary( )
|
|||
int32_t i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("fr_FR", &status);
|
||||
if(U_FAILURE(status) || !myCollation){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
ucol_setAttribute(myCollation, UCOL_FRENCH_COLLATION, UCOL_ON, &status);
|
||||
ucol_setAttribute(myCollation, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing French Collation with Tertiary strength\n");
|
||||
ucol_setStrength(myCollation, UCOL_QUATERNARY);
|
||||
|
@ -198,9 +204,14 @@ static void TestSecondary()
|
|||
UCollationResult expected=UCOL_EQUAL;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open("fr_FR", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
ucol_setAttribute(myCollation, UCOL_FRENCH_COLLATION, UCOL_ON, &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing French Collation with Secondary strength\n");
|
||||
/*test acute and grave ordering (compare to french collation)*/
|
||||
|
@ -226,6 +237,7 @@ static void TestExtra()
|
|||
myCollation = ucol_open("fr_FR", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing French Collation extra with secondary strength\n");
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
|
|
|
@ -122,6 +122,7 @@ static void TestTertiary( )
|
|||
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 Kanna(Japan) Collation with Tertiary strength\n");
|
||||
ucol_setNormalization(myCollation, UCOL_DECOMP_COMPAT);
|
||||
|
|
|
@ -124,6 +124,7 @@ static void TestTertiary( )
|
|||
myCollation = ucol_open("tr", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing Turkish Collation with Tertiary strength\n");
|
||||
ucol_setStrength(myCollation, UCOL_TERTIARY);
|
||||
|
@ -143,6 +144,7 @@ static void TestPrimary()
|
|||
myCollation = ucol_open("tr", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing Turkish Collation with Primary strength\n");
|
||||
ucol_setStrength(myCollation, UCOL_PRIMARY);
|
||||
|
|
|
@ -295,6 +295,7 @@ static void TestTertiary( )
|
|||
myCollation = ucol_open("en_US", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
log_verbose("Testing English Collation with Tertiary strength\n");
|
||||
ucol_setAttribute(myCollation, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
|
||||
|
@ -336,6 +337,7 @@ static void TestPrimary()
|
|||
myCollation = ucol_open("en_US", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
ucol_setAttribute(myCollation, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
|
||||
ucol_setStrength(myCollation, UCOL_PRIMARY);
|
||||
|
@ -355,6 +357,7 @@ static void TestSecondary()
|
|||
myCollation = ucol_open("en_US", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
ucol_setStrength(myCollation, UCOL_SECONDARY);
|
||||
log_verbose("Testing English Collation with Secondary strength\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue