mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-96 adapting cintltst to non-English default locales
X-SVN-Rev: 4194
This commit is contained in:
parent
c1c054062d
commit
215361e8e9
5 changed files with 26 additions and 59 deletions
|
@ -157,7 +157,7 @@ void TestProperty()
|
|||
|
||||
log_verbose("The property tests begin : \n");
|
||||
log_verbose("Test ucol_strcoll : \n");
|
||||
col = ucol_open(NULL, &status);
|
||||
col = ucol_open("en_US", &status);
|
||||
if (U_FAILURE(status)) {
|
||||
log_err("Default Collator creation failed.: %s\n", myErrorName(status));
|
||||
return;
|
||||
|
|
|
@ -104,7 +104,7 @@ void currTest()
|
|||
UCollationResult compareResult, keyResult, incResult;
|
||||
UCollationResult expectedResult = UCOL_EQUAL;
|
||||
log_verbose("Testing currency of all locales\n");
|
||||
c = ucol_open(NULL, &status);
|
||||
c = ucol_open("en_US", &status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
log_err("collator open failed! :%s\n", myErrorName(status));
|
||||
|
|
|
@ -57,7 +57,7 @@ void Test4029195()
|
|||
log_verbose("Testing date format and parse function in regression test\n");
|
||||
today = ucal_getNow();
|
||||
|
||||
df = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,NULL, NULL, 0, &status);
|
||||
df = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,"en_US", NULL, 0, &status);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("FAIL: error in creating the dateformat using default date and time style : %s\n", myErrorName(status));
|
||||
|
|
|
@ -214,9 +214,8 @@ static void TestG7Locales()
|
|||
static void TestDemo1()
|
||||
{
|
||||
UCollator *col, *myCollation;
|
||||
const UChar *baseRules;
|
||||
UChar *newRules, *temp;
|
||||
int32_t len, rlen, j, n;
|
||||
UChar *temp;
|
||||
int32_t len, j, n;
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
log_verbose("Demo Test 1 : Create a new table collation with rules \" & Z < p, P \" \n");
|
||||
|
@ -227,18 +226,12 @@ static void TestDemo1()
|
|||
return;
|
||||
}
|
||||
|
||||
baseRules = ucol_getRules(col, &rlen);
|
||||
temp=(UChar*)malloc(sizeof(UChar) * 15);
|
||||
u_uastrcpy(temp, "& Z < p, P");
|
||||
|
||||
len=rlen + u_strlen(temp);
|
||||
newRules=(UChar*)malloc(sizeof(UChar) * (len+1));
|
||||
/*
|
||||
my_strncpy(newRules, baseRules, rlen);
|
||||
my_strcat(newRules, temp, rlen);
|
||||
*/
|
||||
my_strncpy(newRules, temp, len);
|
||||
myCollation = ucol_openRules(newRules, len, UCOL_NO_NORMALIZATION,
|
||||
len=u_strlen(temp);
|
||||
|
||||
myCollation = ucol_openRules(temp, len, UCOL_NO_NORMALIZATION,
|
||||
UCOL_DEFAULT_STRENGTH, &status);
|
||||
|
||||
if (U_FAILURE(status))
|
||||
|
@ -258,16 +251,14 @@ static void TestDemo1()
|
|||
ucol_close(myCollation);
|
||||
ucol_close(col);
|
||||
free(temp);
|
||||
free(newRules);
|
||||
}
|
||||
|
||||
static void TestDemo2()
|
||||
{
|
||||
UCollator *col, *myCollation;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const UChar *baseRules;
|
||||
UChar *newRules, *temp;
|
||||
int32_t len, rlen, j, n;
|
||||
UChar *temp;
|
||||
int32_t len, j, n;
|
||||
|
||||
log_verbose("Demo Test 2 : Create a new table collation with rules \"& C < ch , cH, Ch, CH\"");
|
||||
status = U_ZERO_ERROR;
|
||||
|
@ -276,19 +267,12 @@ static void TestDemo2()
|
|||
log_err("Error in creation of Collator in Demo1 : %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
baseRules = ucol_getRules(col, &rlen);
|
||||
temp=(UChar*)malloc(sizeof(UChar) * 70);
|
||||
u_uastrcpy(temp, "& C < ch , cH, Ch, CH");
|
||||
|
||||
len=rlen + u_strlen(temp);
|
||||
newRules=(UChar*)malloc(sizeof(UChar) * (len+1));
|
||||
/*
|
||||
my_strncpy(newRules, baseRules, rlen);
|
||||
my_strcat(newRules, temp, rlen);
|
||||
*/
|
||||
my_strncpy(newRules, temp, len);
|
||||
len=u_strlen(temp);
|
||||
|
||||
myCollation = ucol_openRules(newRules, len, UCOL_NO_NORMALIZATION,
|
||||
myCollation = ucol_openRules(temp, len, UCOL_NO_NORMALIZATION,
|
||||
UCOL_DEFAULT_STRENGTH, &status);
|
||||
|
||||
if (U_FAILURE(status))
|
||||
|
@ -306,7 +290,6 @@ static void TestDemo2()
|
|||
ucol_close(myCollation);
|
||||
ucol_close(col);
|
||||
free(temp);
|
||||
free(newRules);
|
||||
|
||||
}
|
||||
|
||||
|
@ -314,9 +297,8 @@ static void TestDemo3()
|
|||
{
|
||||
UCollator *col, *myCollation;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const UChar *baseRules;
|
||||
UChar *newRules, *temp;
|
||||
int32_t rlen, j, n, len;
|
||||
UChar *temp;
|
||||
int32_t j, n, len;
|
||||
|
||||
log_verbose("Demo Test 3 : Create a new table collation with rules \"& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'\" \n");
|
||||
status = U_ZERO_ERROR;
|
||||
|
@ -325,18 +307,12 @@ static void TestDemo3()
|
|||
log_err("Error in creation of Collator in Demo3 : %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
baseRules = ucol_getRules(col, &rlen);
|
||||
temp=(UChar*)malloc(sizeof(UChar) * 70);
|
||||
u_uastrcpy(temp, "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'");
|
||||
|
||||
len=rlen + u_strlen(temp);
|
||||
newRules=(UChar*)malloc(sizeof(UChar) * (len+1));
|
||||
/*
|
||||
my_strncpy(newRules, baseRules, rlen);
|
||||
my_strcat(newRules, temp, rlen);
|
||||
*/
|
||||
my_strncpy(newRules, temp, len);
|
||||
myCollation = ucol_openRules(newRules, len, UCOL_NO_NORMALIZATION,
|
||||
len=u_strlen(temp);
|
||||
|
||||
myCollation = ucol_openRules(temp, len, UCOL_NO_NORMALIZATION,
|
||||
UCOL_DEFAULT_STRENGTH, &status);
|
||||
|
||||
if (U_FAILURE(status))
|
||||
|
@ -355,7 +331,6 @@ static void TestDemo3()
|
|||
ucol_close(myCollation);
|
||||
ucol_close(col);
|
||||
free(temp);
|
||||
free(newRules);
|
||||
|
||||
}
|
||||
|
||||
|
@ -363,9 +338,8 @@ static void TestDemo4()
|
|||
{
|
||||
UCollator *col, *myCollation;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const UChar *baseRules;
|
||||
UChar *newRules, *temp;
|
||||
int32_t rlen, j, n, len;
|
||||
UChar *temp;
|
||||
int32_t j, n, len;
|
||||
|
||||
log_verbose("Demo Test 4 : Create a new table collation with rules \" & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' \"\n");
|
||||
status = U_ZERO_ERROR;
|
||||
|
@ -374,18 +348,12 @@ static void TestDemo4()
|
|||
log_err("Error in creation of Collator in Demo1 : %s\n", myErrorName(status));
|
||||
return;
|
||||
}
|
||||
baseRules = ucol_getRules(col, &rlen);
|
||||
|
||||
temp=(UChar*)malloc(sizeof(UChar) * 90);
|
||||
u_uastrcpy(temp, " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' ");
|
||||
|
||||
len=rlen + u_strlen(temp);
|
||||
newRules=(UChar*)malloc(sizeof(UChar) * (len+1));
|
||||
/*
|
||||
my_strncpy(newRules, baseRules, rlen);
|
||||
my_strcat(newRules, temp, rlen);
|
||||
*/
|
||||
my_strncpy(newRules, temp, len);
|
||||
myCollation = ucol_openRules(newRules, len, UCOL_NO_NORMALIZATION,
|
||||
len=u_strlen(temp);
|
||||
myCollation = ucol_openRules(temp, len, UCOL_NO_NORMALIZATION,
|
||||
UCOL_DEFAULT_STRENGTH, &status);
|
||||
|
||||
if (U_FAILURE(status))
|
||||
|
@ -403,5 +371,4 @@ static void TestDemo4()
|
|||
ucol_close(myCollation);
|
||||
ucol_close(col);
|
||||
free(temp);
|
||||
free(newRules);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ static void TestCase( )
|
|||
|
||||
int32_t i,j,k;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open(NULL, &status);
|
||||
myCollation = ucol_open("en_US", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
|
@ -349,7 +349,7 @@ void BlackBirdTest( ) {
|
|||
|
||||
uint32_t i = 0, j = 0;
|
||||
uint32_t size = 0;
|
||||
UCollator *coll = ucol_open(NULL, &status);
|
||||
UCollator *coll = ucol_open("en_US", &status);
|
||||
|
||||
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_OFF, &status);
|
||||
ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, UCOL_NON_IGNORABLE, &status);
|
||||
|
@ -423,7 +423,7 @@ static void FunkyATest( )
|
|||
|
||||
int32_t i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollation = ucol_open(NULL, &status);
|
||||
myCollation = ucol_open("en_US", &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
|
||||
return;
|
||||
|
@ -494,7 +494,7 @@ static void PrintMarkDavis( )
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
UChar m[256];
|
||||
uint8_t sortkey[256];
|
||||
UCollator *coll = ucol_open(NULL, &status);
|
||||
UCollator *coll = ucol_open("en_US", &status);
|
||||
uint32_t h,i,j,k, sortkeysize;
|
||||
uint32_t sizem = 0;
|
||||
char buffer[512];
|
||||
|
|
Loading…
Add table
Reference in a new issue