ICU-2438 CollationElements->collations changes in cintltst
X-SVN-Rev: 13670
This commit is contained in:
parent
d5dcb0d8a0
commit
43f8403ace
@ -571,7 +571,7 @@ static void TestOffset()
|
|||||||
u_uastrcpy(test1, "What subset of all possible test cases?");
|
u_uastrcpy(test1, "What subset of all possible test cases?");
|
||||||
u_uastrcpy(test2, "has the highest probability of detecting");
|
u_uastrcpy(test2, "has the highest probability of detecting");
|
||||||
en_us = ucol_open("en_US", &status);
|
en_us = ucol_open("en_US", &status);
|
||||||
log_verbose("Testing getOffset and setOffset for CollationElements\n");
|
log_verbose("Testing getOffset and setOffset for collations\n");
|
||||||
iter = ucol_openElements(en_us, test1, u_strlen(test1), &status);
|
iter = ucol_openElements(en_us, test1, u_strlen(test1), &status);
|
||||||
if(U_FAILURE(status)){
|
if(U_FAILURE(status)){
|
||||||
log_err("ERROR: in creation of collation element iterator using ucol_openElements()\n %s\n",
|
log_err("ERROR: in creation of collation element iterator using ucol_openElements()\n %s\n",
|
||||||
|
@ -1264,7 +1264,8 @@ TestKeyInRootRecursive(UResourceBundle *root, const char *rootName,
|
|||||||
UBool isRoot = strcmp(rootName, "root") == 0;
|
UBool isRoot = strcmp(rootName, "root") == 0;
|
||||||
UBool isSpecial = FALSE;
|
UBool isSpecial = FALSE;
|
||||||
if (currentBundleKey) {
|
if (currentBundleKey) {
|
||||||
isSpecial = strcmp(currentBundleKey, "Currencies") == 0;
|
isSpecial = (strcmp(currentBundleKey, "Currencies") == 0
|
||||||
|
|| strcmp(currentBundleKey, "collations") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isRoot && !isSpecial)
|
if ((isRoot && !isSpecial)
|
||||||
|
@ -388,7 +388,7 @@ static void BillFairmanTest(void) {
|
|||||||
|
|
||||||
lr = ures_open(NULL,lp,&lec);
|
lr = ures_open(NULL,lp,&lec);
|
||||||
if (lr) {
|
if (lr) {
|
||||||
cr = ures_getByKey(lr,"CollationElements",0,&lec);
|
cr = ures_getByKey(lr,"collations",0,&lec);
|
||||||
if (cr) {
|
if (cr) {
|
||||||
lp = ures_getLocale(cr,&lec);
|
lp = ures_getLocale(cr,&lec);
|
||||||
if (lp) {
|
if (lp) {
|
||||||
@ -1272,7 +1272,7 @@ static UBool hasCollationElements(const char *locName) {
|
|||||||
|
|
||||||
if(U_SUCCESS(status)) {
|
if(U_SUCCESS(status)) {
|
||||||
status = U_ZERO_ERROR;
|
status = U_ZERO_ERROR;
|
||||||
ColEl = ures_getByKey(loc, "CollationElements", ColEl, &status);
|
ColEl = ures_getByKey(loc, "collations", ColEl, &status);
|
||||||
if(status == U_ZERO_ERROR) { /* do the test - there are real elements */
|
if(status == U_ZERO_ERROR) { /* do the test - there are real elements */
|
||||||
ures_close(ColEl);
|
ures_close(ColEl);
|
||||||
ures_close(loc);
|
ures_close(loc);
|
||||||
@ -1316,8 +1316,13 @@ static void TestCollations(void) {
|
|||||||
cName[nameSize] = 0;
|
cName[nameSize] = 0;
|
||||||
log_verbose("\nTesting locale %s (%s)\n", locName, cName);
|
log_verbose("\nTesting locale %s (%s)\n", locName, cName);
|
||||||
coll = ucol_open(locName, &status);
|
coll = ucol_open(locName, &status);
|
||||||
testAgainstUCA(coll, UCA, "UCA", FALSE, &status);
|
if(U_SUCCESS(status)) {
|
||||||
ucol_close(coll);
|
testAgainstUCA(coll, UCA, "UCA", FALSE, &status);
|
||||||
|
ucol_close(coll);
|
||||||
|
} else {
|
||||||
|
log_err("Couldn't instantiate collator for locale %s, error: %s\n", locName, u_errorName(status));
|
||||||
|
status = U_ZERO_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ucol_setAttribute(UCA, UCOL_STRENGTH, oldStrength, &status);
|
ucol_setAttribute(UCA, UCOL_STRENGTH, oldStrength, &status);
|
||||||
|
@ -809,7 +809,7 @@ static void TestGetSize(void) {
|
|||||||
{ "emptyint", 1},
|
{ "emptyint", 1},
|
||||||
{ "emptybin", 1},
|
{ "emptybin", 1},
|
||||||
{ "testinclude", 1},
|
{ "testinclude", 1},
|
||||||
{ "CollationElements", 3}, /* not 2 - there is hidden %%CollationBin */
|
{ "collations", 1}, /* not 2 - there is hidden %%CollationBin */
|
||||||
};
|
};
|
||||||
|
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
@ -904,15 +904,15 @@ static void TestGetLocaleByType(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
locale = ures_getLocaleByType(res, ULOC_REQUESTED_LOCALE, &status);
|
locale = ures_getLocaleByType(res, ULOC_REQUESTED_LOCALE, &status);
|
||||||
if(strcmp(locale, test[i].requestedLocale) != 0) {
|
if(locale) {
|
||||||
log_err("Expected requested locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
log_err("Requested locale should return NULL\n");
|
||||||
}
|
}
|
||||||
locale = ures_getLocaleByType(res, ULOC_VALID_LOCALE, &status);
|
locale = ures_getLocaleByType(res, ULOC_VALID_LOCALE, &status);
|
||||||
if(strcmp(locale, test[i].validLocale) != 0) {
|
if(!locale || strcmp(locale, test[i].validLocale) != 0) {
|
||||||
log_err("Expected valid locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
log_err("Expected valid locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
||||||
}
|
}
|
||||||
locale = ures_getLocaleByType(res, ULOC_ACTUAL_LOCALE, &status);
|
locale = ures_getLocaleByType(res, ULOC_ACTUAL_LOCALE, &status);
|
||||||
if(strcmp(locale, test[i].actualLocale) != 0) {
|
if(!locale || strcmp(locale, test[i].actualLocale) != 0) {
|
||||||
log_err("Expected actual locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
log_err("Expected actual locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
||||||
}
|
}
|
||||||
ures_close(rb);
|
ures_close(rb);
|
||||||
|
@ -233,7 +233,7 @@ static void TestErrorCodes(void) {
|
|||||||
/* we look up the resource which is aliased, but it lives in fallback */
|
/* we look up the resource which is aliased, but it lives in fallback */
|
||||||
if(U_SUCCESS(status) && r != NULL) {
|
if(U_SUCCESS(status) && r != NULL) {
|
||||||
status = U_USING_DEFAULT_WARNING;
|
status = U_USING_DEFAULT_WARNING;
|
||||||
r2 = ures_getByKey(r, "CollationElements", NULL, &status);
|
r2 = ures_getByKey(r, "collations", NULL, &status);
|
||||||
checkStatus(U_USING_FALLBACK_WARNING, status);
|
checkStatus(U_USING_FALLBACK_WARNING, status);
|
||||||
}
|
}
|
||||||
ures_close(r);
|
ures_close(r);
|
||||||
@ -246,7 +246,7 @@ static void TestErrorCodes(void) {
|
|||||||
/* we look up the resource which is aliased and at our level */
|
/* we look up the resource which is aliased and at our level */
|
||||||
if(U_SUCCESS(status) && r != NULL) {
|
if(U_SUCCESS(status) && r != NULL) {
|
||||||
status = U_USING_DEFAULT_WARNING;
|
status = U_USING_DEFAULT_WARNING;
|
||||||
r2 = ures_getByKey(r, "CollationElements", r2, &status);
|
r2 = ures_getByKey(r, "collations", r2, &status);
|
||||||
checkStatus(U_USING_DEFAULT_WARNING, status);
|
checkStatus(U_USING_DEFAULT_WARNING, status);
|
||||||
}
|
}
|
||||||
ures_close(r);
|
ures_close(r);
|
||||||
@ -567,10 +567,11 @@ static void TestNewTypes() {
|
|||||||
int32_t strLength = 0;
|
int32_t strLength = 0;
|
||||||
const UChar my[] = {0x0026,0x0027,0x0075,0x0027,0x0020,0x003d,0x0020,0x0027,0xff55,0x0027,0x0000}; /* &'\u0075' = '\uFF55' */
|
const UChar my[] = {0x0026,0x0027,0x0075,0x0027,0x0020,0x003d,0x0020,0x0027,0xff55,0x0027,0x0000}; /* &'\u0075' = '\uFF55' */
|
||||||
status = U_ZERO_ERROR;
|
status = U_ZERO_ERROR;
|
||||||
resB = ures_getByKey(theBundle,"CollationElements", resB,&status);
|
resB = ures_getByKey(theBundle, "collations", resB, &status);
|
||||||
|
resB = ures_getByKey(resB, "standard", resB, &status);
|
||||||
str = ures_getStringByKey(resB,"Sequence",&strLength,&status);
|
str = ures_getStringByKey(resB,"Sequence",&strLength,&status);
|
||||||
if(!str || U_FAILURE(status)) {
|
if(!str || U_FAILURE(status)) {
|
||||||
log_data_err("Could not load CollationElements from theBundle: %s\n", u_errorName(status));
|
log_data_err("Could not load collations from theBundle: %s\n", u_errorName(status));
|
||||||
} else if(u_strcmp(my,str) != 0){
|
} else if(u_strcmp(my,str) != 0){
|
||||||
log_err("Did not get the expected string for escaped \\u0075\n");
|
log_err("Did not get the expected string for escaped \\u0075\n");
|
||||||
}
|
}
|
||||||
@ -856,7 +857,8 @@ static void TestBinaryCollationData(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status=U_ZERO_ERROR;
|
status=U_ZERO_ERROR;
|
||||||
coll = ures_getByKey(teRes, "CollationElements", coll, &status);
|
coll = ures_getByKey(teRes, "collations", coll, &status);
|
||||||
|
coll = ures_getByKey(coll, "standard", coll, &status);
|
||||||
if(U_SUCCESS(status)){
|
if(U_SUCCESS(status)){
|
||||||
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
|
||||||
CONFIRM_INT_EQ(ures_getType(coll), URES_TABLE);
|
CONFIRM_INT_EQ(ures_getType(coll), URES_TABLE);
|
||||||
@ -875,7 +877,7 @@ static void TestBinaryCollationData(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
log_err("ERROR: ures_getByKey(locale(te), CollationElements) failed\n");
|
log_err("ERROR: ures_getByKey(locale(te), collations) failed\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ures_close(binColl);
|
ures_close(binColl);
|
||||||
@ -943,7 +945,7 @@ static void TestAPI() {
|
|||||||
}
|
}
|
||||||
key=ures_getKey(teFillin);
|
key=ures_getKey(teFillin);
|
||||||
/*if(strcmp(key, "%%CollationBin") != 0){*/
|
/*if(strcmp(key, "%%CollationBin") != 0){*/
|
||||||
if(strcmp(key, "CollationElements") != 0){
|
if(strcmp(key, "array_2d_in_Root_te") != 0){
|
||||||
log_err("ERROR: ures_getNextResource() failed\n");
|
log_err("ERROR: ures_getNextResource() failed\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1142,7 +1144,8 @@ static void TestErrorConditions(){
|
|||||||
}
|
}
|
||||||
/*Test ures_getBinary(0 status != U_ILLEGAL_ARGUMENT_ERROR*/
|
/*Test ures_getBinary(0 status != U_ILLEGAL_ARGUMENT_ERROR*/
|
||||||
status=U_ZERO_ERROR;
|
status=U_ZERO_ERROR;
|
||||||
coll = ures_getByKey(teRes, "CollationElements", coll, &status);
|
coll = ures_getByKey(teRes, "collations", coll, &status);
|
||||||
|
coll = ures_getByKey(teRes, "standard", coll, &status);
|
||||||
binColl=ures_getByKey(coll, "%%CollationBin", binColl, &status);
|
binColl=ures_getByKey(coll, "%%CollationBin", binColl, &status);
|
||||||
|
|
||||||
status=U_ILLEGAL_ARGUMENT_ERROR;
|
status=U_ILLEGAL_ARGUMENT_ERROR;
|
||||||
@ -1944,9 +1947,9 @@ static void TestResourceLevelAliasing(void) {
|
|||||||
|
|
||||||
|
|
||||||
/* testing referencing/composed alias */
|
/* testing referencing/composed alias */
|
||||||
uk = ures_findResource("uk/CollationElements/Sequence", uk, &status);
|
uk = ures_findResource("uk/collations/standard/Sequence", uk, &status);
|
||||||
if((uk == NULL) || U_FAILURE(status)) {
|
if((uk == NULL) || U_FAILURE(status)) {
|
||||||
log_err("Couldn't findResource('uk/collationelements/sequence') err %s\n", u_errorName(status));
|
log_err("Couldn't findResource('uk/collations/standard/sequence') err %s\n", u_errorName(status));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1964,7 +1967,8 @@ static void TestResourceLevelAliasing(void) {
|
|||||||
log_err("Referencing alias didn't get the right string\n");
|
log_err("Referencing alias didn't get the right string\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
tb = ures_getByKey(aliasB, "CollationElements", tb, &status);
|
tb = ures_getByKey(aliasB, "collations", tb, &status);
|
||||||
|
tb = ures_getByKey(tb, "standard", tb, &status);
|
||||||
tb = ures_getByKey(tb, "Sequence", tb, &status);
|
tb = ures_getByKey(tb, "Sequence", tb, &status);
|
||||||
string = ures_getString(tb, &strLen, &status);
|
string = ures_getString(tb, &strLen, &status);
|
||||||
|
|
||||||
@ -1981,10 +1985,11 @@ static void TestResourceLevelAliasing(void) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* check whether the binary collation data is properly referenced by an alias */
|
/* check whether the binary collation data is properly referenced by an alias */
|
||||||
uk = ures_findResource("uk/CollationElements/%%CollationBin", uk, &status);
|
uk = ures_findResource("uk/collations/standard/%%CollationBin", uk, &status);
|
||||||
binSequence = ures_getBinary(uk, &binSeqLen, &status);
|
binSequence = ures_getBinary(uk, &binSeqLen, &status);
|
||||||
|
|
||||||
tb = ures_getByKey(aliasB, "CollationElements", tb, &status);
|
tb = ures_getByKey(aliasB, "collations", tb, &status);
|
||||||
|
tb = ures_getByKey(tb, "standard", tb, &status);
|
||||||
tb = ures_getByKey(tb, "%%CollationBin", tb, &status);
|
tb = ures_getByKey(tb, "%%CollationBin", tb, &status);
|
||||||
binary = ures_getBinary(tb, &binLen, &status);
|
binary = ures_getBinary(tb, &binLen, &status);
|
||||||
|
|
||||||
@ -2122,7 +2127,7 @@ static void TestDirectAccess(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t = ures_findResource("sh/CollationElements/Sequence", t, &status);
|
t = ures_findResource("sh/collations/standard/Sequence", t, &status);
|
||||||
if(U_FAILURE(status)) {
|
if(U_FAILURE(status)) {
|
||||||
log_err("Couldn't access keyed resource, error %s\n", u_errorName(status));
|
log_err("Couldn't access keyed resource, error %s\n", u_errorName(status));
|
||||||
status = U_ZERO_ERROR;
|
status = U_ZERO_ERROR;
|
||||||
@ -2140,7 +2145,7 @@ static void TestDirectAccess(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(U_SUCCESS(status)) {
|
if(U_SUCCESS(status)) {
|
||||||
strcpy(buffer, "CollationElements/Sequence");
|
strcpy(buffer, "collations/standard/Sequence");
|
||||||
s = buffer;
|
s = buffer;
|
||||||
t = ures_findSubResource(t2, s, t, &status);
|
t = ures_findSubResource(t2, s, t, &status);
|
||||||
if(U_FAILURE(status)) {
|
if(U_FAILURE(status)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user