move files out of the source folder
diff --git a/test/cintltst/callcoll.c b/test/cintltst/callcoll.c
index cf76b28..f37fa80 100644
--- a/test/cintltst/callcoll.c
+++ b/test/cintltst/callcoll.c
@@ -647,7 +647,7 @@
genericOrderingTestWithResult(coll, s, size, result);
} else {
- log_err("Unable to open collator with rules %s\n", rules);
+ log_err_status(status, "Unable to open collator with rules %s\n", rules);
}
ucol_close(coll);
}
@@ -669,7 +669,7 @@
genericOrderingTestWithResult(coll, s, size, result);
} else {
- log_err("Unable to open collator for locale %s\n", locale);
+ log_err_status(status, "Unable to open collator for locale %s\n", locale);
}
ucol_close(coll);
}
@@ -713,7 +713,7 @@
myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH, NULL, &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator :%s\n", myErrorName(status));
return;
}
@@ -738,7 +738,7 @@
myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH,NULL, &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator :%s\n", myErrorName(status));
return;
}
ucol_setStrength(myCollation, UCOL_PRIMARY);
@@ -765,7 +765,7 @@
myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH,NULL, &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator :%s\n", myErrorName(status));
return;
}
ucol_setStrength(myCollation, UCOL_SECONDARY);
@@ -790,7 +790,7 @@
myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_IDENTICAL, NULL,&status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator :%s\n", myErrorName(status));
return;
}
for(i= 34; i<37; i++)
@@ -814,7 +814,7 @@
myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH,NULL, &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator :%s\n", myErrorName(status));
return;
}
ucol_setStrength(myCollation, UCOL_TERTIARY);
@@ -850,7 +850,7 @@
myCollator = ucol_open("en_US", &status);
if (U_FAILURE(status)){
- log_err("ERROR: Failed to create the collator : %s\n", u_errorName(status));
+ log_err_status(status, "ERROR: Failed to create the collator : %s\n", u_errorName(status));
return;
}
result = ucol_strcoll(myCollator, source, -1, target, -1);
@@ -893,7 +893,7 @@
myCollator = ucol_open("en_US", &status);
if (U_FAILURE(status)){
- log_err("ERROR: Failed to create the collator : %s\n", u_errorName(status));
+ log_err_status(status, "ERROR: Failed to create the collator : %s\n", u_errorName(status));
return;
}
ucol_setAttribute(myCollator, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
@@ -994,7 +994,7 @@
enCollation = ucol_open("en_US", &status);
if (U_FAILURE(status)) {
- log_err("ERROR: in creation of collator :%s\n",
+ log_err_status(status, "ERROR: in creation of collator :%s\n",
myErrorName(status));
return;
}
@@ -1075,7 +1075,7 @@
enCollation = ucol_open("en_US", &status);
if (U_FAILURE(status)) {
- log_err("ERROR: in creation of collator :%s\n",
+ log_err_status(status, "ERROR: in creation of collator :%s\n",
myErrorName(status));
return;
}
@@ -1160,10 +1160,10 @@
/* open the rules and test */
coll = ucol_openRules(rules,u_strlen(rules),UCOL_OFF,UCOL_DEFAULT_STRENGTH,&parseError,&status);
if(u_strcmp(parseError.preContext,preContextExp)!=0){
- log_err("preContext in UParseError for ucol_openRules does not match\n");
+ log_err_status(status, "preContext in UParseError for ucol_openRules does not match\n");
}
if(u_strcmp(parseError.postContext,postContextExp)!=0){
- log_err("postContext in UParseError for ucol_openRules does not match\n");
+ log_err_status(status, "postContext in UParseError for ucol_openRules does not match\n");
}
}
}
@@ -1205,7 +1205,7 @@
u_uastrcpy(rule, rules[i]);
c1 = ucol_openRules(rule, u_strlen(rule), UCOL_OFF, UCOL_DEFAULT_STRENGTH, &parseError, &status);
if(U_FAILURE(status)){
- log_err("Could not parse the rules syntax. Error: %s\n", u_errorName(status));
+ log_err_status(status, "Could not parse the rules syntax. Error: %s\n", u_errorName(status));
if (status == U_PARSE_ERROR) {
u_UCharsToChars(parseError.preContext,preContext,20);
@@ -1232,7 +1232,7 @@
UErrorCode status = U_ZERO_ERROR;
UCollator *coll = ucol_open("es", &status);
if(U_FAILURE(status)) {
- log_err("Couldn't open collator\n");
+ log_err_status(status, "Couldn't open collator -> %s\n", u_errorName(status));
return;
}
ucol_close(coll);
@@ -1240,7 +1240,7 @@
ctest_resetICU();
coll = ucol_open("de_DE", &status);
if(U_FAILURE(status)) {
- log_err("Couldn't open collator\n");
+ log_err_status(status, "Couldn't open collator -> %s\n", u_errorName(status));
return;
}
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
diff --git a/test/cintltst/calltest.c b/test/cintltst/calltest.c
index 5068f6e..ba05242 100644
--- a/test/cintltst/calltest.c
+++ b/test/cintltst/calltest.c
@@ -44,8 +44,8 @@
{
addCnvSelTest(root);
addUDataTest(root);
- addHeapMutexTest(root);
addPUtilTest(root);
+ addHeapMutexTest(root);
addUTF16Test(root);
addUTF8Test(root);
addUtility(root);
diff --git a/test/cintltst/capitst.c b/test/cintltst/capitst.c
index e535375..c871dd1 100644
--- a/test/cintltst/capitst.c
+++ b/test/cintltst/capitst.c
@@ -157,11 +157,15 @@
UColAttributeValue value;
uint32_t i = 0, j = 0;
+ if (coll == NULL) {
+ log_err_status(status, "Unable to open collator. %s\n", u_errorName(status));
+ return;
+ }
for(i = 0; i<sizeof(attrs)/sizeof(attrs[0]); i++) {
currAttr = attrs[i].att;
ucol_setAttribute(coll, currAttr, UCOL_DEFAULT, &status);
if(U_FAILURE(status)) {
- log_err("ucol_setAttribute with the default value returned error: %s\n", u_errorName(status));
+ log_err_status(status, "ucol_setAttribute with the default value returned error: %s\n", u_errorName(status));
break;
}
value = ucol_getAttribute(coll, currAttr, &status);
@@ -189,7 +193,6 @@
log_err("ucol_setAttribute with the default valuereturned error: %s\n", u_errorName(status));
break;
}
-
}
status = U_ZERO_ERROR;
value = ucol_getAttribute(coll, UCOL_ATTRIBUTE_COUNT, &status);
@@ -302,7 +305,7 @@
log_verbose("Test ucol_strcoll : \n");
col = ucol_open("en_US", &status);
if (U_FAILURE(status)) {
- log_err("Default Collator creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "Default Collator creation failed.: %s\n", myErrorName(status));
return;
}
@@ -460,7 +463,7 @@
col1 = ucol_openRules(ruleset1, u_strlen(ruleset1), UCOL_DEFAULT, UCOL_DEFAULT_STRENGTH, NULL,&status);
if (U_FAILURE(status)) {
- log_err("RuleBased Collator creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "RuleBased Collator creation failed.: %s\n", myErrorName(status));
return;
}
else
@@ -572,7 +575,7 @@
status=U_ZERO_ERROR;
col = ucol_open("en_US", &status);
if(U_FAILURE(status)) {
- log_err("ucal_open() collation creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "ucal_open() collation creation failed.: %s\n", myErrorName(status));
return;
}
test1=(UChar*)malloc(sizeof(UChar) * 6);
@@ -619,7 +622,7 @@
vi_VN = ucol_open("vi_VN", &status);
if (U_FAILURE(status)) {
- log_err("ERROR: collation creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: collation creation failed.: %s\n", myErrorName(status));
return;
}
@@ -1052,7 +1055,7 @@
/* col = ucol_open(NULL, &status); */
col = ucol_open("en_US", &status);
if (U_FAILURE(status)) {
- log_err("ERROR: Default collation creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: Default collation creation failed.: %s\n", myErrorName(status));
return;
}
@@ -1179,7 +1182,7 @@
log_verbose("testing getHashCode begins...\n");
col = ucol_open("en_US", &status);
if (U_FAILURE(status)) {
- log_err("ERROR: Default collation creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: Default collation creation failed.: %s\n", myErrorName(status));
return;
}
test1=(UChar*)malloc(sizeof(UChar) * 6);
@@ -1235,7 +1238,7 @@
col = ucol_open("en_US", &status);
ucol_setAttribute(col, UCOL_NORMALIZATION_MODE, UCOL_OFF, &status);
if (U_FAILURE(status)) {
- log_err("ERROR: Default collation creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: Default collation creation failed.: %s\n", myErrorName(status));
return;
}
@@ -1380,7 +1383,7 @@
status = U_ZERO_ERROR;
coll = ucol_open(testStruct[i].requestedLocale, &status);
if(U_FAILURE(status)) {
- log_err("Failed to open collator for %s with %s\n", testStruct[i].requestedLocale, u_errorName(status));
+ log_err_status(status, "Failed to open collator for %s with %s\n", testStruct[i].requestedLocale, u_errorName(status));
ucol_close(coll);
continue;
}
@@ -1691,98 +1694,98 @@
UCollator *coll = ucol_open(NULL, &error);
if (U_FAILURE(error)) {
- log_err("Creation of default collator failed");
+ log_err_status(error, "Creation of default collator failed\n");
return;
}
ucol_setAttribute(coll, UCOL_FRENCH_COLLATION, UCOL_OFF, &error);
if (ucol_getAttribute(coll, UCOL_FRENCH_COLLATION, &error) != UCOL_OFF ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the french collation failed");
+ log_err_status(error, "Setting and retrieving of the french collation failed\n");
}
ucol_setAttribute(coll, UCOL_FRENCH_COLLATION, UCOL_ON, &error);
if (ucol_getAttribute(coll, UCOL_FRENCH_COLLATION, &error) != UCOL_ON ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the french collation failed");
+ log_err_status(error, "Setting and retrieving of the french collation failed\n");
}
ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &error);
if (ucol_getAttribute(coll, UCOL_ALTERNATE_HANDLING, &error) != UCOL_SHIFTED ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the alternate handling failed");
+ log_err_status(error, "Setting and retrieving of the alternate handling failed\n");
}
ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, UCOL_NON_IGNORABLE, &error);
if (ucol_getAttribute(coll, UCOL_ALTERNATE_HANDLING, &error) != UCOL_NON_IGNORABLE ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the alternate handling failed");
+ log_err_status(error, "Setting and retrieving of the alternate handling failed\n");
}
ucol_setAttribute(coll, UCOL_CASE_FIRST, UCOL_LOWER_FIRST, &error);
if (ucol_getAttribute(coll, UCOL_CASE_FIRST, &error) != UCOL_LOWER_FIRST ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the case first attribute failed");
+ log_err_status(error, "Setting and retrieving of the case first attribute failed\n");
}
ucol_setAttribute(coll, UCOL_CASE_FIRST, UCOL_UPPER_FIRST, &error);
if (ucol_getAttribute(coll, UCOL_CASE_FIRST, &error) != UCOL_UPPER_FIRST ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the case first attribute failed");
+ log_err_status(error, "Setting and retrieving of the case first attribute failed\n");
}
ucol_setAttribute(coll, UCOL_CASE_LEVEL, UCOL_ON, &error);
if (ucol_getAttribute(coll, UCOL_CASE_LEVEL, &error) != UCOL_ON ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the case level attribute failed");
+ log_err_status(error, "Setting and retrieving of the case level attribute failed\n");
}
ucol_setAttribute(coll, UCOL_CASE_LEVEL, UCOL_OFF, &error);
if (ucol_getAttribute(coll, UCOL_CASE_LEVEL, &error) != UCOL_OFF ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the case level attribute failed");
+ log_err_status(error, "Setting and retrieving of the case level attribute failed\n");
}
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &error);
if (ucol_getAttribute(coll, UCOL_NORMALIZATION_MODE, &error) != UCOL_ON ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the normalization on/off attribute failed");
+ log_err_status(error, "Setting and retrieving of the normalization on/off attribute failed\n");
}
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_OFF, &error);
if (ucol_getAttribute(coll, UCOL_NORMALIZATION_MODE, &error) != UCOL_OFF ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the normalization on/off attribute failed");
+ log_err_status(error, "Setting and retrieving of the normalization on/off attribute failed\n");
}
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_PRIMARY, &error);
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_PRIMARY ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the collation strength failed");
+ log_err_status(error, "Setting and retrieving of the collation strength failed\n");
}
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_SECONDARY, &error);
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_SECONDARY ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the collation strength failed");
+ log_err_status(error, "Setting and retrieving of the collation strength failed\n");
}
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_TERTIARY, &error);
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_TERTIARY ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the collation strength failed");
+ log_err_status(error, "Setting and retrieving of the collation strength failed\n");
}
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_QUATERNARY, &error);
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_QUATERNARY ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the collation strength failed");
+ log_err_status(error, "Setting and retrieving of the collation strength failed\n");
}
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_IDENTICAL, &error);
if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_IDENTICAL ||
U_FAILURE(error)) {
- log_err("Setting and retrieving of the collation strength failed");
+ log_err_status(error, "Setting and retrieving of the collation strength failed\n");
}
ucol_close(coll);
@@ -1823,7 +1826,7 @@
}
uset_close(set);
} else {
- log_err("Couldn't open collator with rules %s\n", setTest[i].rules);
+ log_err_status(status, "Couldn't open collator with rules %s\n", setTest[i].rules);
}
ucol_close(coll);
}
@@ -2003,8 +2006,9 @@
coll = ucol_openFromShortString(testCases[i].input, FALSE, &parseError, &status);
if(status != testCases[i].expectedStatus) {
- log_err("Got status '%s' that is different from expected '%s' for '%s'\n",
+ log_err_status(status, "Got status '%s' that is different from expected '%s' for '%s'\n",
u_errorName(status), u_errorName(testCases[i].expectedStatus), testCases[i].input);
+ continue;
}
if(U_SUCCESS(status)) {
@@ -2138,6 +2142,10 @@
for(i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
log_verbose("Testing locale: %s\n", tests[i].locale);
coll = ucol_open(tests[i].locale, &status);
+ if (coll == NULL || U_FAILURE(status)) {
+ log_err_status(status, "Unable to open collator for locale %s ==> %s\n", tests[i].locale, u_errorName(status));
+ continue;
+ }
ucol_getContractionsAndExpansions(coll, conts, exp, TRUE, &status);
doSetsTest(tests[i].locale, conts, set, tests[i].inConts, tests[i].outConts, &status);
setLen = uset_toPattern(conts, buffer, setBufferLen, TRUE, &status);
@@ -2242,6 +2250,10 @@
/* Tests for code coverage. */
UErrorCode status = U_ZERO_ERROR;
UCollator *coll = ucol_open("es@collation=pinyin", &status);
+ if (coll == NULL || status == U_FILE_ACCESS_ERROR) {
+ log_data_err("Unable to open collator es@collation=pinyin\n");
+ return;
+ }
if (status != U_USING_DEFAULT_WARNING) {
/* What do you mean that you know about using pinyin collation in Spanish!? This should be in the zh locale. */
log_err("es@collation=pinyin should return U_USING_DEFAULT_WARNING, but returned %s\n", u_errorName(status));
@@ -2308,7 +2320,7 @@
keywordValues = ucol_getKeywordValuesForLocale("collation", locale, TRUE, &status);
if (keywordValues == NULL || U_FAILURE(status)) {
- log_err("Error getting keyword values: %s\n", u_errorName(status));
+ log_err_status(status, "Error getting keyword values: %s\n", u_errorName(status));
break;
}
size = uenum_count(keywordValues, &status);
diff --git a/test/cintltst/cbiapts.c b/test/cintltst/cbiapts.c
index a8a1748..db8a931 100644
--- a/test/cintltst/cbiapts.c
+++ b/test/cintltst/cbiapts.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -33,10 +33,10 @@
#include "cbiapts.h"
#define TEST_ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \
-log_err("Failure at file %s, line %d, error = %s\n", __FILE__, __LINE__, u_errorName(status));}}
+log_data_err("Failure at file %s, line %d, error = %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status));}}
#define TEST_ASSERT(expr) {if ((expr)==FALSE) { \
-log_err("Test Failure at file %s, line %d\n", __FILE__, __LINE__);}}
+log_data_err("Test Failure at file %s, line %d (Are you missing data?)\n", __FILE__, __LINE__);}}
static void TestBreakIteratorSafeClone(void);
static void TestBreakIteratorRules(void);
@@ -155,7 +155,7 @@
log_data_err("Check your data - it doesn't seem to be around\n");
return;
} else if(U_FAILURE(status)){
- log_err("FAIL: Error in ubrk_open() for word breakiterator: %s\n", myErrorName(status));
+ log_err_status(status, "FAIL: Error in ubrk_open() for word breakiterator: %s\n", myErrorName(status));
}
else{
log_verbose("PASS: Successfully opened word breakiterator\n");
@@ -163,7 +163,7 @@
sentence = ubrk_open(UBRK_SENTENCE, "en_US", text, u_strlen(text), &status);
if(U_FAILURE(status)){
- log_err("FAIL: Error in ubrk_open() for sentence breakiterator: %s\n", myErrorName(status));
+ log_err_status(status, "FAIL: Error in ubrk_open() for sentence breakiterator: %s\n", myErrorName(status));
return;
}
else{
@@ -513,7 +513,7 @@
&parseErr, &status);
if (U_FAILURE(status)) {
- log_err("FAIL: ubrk_openRules: ICU Error \"%s\"\n", u_errorName(status));
+ log_data_err("FAIL: ubrk_openRules: ICU Error \"%s\" (Are you missing data?)\n", u_errorName(status));
bi = 0;
};
freeToUCharStrings(&strCleanUp);
@@ -598,7 +598,7 @@
ubrk_close(bi);
} else {
if (parseErr.line != 3 || parseErr.offset != 8) {
- log_err("FAIL: incorrect error position reported. Got line %d, char %d, expected line 3, char 7\n",
+ log_data_err("FAIL: incorrect error position reported. Got line %d, char %d, expected line 3, char 7 (Are you missing data?)\n",
parseErr.line, parseErr.offset);
}
}
@@ -675,7 +675,7 @@
bi = ubrk_open(UBRK_WORD, "en_US", NULL, 0, &status);
if (U_FAILURE(status)) {
- log_err("Failure at file %s, line %d, error = %s\n", __FILE__, __LINE__, u_errorName(status));
+ log_err_status(status, "Failure at file %s, line %d, error = %s\n", __FILE__, __LINE__, u_errorName(status));
return;
}
diff --git a/test/cintltst/ccaltst.c b/test/cintltst/ccaltst.c
index 6591403..f0ec7e2 100644
--- a/test/cintltst/ccaltst.c
+++ b/test/cintltst/ccaltst.c
@@ -133,7 +133,7 @@
count = uenum_count(uenum, &status);
log_verbose("%s returned %d timezone id's:\n", api, count);
if (count < 5) { /* Don't hard code an exact == test here! */
- log_err("FAIL: in %s, got %d, expected at least 5\n", api, count);
+ log_data_err("FAIL: in %s, got %d, expected at least 5 -> %s (Are you missing data?)\n", api, count, u_errorName(status));
}
uenum_reset(uenum, &status);
if (U_FAILURE(status)){
@@ -166,7 +166,7 @@
log_err("FAIL: ucal_getDSTSavings(GMT) => %s\n",
u_errorName(status));
} else if (i != 0) {
- log_err("FAIL: ucal_getDSTSavings(GMT) => %d, expect 0\n", i);
+ log_data_err("FAIL: ucal_getDSTSavings(GMT) => %d, expect 0 (Are you missing data?)\n", i);
}
i = ucal_getDSTSavings(PST, &status);
if (U_FAILURE(status)) {
@@ -194,7 +194,7 @@
u_errorName(status));
} else {
if (u_strcmp(zone2, EUROPE_PARIS) != 0) {
- log_err("FAIL: ucal_getDefaultTimeZone() did not return Europe/Paris\n");
+ log_data_err("FAIL: ucal_getDefaultTimeZone() did not return Europe/Paris (Are you missing data?)\n");
}
}
}
@@ -206,7 +206,7 @@
status = U_ZERO_ERROR;
tzver = ucal_getTZDataVersion(&status);
if (U_FAILURE(status)) {
- log_err("FAIL: ucal_getTZDataVersion() => %s\n", u_errorName(status));
+ log_err_status(status, "FAIL: ucal_getTZDataVersion() => %s\n", u_errorName(status));
} else if (uprv_strlen(tzver) != 5 /*4 digits + 1 letter*/) {
log_err("FAIL: Bad version string was returned by ucal_getTZDataVersion\n");
} else {
@@ -221,11 +221,11 @@
log_err("FAIL: error in ucal_getCanonicalTimeZoneID : %s\n", u_errorName(status));
} else {
if (u_strcmp(AMERICA_LOS_ANGELES, canonicalID) != 0) {
- log_err("FAIL: ucal_getCanonicalTimeZoneID(%s) returned %s : expected - %s\n",
+ log_data_err("FAIL: ucal_getCanonicalTimeZoneID(%s) returned %s : expected - %s (Are you missing data?)\n",
PST, canonicalID, AMERICA_LOS_ANGELES);
}
if (!isSystemID) {
- log_err("FAIL: ucal_getCanonicalTimeZoneID(%s) set %d to isSystemID\n",
+ log_data_err("FAIL: ucal_getCanonicalTimeZoneID(%s) set %d to isSystemID (Are you missing data?)\n",
PST, isSystemID);
}
}
@@ -280,7 +280,7 @@
if(caldef && caldef2 && calfr && calit) {
if(ucal_equivalentTo(caldef, caldef2) == FALSE || ucal_equivalentTo(caldef, calfr)== TRUE ||
ucal_equivalentTo(caldef, calit)== TRUE || ucal_equivalentTo(calfr, calfrclone) == FALSE) {
- log_err("FAIL: Error. equivalentTo test failed\n");
+ log_data_err("FAIL: Error. equivalentTo test failed (Are you missing data?)\n");
} else {
log_verbose("PASS: equivalentTo test passed\n");
}
@@ -293,7 +293,7 @@
/* open the date format and format the date to check the output */
datdef=udat_open(UDAT_FULL,UDAT_FULL ,NULL, NULL, 0,NULL,0,&status);
if(U_FAILURE(status)){
- log_err("FAIL: error in creating the dateformat : %s\n", u_errorName(status));
+ log_data_err("FAIL: error in creating the dateformat : %s (Are you missing data?)\n", u_errorName(status));
return;
}
log_verbose("PASS: The current date and time fetched is %s\n", u_austrcpy(tempMsgBuf, myDateFormat(datdef, now)) );
@@ -402,7 +402,7 @@
log_err("Error in ucal_inDaylightTime: %s\n", u_errorName(status));
}
if(!ucal_inDaylightTime(caldef, &status))
- log_verbose("PASS: It is not in daylight saving's time\n");
+ log_verbose("PASS: It is not in daylight saving's time\n");
else
log_err("FAIL: It is not in daylight saving's time\n");
@@ -466,7 +466,7 @@
datdef=udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,"en_US",fgGMTID,-1,NULL,0, &status);
if(U_FAILURE(status))
{
- log_err("error in creating the dateformat : %s\n", u_errorName(status));
+ log_data_err("error in creating the dateformat : %s (Are you missing data?)\n", u_errorName(status));
return;
}
@@ -652,18 +652,18 @@
datdef=udat_open(UDAT_SHORT,UDAT_SHORT ,NULL,fgGMTID,-1,NULL, 0, &status);
if(U_FAILURE(status))
{
- log_err("error in creating the dateformat : %s\n", u_errorName(status));
+ log_data_err("error in creating the dateformat : %s (Are you missing data?)\n", u_errorName(status));
}
/*Testing ucal_get()*/
log_verbose("\nTesting the ucal_get() function of Calendar\n");
ucal_setDateTime(cal, 1999, UCAL_MARCH, 12, 5, 25, 30, &status);
if(U_FAILURE(status)){
- log_err("error in the setDateTime() : %s\n", u_errorName(status));
+ log_data_err("error in the setDateTime() : %s (Are you missing data?)\n", u_errorName(status));
}
if(ucal_get(cal, UCAL_YEAR, &status)!=1999 || ucal_get(cal, UCAL_MONTH, &status)!=2 ||
ucal_get(cal, UCAL_DATE, &status)!=12 || ucal_get(cal, UCAL_HOUR, &status)!=5)
- log_err("error in ucal_get()\n");
+ log_data_err("error in ucal_get() -> %s (Are you missing data?)\n", u_errorName(status));
else if(ucal_get(cal, UCAL_DAY_OF_WEEK_IN_MONTH, &status)!=2 || ucal_get(cal, UCAL_DAY_OF_WEEK, &status)!=6
|| ucal_get(cal, UCAL_WEEK_OF_MONTH, &status)!=2 || ucal_get(cal, UCAL_WEEK_OF_YEAR, &status)!= 10)
log_err("FAIL: error in ucal_get()\n");
@@ -1062,7 +1062,7 @@
datfor=udat_open(UDAT_MEDIUM,UDAT_MEDIUM ,NULL, fgGMTID,-1,NULL, 0, &status);
if(U_FAILURE(status)){
- log_err("error in creating the dateformat : %s\n", u_errorName(status));
+ log_data_err("error in creating the dateformat : %s (Are you missing data?)\n", u_errorName(status));
}
@@ -1071,7 +1071,7 @@
log_verbose("\nTesting the DOW progression\n");
initialDOW = ucal_get(cal, UCAL_DAY_OF_WEEK, &status);
- if (U_FAILURE(status)) { log_err("ucal_get() failed: %s\n", u_errorName(status) ); return; }
+ if (U_FAILURE(status)) { log_data_err("ucal_get() failed: %s (Are you missing data?)\n", u_errorName(status) ); return; }
newDOW = initialDOW;
do {
DOW = newDOW;
@@ -1141,12 +1141,12 @@
datfor=udat_open(UDAT_MEDIUM,UDAT_MEDIUM ,NULL, fgGMTID,-1,NULL, 0, &status);
if(U_FAILURE(status)){
- log_err("error in creating the dateformat : %s\n", u_errorName(status));
+ log_data_err("error in creating the dateformat : %s (Are you missing data?)\n", u_errorName(status));
}
ucal_setDateTime(gmtcal, yr, mo - 1, dt, hr, mn, sc, &status);
if (U_FAILURE(status)) {
- log_err("ucal_setDateTime failed: %s\n", u_errorName(status));
+ log_data_err("ucal_setDateTime failed: %s (Are you missing data?)\n", u_errorName(status));
return;
}
ucal_set(gmtcal, UCAL_MILLISECOND, 0);
@@ -1482,7 +1482,7 @@
uenum_close(all);
}
} else {
- log_err("Failed to get ALL keyword values for default locale %s: %s.\n", uloc_getDefault(), u_errorName(status));
+ log_err_status(status, "Failed to get ALL keyword values for default locale %s: %s.\n", uloc_getDefault(), u_errorName(status));
}
uenum_close(ALL);
}
diff --git a/test/cintltst/ccapitst.c b/test/cintltst/ccapitst.c
index 7192ef7..1944dff 100644
--- a/test/cintltst/ccapitst.c
+++ b/test/cintltst/ccapitst.c
@@ -164,7 +164,7 @@
log_verbose("Testing ucnv_openAllNames()...");
allNamesEnum = ucnv_openAllNames(&err);
if(U_FAILURE(err)) {
- log_err("FAILURE! ucnv_openAllNames() -> %s\n", myErrorName(err));
+ log_data_err("FAILURE! ucnv_openAllNames() -> %s\n", myErrorName(err));
}
else {
const char *string = NULL;
@@ -214,7 +214,7 @@
/* Test ucnv_countAliases() etc. */
count = ucnv_countAliases("utf-8", &err);
if(U_FAILURE(err)) {
- log_err("FAILURE! ucnv_countAliases(\"utf-8\") -> %s\n", myErrorName(err));
+ log_data_err("FAILURE! ucnv_countAliases(\"utf-8\") -> %s\n", myErrorName(err));
} else if(count <= 0) {
log_err("FAILURE! ucnv_countAliases(\"utf-8\") -> %d aliases\n", count);
} else {
@@ -1345,7 +1345,7 @@
status = U_ZERO_ERROR;
alias = ucnv_getStandardName("Shift_JIS", "IBM", &status);
if (alias == NULL || strcmp(alias, "ibm-943") != 0 || status != U_AMBIGUOUS_ALIAS_WARNING) {
- log_err("FAIL: Didn't get ibm-943 for Shift_JIS {IBM}. Got %s\n", alias);
+ log_data_err("FAIL: Didn't get ibm-943 for Shift_JIS {IBM}. Got %s\n", alias);
}
status = U_ZERO_ERROR;
alias = ucnv_getStandardName("ibm-943", "IANA", &status);
@@ -1520,7 +1520,7 @@
conv1 = ucnv_open("iso-8859-3", &err);
if(U_FAILURE(err)) {
- log_data_err("Err opening iso-8859-3, %s", u_errorName(err));
+ log_data_err("Err opening iso-8859-3, %s\n", u_errorName(err));
return;
}
@@ -2656,7 +2656,7 @@
errorCode=U_ZERO_ERROR;
utf8Cnv=ucnv_open("UTF-8", &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("unable to open UTF-8 converter - %s\n", u_errorName(errorCode));
+ log_data_err("unable to open UTF-8 converter - %s\n", u_errorName(errorCode));
return;
}
@@ -2664,7 +2664,7 @@
errorCode=U_ZERO_ERROR;
cnv=ucnv_open(converterNames[i], &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("unable to open %s converter - %s\n", converterNames[i], u_errorName(errorCode));
+ log_data_err("unable to open %s converter - %s\n", converterNames[i], u_errorName(errorCode));
continue;
}
if(!getTestChar(cnv, converterNames[i], charUTF8, &charUTF8Length, char0, &char0Length, char1, &char1Length)) {
@@ -3453,7 +3453,7 @@
errorCode=U_ZERO_ERROR;
cnv=ucnv_open("UTF-16", &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("ucnv_open(UTF-16) failed - %s\n", u_errorName(errorCode));
+ log_data_err("ucnv_open(UTF-16) failed - %s\n", u_errorName(errorCode));
return;
}
length=ucnv_fromUChars(cnv, buffer, (int32_t)sizeof(buffer), surrogate, 1, &errorCode);
@@ -3468,7 +3468,7 @@
errorCode=U_ZERO_ERROR;
cnv=ucnv_open("UTF-32", &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("ucnv_open(UTF-32) failed - %s\n", u_errorName(errorCode));
+ log_data_err("ucnv_open(UTF-32) failed - %s\n", u_errorName(errorCode));
return;
}
length=ucnv_fromUChars(cnv, buffer, (int32_t)sizeof(buffer), surrogate, 1, &errorCode);
@@ -3484,7 +3484,7 @@
errorCode=U_ZERO_ERROR;
cnv=ucnv_open("ISO-8859-1", &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("ucnv_open(ISO-8859-1) failed - %s\n", u_errorName(errorCode));
+ log_data_err("ucnv_open(ISO-8859-1) failed - %s\n", u_errorName(errorCode));
return;
}
ucnv_setSubstString(cnv, sub, LENGTHOF(sub), &errorCode);
@@ -3504,7 +3504,7 @@
errorCode=U_ZERO_ERROR;
cnv=ucnv_open("HZ", &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("ucnv_open(HZ) failed - %s\n", u_errorName(errorCode));
+ log_data_err("ucnv_open(HZ) failed - %s\n", u_errorName(errorCode));
return;
}
ucnv_setSubstString(cnv, sub, LENGTHOF(sub), &errorCode);
@@ -3638,8 +3638,14 @@
for(i = 0; i < LENGTHOF(names); ++i) {
UErrorCode errorCode = U_ZERO_ERROR;
UConverter *cnv = ucnv_open(names[i], &errorCode);
- int32_t length = ucnv_fromUChars(cnv, bytes, (int32_t)sizeof(bytes), a16, 1, &errorCode);
+ int32_t length = 0;
const uint8_t *exp = expected[i];
+ if (U_FAILURE(errorCode)) {
+ log_err_status(errorCode, "Unable to open converter: %s got error code: %s\n", names[i], u_errorName(errorCode));
+ continue;
+ }
+ length = ucnv_fromUChars(cnv, bytes, (int32_t)sizeof(bytes), a16, 1, &errorCode);
+
if(U_FAILURE(errorCode) || length != exp[0] || 0 != memcmp(bytes, exp+1, length)) {
log_err("unexpected %s BOM writing behavior -- %s\n",
names[i], u_errorName(errorCode));
diff --git a/test/cintltst/ccurrtst.c b/test/cintltst/ccurrtst.c
index a768be7..0fbec2e 100644
--- a/test/cintltst/ccurrtst.c
+++ b/test/cintltst/ccurrtst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2005, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -111,7 +111,7 @@
c = ucol_open("en_US", &status);
if (U_FAILURE(status))
{
- log_err("collator open failed! :%s\n", myErrorName(status));
+ log_err_status(status, "collator open failed! :%s\n", myErrorName(status));
return;
}
diff --git a/test/cintltst/cdattst.c b/test/cintltst/cdattst.c
index 71a86cf..00e39ce 100644
--- a/test/cintltst/cdattst.c
+++ b/test/cintltst/cdattst.c
@@ -80,7 +80,7 @@
fr = udat_open(UDAT_FULL, UDAT_DEFAULT, "fr_FR", NULL,0, NULL, 0,&status);
if(U_FAILURE(status))
{
- log_err("FAIL: error in creating the dateformat using full time style with french locale\n %s\n",
+ log_data_err("FAIL: error in creating the dateformat using full time style with french locale -> %s (Are you missing data?)\n",
myErrorName(status) );
return;
}
@@ -428,7 +428,7 @@
fmtRelDateTime = udat_open(UDAT_SHORT, *stylePtr | UDAT_RELATIVE, trdfLocale, trdfZone, -1, NULL, 0, &status);
if ( U_FAILURE(status) ) {
- log_err("udat_open timeStyle SHORT dateStyle (%d | UDAT_RELATIVE) fails, error %s\n", *stylePtr, myErrorName(status) );
+ log_data_err("udat_open timeStyle SHORT dateStyle (%d | UDAT_RELATIVE) fails, error %s (Are you missing data?)\n", *stylePtr, myErrorName(status) );
continue;
}
fmtRelDate = udat_open(UDAT_NONE, *stylePtr | UDAT_RELATIVE, trdfLocale, trdfZone, -1, NULL, 0, &status);
@@ -541,7 +541,7 @@
fr = udat_open(UDAT_FULL, UDAT_DEFAULT, "fr_FR", NULL, 0, NULL, 0, &status);
if(U_FAILURE(status))
{
- log_err("error in creating the dateformat using full time style with french locale\n %s\n",
+ log_data_err("error in creating the dateformat using full time style with french locale -> %s (Are you missing data?)\n",
myErrorName(status) );
return;
}
@@ -778,7 +778,7 @@
/* Create a formatter for date fields. */
date = udat_open(UDAT_NONE, UDAT_SHORT, "en_US", NULL, 0, NULL, 0, &ec);
if (U_FAILURE(ec)) {
- log_err("FAIL: udat_open(NONE, SHORT, en_US) failed with %s\n",
+ log_data_err("FAIL: udat_open(NONE, SHORT, en_US) failed with %s (Are you missing data?)\n",
u_errorName(ec));
goto FAIL;
}
@@ -1088,7 +1088,10 @@
ec = U_ZERO_ERROR;
fmt = udat_open(UDAT_LONG, UDAT_LONG, "en_US",
0, 0, 0, 0, &ec);
- if (!assertSuccess("udat_open", &ec)) return;
+ if (U_FAILURE(ec)) {
+ log_data_err("FAIL: udat_open (%s) (Are you missing data?)\n", u_errorName(ec));
+ return;
+ }
_aux2ExtremeDates(fmt, small, large, buf, LEN(buf), cbuf, 0, &ec);
@@ -1213,7 +1216,7 @@
udat_close(icudf);
} else {
- log_err("FAIL: err %s\n", u_errorName(status));
+ log_data_err("FAIL: err calling udat_open() ->%s (Are you missing data?)\n", u_errorName(status));
}
}
diff --git a/test/cintltst/cdetst.c b/test/cintltst/cdetst.c
index 6d53b74..ec82c01 100644
--- a/test/cintltst/cdetst.c
+++ b/test/cintltst/cdetst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -104,7 +104,7 @@
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_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
log_verbose("Testing German Collation with Tertiary strength\n");
@@ -124,7 +124,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("de_DE", &status);
if(U_FAILURE(status)){
- log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
+ log_err_status(status, "ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
return;
}
log_verbose("Testing German Collation with primary strength\n");
diff --git a/test/cintltst/cdtdptst.c b/test/cintltst/cdtdptst.c
index d19b7ee..cd3515c 100644
--- a/test/cintltst/cdtdptst.c
+++ b/test/cintltst/cdtdptst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2006, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -59,43 +59,45 @@
u_uastrcpy(pattern, "EEE MMM dd HH:mm:ss.SSS zzz yyyy G");
fullFmt= udat_open(UDAT_IGNORE, UDAT_IGNORE,"en_US",NULL,0,pattern, u_strlen(pattern),&status);
if(U_FAILURE(status)) {
- log_err("FAIL: Error in creating a date format using udat_openPattern \n %s\n",
+ log_err_status(status, "FAIL: Error in creating a date format using udat_openPattern %s\n",
myErrorName(status) );
}
- else {log_verbose("PASS: creating dateformat using udat_openPattern() succesful\n");}
+ else {
+ log_verbose("PASS: creating dateformat using udat_openPattern() succesful\n");
- u_uastrcpy(pattern, "dd-MMM-yy h:mm:ss 'o''clock' a z");
- fmt= udat_open(UDAT_IGNORE,UDAT_IGNORE,"en_US", NULL, 0,pattern, u_strlen(pattern), &status);
-
-
- s=(UChar*)malloc(sizeof(UChar) * (strlen("03-Apr-04 2:20:47 o'clock AM PST")+1) );
- u_uastrcpy(s, "03-Apr-04 2:20:47 o'clock AM PST");
- pos=0;
- d = udat_parse(fmt, s, u_strlen(s), &pos, &status);
- if (U_FAILURE(status)) {
- log_err("FAIL: Could not parse \"%s\"\n", austrdup(s));
- } else {
- UCalendar *cal = ucal_open(NULL, 0, uloc_getDefault(), UCAL_TRADITIONAL, &status);
+ u_uastrcpy(pattern, "dd-MMM-yy h:mm:ss 'o''clock' a z");
+ fmt= udat_open(UDAT_IGNORE,UDAT_IGNORE,"en_US", NULL, 0,pattern, u_strlen(pattern), &status);
+
+
+ s=(UChar*)malloc(sizeof(UChar) * (strlen("03-Apr-04 2:20:47 o'clock AM PST")+1) );
+ u_uastrcpy(s, "03-Apr-04 2:20:47 o'clock AM PST");
+ pos=0;
+ d = udat_parse(fmt, s, u_strlen(s), &pos, &status);
if (U_FAILURE(status)) {
- log_err("FAIL: Could not open calendar");
+ log_err("FAIL: Could not parse \"%s\"\n", austrdup(s));
} else {
- int32_t h;
- ucal_setMillis(cal, d, &status);
- h = ucal_get(cal, UCAL_HOUR_OF_DAY, &status);
+ UCalendar *cal = ucal_open(NULL, 0, uloc_getDefault(), UCAL_TRADITIONAL, &status);
if (U_FAILURE(status)) {
- log_err("FAIL: Some calendar operations failed");
- } else if (h != 2) {
- log_err("FAIL: Parse of \"%s\" returned HOUR_OF_DAY %d\n",
- austrdup(s), h);
+ log_err_status(status, "FAIL: Could not open calendar: %s\n", u_errorName(status));
+ } else {
+ int32_t h;
+ ucal_setMillis(cal, d, &status);
+ h = ucal_get(cal, UCAL_HOUR_OF_DAY, &status);
+ if (U_FAILURE(status)) {
+ log_err("FAIL: Some calendar operations failed");
+ } else if (h != 2) {
+ log_err("FAIL: Parse of \"%s\" returned HOUR_OF_DAY %d\n",
+ austrdup(s), h);
+ }
+ ucal_close(cal);
}
- ucal_close(cal);
}
+
+ udat_close(fullFmt);
+ udat_close(fmt);
+ free(s);
}
-
- udat_close(fullFmt);
- udat_close(fmt);
free(pattern);
- free(s);
ctest_resetTimeZone();
}
@@ -121,7 +123,7 @@
/* f = udat_open(UDAT_DEFAULT, UDAT_SHORT, NULL, NULL, 0, &status); */
f = udat_open(UDAT_DEFAULT, UDAT_SHORT, "en_US", NULL, 0, NULL, 0,&status);
if(U_FAILURE(status)){
- log_err("FAIL: ErrorCode received during test: %s\n", myErrorName(status));
+ log_data_err("FAIL: ErrorCode received during test: %s (Are you missing data?)\n", myErrorName(status));
return;
}
s=(UChar*)malloc(sizeof(UChar) * (strlen("01/01/1997 10:11:42 AM")+1) );
@@ -200,7 +202,7 @@
u_uastrcpy(pattern, "yyyyMMddHHmmssSSS");
format = udat_open(UDAT_IGNORE, UDAT_IGNORE, NULL, NULL, 0,pattern, u_strlen(pattern), &status);
if(U_FAILURE(status)){
- log_err("FAIL: Error in date format construction with pattern: %s\n", myErrorName(status));
+ log_err_status(status, "FAIL: Error in date format construction with pattern: %s\n", myErrorName(status));
return;
}
date1 = ucal_getNow();
@@ -236,7 +238,7 @@
ctest_setTimeZone(NULL, &status);
fmt = udat_open(UDAT_FULL, UDAT_FULL, "cs", NULL, 0, NULL, 0, &status);
if(U_FAILURE(status)){
- log_err("Error in constructing the date format\n");
+ log_data_err("Error in constructing the date format -> %s (Are you missing data?)\n", u_errorName(status));
ctest_resetTimeZone();
return;
}
@@ -316,7 +318,7 @@
/* format= udat_openPattern(pattern, u_strlen(pattern), NULL, &status); */
format= udat_open(UDAT_IGNORE, UDAT_IGNORE,"en_US", NULL, 0,pattern, u_strlen(pattern), &status);
if(U_FAILURE(status)){
- log_err("error in udat_open: %s\n", myErrorName(status));
+ log_err_status(status, "error in udat_open: %s\n", myErrorName(status));
return;
}
tzID=(UChar*)malloc(sizeof(UChar) * 4);
diff --git a/test/cintltst/cdtrgtst.c b/test/cintltst/cdtrgtst.c
index 63b2b11..d825489 100644
--- a/test/cintltst/cdtrgtst.c
+++ b/test/cintltst/cdtrgtst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -63,7 +63,7 @@
df = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,"en_US", NULL, 0, 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));
+ log_data_err("FAIL: error in creating the dateformat using default date and time style : %s (Are you missing data?)\n", myErrorName(status));
return;
}
resultlength=0;
@@ -162,7 +162,7 @@
def = udat_open(UDAT_IGNORE,UDAT_IGNORE,NULL, NULL, 0, pat, u_strlen(pat), &status);
if(U_FAILURE(status))
{
- log_err("FAIL: error in creating the dateformat using u_openPattern(): %s\n", myErrorName(status));
+ log_err_status(status, "FAIL: error in creating the dateformat using u_openPattern(): %s\n", myErrorName(status));
return;
}
start = 1800;
@@ -213,7 +213,7 @@
def = udat_open(UDAT_IGNORE,UDAT_IGNORE,NULL,tzID,-1,pattern, u_strlen(pattern),&status);
if(U_FAILURE(status))
{
- log_err("FAIL: error in creating the dateformat using openPattern: %s\n", myErrorName(status));
+ log_err_status(status, "FAIL: error in creating the dateformat using openPattern: %s\n", myErrorName(status));
return;
}
myDate=(UChar*)malloc(sizeof(UChar) * 11);
@@ -292,7 +292,7 @@
fmt = udat_open(UDAT_FULL,UDAT_LONG ,NULL, tzID, -1, NULL, 0, &status);
if(U_FAILURE(status))
{
- log_err("FAIL: error in creating the dateformat using default date and time style: %s\n",
+ log_err_status(status, "FAIL: error in creating the dateformat using default date and time style: %s\n",
myErrorName(status) );
return;
}
@@ -330,7 +330,7 @@
log_verbose("Testing parsing by changing the attribute lenient\n");
df = udat_open(UDAT_IGNORE,UDAT_IGNORE,NULL,NULL,0,pattern, u_strlen(pattern),&status);
if(U_FAILURE(status)){
- log_err("ERROR: failure in open pattern of test4061287: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: failure in open pattern of test4061287: %s\n", myErrorName(status));
return;
}
@@ -385,7 +385,7 @@
fmt= udat_open(UDAT_SHORT,UDAT_SHORT ,NULL, NULL, 0, NULL, 0, &status);
if(U_FAILURE(status))
{
- log_err("FAIL: error in creating the dateformat using short date and time style: %s\n",
+ log_data_err("FAIL: error in creating the dateformat using short date and time style: %s (Are you missing data?)\n",
myErrorName(status));
return;
}
@@ -478,7 +478,7 @@
fmt= udat_open(UDAT_MEDIUM,UDAT_NONE ,"en_US_CA", NULL, -1, NULL, 0, &status);
if(U_FAILURE(status))
{
- log_err("FAIL: error in creating the dateformat using medium time style and NO date style: %s\n",
+ log_data_err("FAIL: error in creating the dateformat using medium time style and NO date style: %s (Are you missing data?)\n",
myErrorName(status));
return;
}
@@ -578,7 +578,7 @@
}
udat_close(dtfmt);
} else {
- log_err("FAIL: udat_open fails: %s\n", myErrorName(status));
+ log_data_err("FAIL: udat_open fails: %s (Are you missing data?)\n", myErrorName(status));
}
}
diff --git a/test/cintltst/cestst.c b/test/cintltst/cestst.c
index 650143f..29ebc4a 100644
--- a/test/cintltst/cestst.c
+++ b/test/cintltst/cestst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -89,7 +89,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("es_ES", &status);
if(U_FAILURE(status)){
- log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
+ log_err_status(status, "ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
return;
}
log_verbose("Testing Spanish Collation with Tertiary strength\n");
@@ -108,7 +108,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("es_ES", &status);
if(U_FAILURE(status)){
- log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
+ log_err_status(status, "ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status));
return;
}
log_verbose("Testing Spanish Collation with Primary strength\n");
diff --git a/test/cintltst/cfintst.c b/test/cintltst/cfintst.c
index 3ab68df..1bc8cfd 100644
--- a/test/cintltst/cfintst.c
+++ b/test/cintltst/cfintst.c
@@ -1,5 +1,5 @@
/********************************************************************
- * Copyright (c) 1997-2007, International Business Machines
+ * Copyright (c) 1997-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************
*
@@ -80,7 +80,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("fi_FI@collation=standard", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
}
log_verbose("Testing Finnish Collation with Tertiary strength\n");
ucol_setStrength(myCollation, UCOL_TERTIARY);
@@ -98,7 +98,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("fi_FI@collation=standard", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
}
log_verbose("Testing Finnish Collation with Tertiary strength\n");
ucol_setStrength(myCollation, UCOL_PRIMARY);
diff --git a/test/cintltst/cfrtst.c b/test/cintltst/cfrtst.c
index 63a0128..0093bc8 100644
--- a/test/cintltst/cfrtst.c
+++ b/test/cintltst/cfrtst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2007, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -147,7 +147,7 @@
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));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
@@ -172,7 +172,7 @@
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));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
ucol_setAttribute(myCollation, UCOL_STRENGTH, UCOL_SECONDARY, &status);
@@ -202,7 +202,7 @@
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));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
log_verbose("Testing French Collation extra with secondary strength\n");
@@ -314,7 +314,7 @@
pCollator = ucol_openFromShortString("LFR_AN_CX_EX_FO_HX_NX_S3", 0, NULL, &status);
if (U_FAILURE(status)) {
- log_err("error opening collator\n");
+ log_data_err("error opening collator -> %s. (Are you missing data?)\n", u_errorName(status));
return;
}
diff --git a/test/cintltst/cg7coll.c b/test/cintltst/cg7coll.c
index 89802d9..9ad3e9f 100644
--- a/test/cintltst/cg7coll.c
+++ b/test/cintltst/cg7coll.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -150,7 +150,7 @@
if (U_FAILURE(status))
{
- log_err("Error in creating collator in %s: %s\n", locales[i], myErrorName(status));
+ log_err_status(status, "Error in creating collator in %s: %s\n", locales[i], myErrorName(status));
continue;
}
@@ -161,7 +161,7 @@
if (U_FAILURE(status))
{
ucol_close(myCollation);
- log_err("Error in creating collator in %s: %s\n", locales[i], myErrorName(status));
+ log_err_status(status, "Error in creating collator in %s: %s\n", locales[i], myErrorName(status));
continue;
}
@@ -200,7 +200,7 @@
if (U_FAILURE(status))
{
- log_err( "Demo Test 1 Rule collation object creation failed. : %s\n", myErrorName(status));
+ log_err_status(status, "Demo Test 1 Rule collation object creation failed. : %s\n", myErrorName(status));
return;
}
@@ -231,7 +231,7 @@
if (U_FAILURE(status))
{
- log_err( "Demo Test 2 Rule collation object creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "Demo Test 2 Rule collation object creation failed.: %s\n", myErrorName(status));
return;
}
for (j = 0; j < TOTALTESTSET; j++)
@@ -260,7 +260,7 @@
if (U_FAILURE(status))
{
- log_err( "Demo Test 3 Rule collation object creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "Demo Test 3 Rule collation object creation failed.: %s\n", myErrorName(status));
return;
}
@@ -290,7 +290,7 @@
if (U_FAILURE(status))
{
- log_err( "Demo Test 4 Rule collation object creation failed.: %s\n", myErrorName(status));
+ log_err_status(status, "Demo Test 4 Rule collation object creation failed.: %s\n", myErrorName(status));
return;
}
for (j = 0; j < TOTALTESTSET; j++)
diff --git a/test/cintltst/cintltst.c b/test/cintltst/cintltst.c
index e7cb912..40c9174 100644
--- a/test/cintltst/cintltst.c
+++ b/test/cintltst/cintltst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -441,7 +441,7 @@
free(dataDir);
u_init(&status);
if (U_FAILURE(status)) {
- log_err("u_init failed with %s\n", u_errorName(status));
+ log_err_status(status, "u_init failed with %s\n", u_errorName(status));
return FALSE;
}
return TRUE;
@@ -560,7 +560,7 @@
optionalTimeZone = "America/Los_Angeles";
}
if (gOriginalTimeZone[0]) {
- log_err("*** Error: time zone saved twice. New value will be %s\n",
+ log_data_err("*** Error: time zone saved twice. New value will be %s (Are you missing data?)\n",
optionalTimeZone);
}
ucal_getDefaultTimeZone(gOriginalTimeZone, CTEST_MAX_TIMEZONE_SIZE, status);
@@ -637,7 +637,7 @@
U_CFUNC UBool assertSuccess(const char* msg, UErrorCode* ec) {
U_ASSERT(ec!=NULL);
if (U_FAILURE(*ec)) {
- log_err("FAIL: %s (%s)\n", msg, u_errorName(*ec));
+ log_err_status(*ec, "FAIL: %s (%s)\n", msg, u_errorName(*ec));
return FALSE;
}
return TRUE;
diff --git a/test/cintltst/citertst.c b/test/cintltst/citertst.c
index d802502..ef93718 100644
--- a/test/cintltst/citertst.c
+++ b/test/cintltst/citertst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -80,7 +80,7 @@
UCollationElements *titer = ucol_openElements(coll, text, -1,
&status);
if (U_FAILURE(status)) {
- log_err("ERROR: in creation of either the collator or the collation iterator :%s\n",
+ log_err_status(status, "ERROR: in creation of either the collator or the collation iterator :%s\n",
myErrorName(status));
return;
}
@@ -156,7 +156,7 @@
pitr = ucol_openElements(coll, pattern, -1, &status);
titer = ucol_openElements(coll, text, -1, &status);
if (U_FAILURE(status)) {
- log_err("ERROR: in creation of either the collator or the collation iterator :%s\n",
+ log_err_status(status, "ERROR: in creation of either the collator or the collation iterator :%s\n",
myErrorName(status));
return;
}
@@ -226,7 +226,7 @@
UChar *test;
en_us = ucol_open("en_US", &status);
if (U_FAILURE(status)){
- log_err("ERROR: in creation of collation data using ucol_open()\n %s\n",
+ log_err_status(status, "ERROR: in creation of collation data using ucol_open()\n %s\n",
myErrorName(status));
return;
}
@@ -293,7 +293,7 @@
/* thai should have normalization on */
th_th = ucol_open("th_TH", &status);
if (U_FAILURE(status)){
- log_err("ERROR: in creation of thai collation using ucol_open()\n %s\n",
+ log_err_status(status, "ERROR: in creation of thai collation using ucol_open()\n %s\n",
myErrorName(status));
return;
}
@@ -369,7 +369,7 @@
coll = ucol_openRules(rule, rulelen, UCOL_ON, UCOL_TERTIARY, NULL, &status);
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
if (U_FAILURE(status)){
- log_err("ERROR: in creation of collator using ucol_openRules()\n %s\n",
+ log_err_status(status, "ERROR: in creation of collator using ucol_openRules()\n %s\n",
myErrorName(status));
return;
}
@@ -434,7 +434,7 @@
iter=ucol_openElements(coll, test1, u_strlen(test1), &status);
log_verbose("English locale testing back and forth\n");
if(U_FAILURE(status)){
- log_err("ERROR: in creation of collation element iterator using ucol_openElements()\n %s\n",
+ log_err_status(status, "ERROR: in creation of collation element iterator using ucol_openElements()\n %s\n",
myErrorName(status));
ucol_close(coll);
return;
@@ -574,7 +574,7 @@
log_verbose("Testing getOffset and setOffset for collations\n");
iter = ucol_openElements(en_us, test1, u_strlen(test1), &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of collation element iterator using ucol_openElements()\n %s\n",
+ log_err_status(status, "ERROR: in creation of collation element iterator using ucol_openElements()\n %s\n",
myErrorName(status));
ucol_close(en_us);
return;
@@ -716,7 +716,7 @@
log_verbose("testing setText for Collation elements\n");
iter1=ucol_openElements(en_us, test1, u_strlen(test1), &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of collation element iterator1 using ucol_openElements()\n %s\n",
+ log_err_status(status, "ERROR: in creation of collation element iterator1 using ucol_openElements()\n %s\n",
myErrorName(status));
ucol_close(en_us);
return;
@@ -905,7 +905,7 @@
ucol_closeElements(iter);
ucol_close(coll);
} else {
- log_data_err("Couldn't open collator\n");
+ log_err_status(status, "Couldn't open collator -> %s\n", u_errorName(status));
}
}
@@ -1007,7 +1007,7 @@
ucol_closeElements(iter);
ucol_close(coll);
} else {
- log_data_err("Couldn't open collator\n");
+ log_err_status(status, "Couldn't open collator -> %s\n", u_errorName(status));
}
}
@@ -1277,7 +1277,7 @@
UChar contextCPs[5];
if (U_FAILURE(status)) {
- log_err("Error in opening root collator\n");
+ log_err_status(status, "Error in opening root collator -> %s\n", u_errorName(status));
return;
}
@@ -1410,7 +1410,7 @@
resultiter = ucol_openElements(coll, rule, 1, &status);
if (U_FAILURE(status)) {
- log_err("Error opening collation rules\n");
+ log_err_status(status, "Error opening collation rules -> %s\n", u_errorName(status));
return;
}
@@ -1480,7 +1480,7 @@
u_uastrcpy(rule, "&z < AB");
coll = ucol_openRules(rule, u_strlen(rule), UCOL_OFF, UCOL_DEFAULT_STRENGTH, NULL,&status);
if (U_FAILURE(status)) {
- log_err("Rule based collator not created for testing ce buffer overflow\n");
+ log_err_status(status, "Rule based collator not created for testing ce buffer overflow -> %s\n", u_errorName(status));
return;
}
@@ -1661,7 +1661,7 @@
UChar contextCPs[3];
UParseError parseError;
if (U_FAILURE(status)) {
- log_err("en_US collator creation failed\n");
+ log_err_status(status, "en_US collator creation failed -> %s\n", u_errorName(status));
return;
}
log_verbose("Testing UCA elements\n");
@@ -1858,7 +1858,7 @@
UChar contextCPs[5];
UParseError parseError;
if (U_FAILURE(status)) {
- log_err("en_US collator creation failed\n");
+ log_err_status(status, "en_US collator creation failed -> %s\n", u_errorName(status));
return;
}
log_verbose("Testing UCA elements\n");
diff --git a/test/cintltst/cjaptst.c b/test/cintltst/cjaptst.c
index 7318e07..4bce456 100644
--- a/test/cintltst/cjaptst.c
+++ b/test/cintltst/cjaptst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -119,7 +119,7 @@
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));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
log_verbose("Testing Kanna(Japan) Collation with Tertiary strength\n");
@@ -140,7 +140,7 @@
myCollation = ucol_open("ja_JP", &status);
if (U_FAILURE(status))
{
- log_err("ERROR: in creation of rule based collator: %s\n",
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n",
myErrorName(status));
return;
}
@@ -161,7 +161,7 @@
myCollation = ucol_open("ja_JP", &status);
if (U_FAILURE(status))
{
- log_err("ERROR: in creation of rule based collator: %s\n",
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n",
myErrorName(status));
return;
}
@@ -185,7 +185,7 @@
myCollation = ucol_open("ja_JP", &status);
if (U_FAILURE(status))
{
- log_err("ERROR: in creation of rule based collator: %s\n",
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n",
myErrorName(status));
return;
}
@@ -210,7 +210,7 @@
myCollation = ucol_open("ja_JP", &status);
if (U_FAILURE(status))
{
- log_err("ERROR: in creation of rule based collator: %s\n",
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n",
myErrorName(status));
return;
}
@@ -236,7 +236,7 @@
myCollation = ucol_open("ja_JP", &status);
if (U_FAILURE(status))
{
- log_err("ERROR: in creation of rule based collator: %s\n",
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n",
myErrorName(status));
return;
}
diff --git a/test/cintltst/cloctst.c b/test/cintltst/cloctst.c
index 8f7b2e8..4e0a860 100644
--- a/test/cintltst/cloctst.c
+++ b/test/cintltst/cloctst.c
@@ -577,7 +577,7 @@
length=uloc_getDisplayLanguage(NULL, NULL, buffer, LENGTHOF(buffer), &errorCode);
if(U_FAILURE(errorCode) || (length<=3 && buffer[0]<=0x7f)) {
/* check <=3 to reject getting the language code as a display name */
- log_err("unable to get a display string for the language of the default locale - %s\n", u_errorName(errorCode));
+ log_data_err("unable to get a display string for the language of the default locale - %s (Are you missing data?)\n", u_errorName(errorCode));
}
/* test that we get the language code itself for an unknown language, and a default warning */
@@ -615,7 +615,7 @@
} else {
expectBuffer = CharsToUChars(expect[i]);
if(u_strcmp(buffer,expectBuffer)) {
- log_err("FAIL in uloc_getDisplayName(%s,%s,..) expected '%s' got '%s'\n", aLocale, testL[i], expect[i], austrdup(buffer));
+ log_data_err("FAIL in uloc_getDisplayName(%s,%s,..) expected '%s' got '%s' (Are you missing data?)\n", aLocale, testL[i], expect[i], austrdup(buffer));
} else {
log_verbose("pass in uloc_getDisplayName(%s,%s,..) got '%s'\n", aLocale, testL[i], expect[i]);
}
@@ -828,23 +828,23 @@
expectedName=dataTable[DNAME_EN][i];
if (0 !=u_strcmp(testLang,expectedLang)) {
- log_data_err(" Display Language mismatch: got %s expected %s displayLocale=%s\n", austrdup(testLang), austrdup(expectedLang), displayLocale);
+ log_data_err(" Display Language mismatch: got %s expected %s displayLocale=%s (Are you missing data?)\n", austrdup(testLang), austrdup(expectedLang), displayLocale);
}
if (0 != u_strcmp(testScript,expectedScript)) {
- log_data_err(" Display Script mismatch: got %s expected %s displayLocale=%s\n", austrdup(testScript), austrdup(expectedScript), displayLocale);
+ log_data_err(" Display Script mismatch: got %s expected %s displayLocale=%s (Are you missing data?)\n", austrdup(testScript), austrdup(expectedScript), displayLocale);
}
if (0 != u_strcmp(testCtry,expectedCtry)) {
- log_data_err(" Display Country mismatch: got %s expected %s displayLocale=%s\n", austrdup(testCtry), austrdup(expectedCtry), displayLocale);
+ log_data_err(" Display Country mismatch: got %s expected %s displayLocale=%s (Are you missing data?)\n", austrdup(testCtry), austrdup(expectedCtry), displayLocale);
}
if (0 != u_strcmp(testVar,expectedVar)) {
- log_data_err(" Display Variant mismatch: got %s expected %s displayLocale=%s\n", austrdup(testVar), austrdup(expectedVar), displayLocale);
+ log_data_err(" Display Variant mismatch: got %s expected %s displayLocale=%s (Are you missing data?)\n", austrdup(testVar), austrdup(expectedVar), displayLocale);
}
if(0 != u_strcmp(testName, expectedName)) {
- log_data_err(" Display Name mismatch: got %s expected %s displayLocale=%s\n", austrdup(testName), austrdup(expectedName), displayLocale);
+ log_data_err(" Display Name mismatch: got %s expected %s displayLocale=%s (Are you missing data?)\n", austrdup(testName), austrdup(expectedName), displayLocale);
}
if(testName!=&_NUL) {
@@ -1170,7 +1170,11 @@
}
u_uastrcpy(displayName, dispName);
if(u_strcmp(got,displayName)!=0) {
- log_err("FAIL: getDisplayName() Wanted %s, got %s\n", dispName, austrdup(got));
+ if (status == U_USING_DEFAULT_WARNING) {
+ log_data_err("FAIL: getDisplayName() got %s. Perhaps you are missing data?\n", u_errorName(status));
+ } else {
+ log_err("FAIL: getDisplayName() Wanted %s, got %s\n", dispName, austrdup(got));
+ }
}
size=0;
@@ -1919,7 +1923,11 @@
break;
}
if(u_strncmp(displayKeyword, testCases[i].displayKeyword, displayKeywordLen)!=0){
- log_err("uloc_getDisplayKeyword did not get the expected value for keyword : %s in locale id: %s for display locale: %s \n", testCases[i].localeID, keyword, testCases[i].displayLocale);
+ if (status == U_USING_DEFAULT_WARNING) {
+ log_data_err("uloc_getDisplayKeyword did not get the expected value for keyword : %s in locale id: %s for display locale: %s . Got error: %s. Perhaps you are missing data?\n", testCases[i].localeID, keyword, testCases[i].displayLocale, u_errorName(status));
+ } else {
+ log_err("uloc_getDisplayKeyword did not get the expected value for keyword : %s in locale id: %s for display locale: %s \n", testCases[i].localeID, keyword, testCases[i].displayLocale);
+ }
break;
}
}else{
@@ -1998,7 +2006,11 @@
break;
}
if(u_strncmp(displayKeywordValue, testCases[i].displayKeywordValue, displayKeywordValueLen)!=0){
- log_err("uloc_getDisplayKeywordValue did not return the expected value keyword : %s in locale id: %s for display locale: %s with error : %s \n", testCases[i].localeID, keyword, testCases[i].displayLocale, u_errorName(status));
+ if (status == U_USING_DEFAULT_WARNING) {
+ log_data_err("uloc_getDisplayKeywordValue did not return the expected value keyword : %s in locale id: %s for display locale: %s with error : %s Perhaps you are missing data\n", testCases[i].localeID, keyword, testCases[i].displayLocale, u_errorName(status));
+ } else {
+ log_err("uloc_getDisplayKeywordValue did not return the expected value keyword : %s in locale id: %s for display locale: %s with error : %s \n", testCases[i].localeID, keyword, testCases[i].displayLocale, u_errorName(status));
+ }
break;
}
}else{
@@ -2047,7 +2059,11 @@
break;
}
if(u_strncmp(displayKeywordValue, expected[keywordCount], displayKeywordValueLen)!=0){
- log_err("uloc_getDisplayKeywordValue did not return the expected value keyword : %s in locale id: %s for display locale: %s \n", localeID, keyword, displayLocale);
+ if (status == U_USING_DEFAULT_WARNING) {
+ log_data_err("uloc_getDisplayKeywordValue did not return the expected value keyword : %s in locale id: %s for display locale: %s got error: %s. Perhaps you are missing data?\n", localeID, keyword, displayLocale, u_errorName(status));
+ } else {
+ log_err("uloc_getDisplayKeywordValue did not return the expected value keyword : %s in locale id: %s for display locale: %s \n", localeID, keyword, displayLocale);
+ }
break;
}
}else{
@@ -2167,7 +2183,7 @@
NULL, 0,
NULL, 0, &ec);
if (U_FAILURE(ec)) {
- log_err("udat_open failed.Error %s\n", u_errorName(ec));
+ log_data_err("udat_open failed.Error %s\n", u_errorName(ec));
return;
}
valid = udat_getLocaleByType(obj, ULOC_VALID_LOCALE, &ec);
@@ -2324,7 +2340,7 @@
UErrorCode ec = U_ZERO_ERROR;
ULocaleData *uld = ulocdata_open("qqq",&ec);
if (ec != U_USING_DEFAULT_WARNING) {
- log_err("Exemplar set for \"qqq\", expecting U_USING_DEFAULT_WARNING, but got %s\n",
+ log_err_status(ec, "Exemplar set for \"qqq\", expecting U_USING_DEFAULT_WARNING, but got %s\n",
u_errorName(ec));
}
uset_close(ulocdata_getExemplarSet(uld, NULL, 0, ULOCDATA_ES_STANDARD, &ec));
@@ -2349,7 +2365,7 @@
ULocaleData *uld = ulocdata_open("en_US",&ec);
uset_close(ulocdata_getExemplarSet(uld, NULL, 0, ULOCDATA_ES_STANDARD, &ec));
if (ec != U_USING_FALLBACK_WARNING) {
- log_err("Exemplar set for \"en_US\", expecting U_USING_FALLBACK_WARNING, but got %s\n",
+ log_err_status(ec, "Exemplar set for \"en_US\", expecting U_USING_FALLBACK_WARNING, but got %s\n",
u_errorName(ec));
}
ulocdata_close(uld);
@@ -2357,7 +2373,7 @@
uld = ulocdata_open("en",&ec);
uset_close(ulocdata_getExemplarSet(uld, NULL, 0, ULOCDATA_ES_STANDARD, &ec));
if (ec != U_ZERO_ERROR) {
- log_err("Exemplar set for \"en\", expecting U_ZERO_ERROR, but got %s\n",
+ log_err_status(ec, "Exemplar set for \"en\", expecting U_ZERO_ERROR, but got %s\n",
u_errorName(ec));
}
ulocdata_close(uld);
@@ -2423,14 +2439,14 @@
uenum_close(available);
log_verbose(" got %s, %s [%s]\n", tmp[0]?tmp:"(EMPTY)", acceptResult(outResult), u_errorName(status));
if(outResult != tests[i].res) {
- log_err("FAIL: #%d: expected outResult of %s but got %s\n", i,
+ log_err_status(status, "FAIL: #%d: expected outResult of %s but got %s\n", i,
acceptResult( tests[i].res),
acceptResult( outResult));
log_info("test #%d: http[%s], ICU[%s], expect %s, %s\n",
i, http[tests[i].httpSet], tests[i].icuSet, tests[i].expect,acceptResult(tests[i].res));
}
if((outResult>0)&&uprv_strcmp(tmp, tests[i].expect)) {
- log_err("FAIL: #%d: expected %s but got %s\n", i, tests[i].expect, tmp);
+ log_err_status(status, "FAIL: #%d: expected %s but got %s\n", i, tests[i].expect, tmp);
log_info("test #%d: http[%s], ICU[%s], expect %s, %s\n",
i, http[tests[i].httpSet], tests[i].icuSet, tests[i].expect, acceptResult(tests[i].res));
}
@@ -2467,7 +2483,7 @@
UErrorCode status = U_ZERO_ERROR;
UResourceBundle *resIndex = ures_open(NULL,"res_index", &status);
if(U_FAILURE(status)){
- log_err("Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
+ log_err_status(status, "Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
return;
}
for (i=0; i<LENGTHOF(LOCALE_ALIAS); i++) {
@@ -2503,7 +2519,7 @@
UErrorCode status = U_ZERO_ERROR;
UResourceBundle *resIndex = ures_open(NULL,"res_index", &status);
if(U_FAILURE(status)){
- log_err("Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
+ log_err_status(status, "Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
return;
}
for (i=0; i<LENGTHOF(LOCALE_ALIAS); i++) {
@@ -2546,7 +2562,7 @@
UErrorCode status = U_ZERO_ERROR;
UResourceBundle *resIndex = ures_open(NULL,"res_index", &status);
if(U_FAILURE(status)){
- log_err("Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
+ log_err_status(status, "Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
return;
}
for (i=0; i<LENGTHOF(LOCALE_ALIAS); i++) {
@@ -2637,7 +2653,7 @@
const ULayoutType lo = uloc_getLineOrientation(localeId, &statusLO);
const ULayoutType expectedLO = toTest[i].line;
if (U_FAILURE(statusCO)) {
- log_err(
+ log_err_status(statusCO,
" unexpected failure for uloc_getCharacterOrientation(), with localId \"%s\" and status %s\n",
localeId,
u_errorName(statusCO));
@@ -2650,7 +2666,7 @@
ULayoutTypeToString(co));
}
if (U_FAILURE(statusLO)) {
- log_err(
+ log_err_status(statusLO,
" unexpected failure for uloc_getLineOrientation(), with localId \"%s\" and status %s\n",
localeId,
u_errorName(statusLO));
@@ -2670,7 +2686,7 @@
UErrorCode status = U_ZERO_ERROR;
UResourceBundle *resIndex = ures_open(NULL,"res_index", &status);
if(U_FAILURE(status)){
- log_err("Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
+ log_err_status(status, "Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
return;
}
for (i=0; i<LENGTHOF(LOCALE_ALIAS); i++) {
@@ -5196,7 +5212,7 @@
sizeof(buffer),
&status);
if (U_FAILURE(status)) {
- log_err(" unexpected failure of uloc_addLikelySubtags(), minimal \"%s\" status %s\n", minimal, u_errorName(status));
+ log_err_status(status, " unexpected failure of uloc_addLikelySubtags(), minimal \"%s\" status %s\n", minimal, u_errorName(status));
status = U_ZERO_ERROR;
}
else if (uprv_strlen(maximal) == 0) {
@@ -5223,7 +5239,7 @@
&status);
if (U_FAILURE(status)) {
- log_err(" unexpected failure of uloc_MinimizeSubtags(), maximal \"%s\" status %s\n", maximal, u_errorName(status));
+ log_err_status(status, " unexpected failure of uloc_MinimizeSubtags(), maximal \"%s\" status %s\n", maximal, u_errorName(status));
status = U_ZERO_ERROR;
}
else if (uprv_strlen(minimal) == 0) {
@@ -5249,7 +5265,7 @@
sizeof(buffer),
&status);
if (U_FAILURE(status)) {
- log_err(" unexpected failure of uloc_addLikelySubtags(), minimal \"%s\" status \"%s\"\n", minimal, u_errorName(status));
+ log_err_status(status, " unexpected failure of uloc_addLikelySubtags(), minimal \"%s\" status \"%s\"\n", minimal, u_errorName(status));
status = U_ZERO_ERROR;
}
else if (uprv_strlen(maximal) == 0) {
@@ -5278,7 +5294,7 @@
&status);
if (U_FAILURE(status)) {
- log_err(" unexpected failure of uloc_minimizeSubtags(), maximal \"%s\" status %s\n", maximal, u_errorName(status));
+ log_err_status(status, " unexpected failure of uloc_minimizeSubtags(), maximal \"%s\" status %s\n", maximal, u_errorName(status));
status = U_ZERO_ERROR;
}
else if (uprv_strlen(minimal) == 0) {
@@ -5313,7 +5329,7 @@
status = U_ZERO_ERROR;
}
else if (status != expectedStatus) {
- log_err(" unexpected status for uloc_addLikelySubtags(), minimal \"%s\" expected status %s, but got %s\n", minimal, u_errorName(expectedStatus), u_errorName(status));
+ log_err_status(status, " unexpected status for uloc_addLikelySubtags(), minimal \"%s\" expected status %s, but got %s\n", minimal, u_errorName(expectedStatus), u_errorName(status));
}
else if (length != expectedLength) {
log_err(" unexpected length for uloc_addLikelySubtags(), minimal \"%s\" expected length %d, but got %d\n", minimal, expectedLength, length);
@@ -5347,7 +5363,7 @@
status = U_ZERO_ERROR;
}
else if (status != expectedStatus) {
- log_err(" unexpected status for uloc_minimizeSubtags(), maximal \"%s\" expected status %s, but got %s\n", maximal, u_errorName(expectedStatus), u_errorName(status));
+ log_err_status(status, " unexpected status for uloc_minimizeSubtags(), maximal \"%s\" expected status %s, but got %s\n", maximal, u_errorName(expectedStatus), u_errorName(status));
}
else if (length != expectedLength) {
log_err(" unexpected length for uloc_minimizeSubtags(), maximal \"%s\" expected length %d, but got %d\n", maximal, expectedLength, length);
@@ -5422,7 +5438,7 @@
log_err("Error should be returned by uloc_toLanguageTag for locale id [%s], but [%s] is returned without errors\n",
inloc, langtag);
} else if (uprv_strcmp(langtag, expected) != 0) {
- log_err("uloc_toLanguageTag returned language tag [%s] for input locale [%s] - expected: [%s]\n",
+ log_data_err("uloc_toLanguageTag returned language tag [%s] for input locale [%s] - expected: [%s]. Are you missing data?\n",
langtag, inloc, expected);
}
}
@@ -5435,7 +5451,7 @@
len = uloc_toLanguageTag(inloc, langtag, sizeof(langtag), TRUE, &status);
if (U_FAILURE(status)) {
if (expected != NULL) {
- log_err("Error returned by uloc_toLanguageTag {strict} for locale id [%s] - error: %s\n",
+ log_data_err("Error returned by uloc_toLanguageTag {strict} for locale id [%s] - error: %s Are you missing data?\n",
inloc, u_errorName(status));
}
} else {
@@ -5501,7 +5517,7 @@
locale[0] = 0;
uloc_forLanguageTag(langtag_to_locale[i].bcpID, locale, sizeof(locale), &parsedLen, &status);
if (U_FAILURE(status)) {
- log_err("Error returned by uloc_forLanguageTag for language tag [%s] - error: %s\n",
+ log_err_status(status, "Error returned by uloc_forLanguageTag for language tag [%s] - error: %s\n",
langtag_to_locale[i].bcpID, u_errorName(status));
} else {
if (uprv_strcmp(langtag_to_locale[i].locID, locale) != 0) {
diff --git a/test/cintltst/cmsccoll.c b/test/cintltst/cmsccoll.c
index 07e0e09..0fbbd5d 100644
--- a/test/cintltst/cmsccoll.c
+++ b/test/cintltst/cmsccoll.c
@@ -263,7 +263,7 @@
UCollator *myCollation;
myCollation = ucol_open("en_US", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
log_verbose("Testing some A letters, for some reason\n");
@@ -1319,7 +1319,7 @@
UCollator *UCA = ucol_open("", &status);
UColAttributeValue oldStrength = ucol_getAttribute(UCA, UCOL_STRENGTH, &status);
if (U_FAILURE(status)) {
- log_err("Could not open UCA collator %s\n", u_errorName(status));
+ log_err_status(status, "Could not open UCA collator %s\n", u_errorName(status));
return;
}
ucol_setAttribute(UCA, UCOL_STRENGTH, UCOL_QUATERNARY, &status);
@@ -1445,13 +1445,13 @@
ucol_close(coll);
}
else {
- log_err("Can't tailor rules");
+ log_err_status(status, "Can't tailor rules\n");
}
/* Code coverage */
status = U_ZERO_ERROR;
coll = ucol_open("ja", &status);
if(!ucol_isTailored(coll, 0x4E9C, &status)) {
- log_err("0x4E9C should be tailored - it is reported as not\n");
+ log_err_status(status, "0x4E9C should be tailored - it is reported as not\n");
}
ucol_close(coll);
}
@@ -1625,11 +1625,8 @@
noOfLoc = uloc_countAvailable();
coll = ucol_open("", &status);
- if(status == U_FILE_ACCESS_ERROR) {
- log_data_err("Is your data around?\n");
- return;
- } else if(U_FAILURE(status)) {
- log_err("Error opening collator\n");
+ if (U_FAILURE(status)) {
+ log_data_err("Error opening collator -> %s (Are you missing data?)\n", u_errorName(status));
return;
}
charsToTestSize = uset_size(charsToTest);
@@ -2105,7 +2102,7 @@
myCollation = ucol_open("en_US", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
log_verbose("Testing different case settings\n");
@@ -2519,7 +2516,7 @@
coll = ucol_open("", &status);
if (U_FAILURE(status)) {
- log_err("Collator can't be created\n");
+ log_err_status(status, "Collator can't be created -> %s\n", u_errorName(status));
return;
}
while (count < 149) {
@@ -2666,7 +2663,7 @@
rlen = u_unescape(testrules[i], rule, 32);
coll = ucol_openRules(rule, rlen, UCOL_ON, UCOL_TERTIARY,NULL, &status);
if (U_FAILURE(status)) {
- log_err("Collator creation failed %s\n", testrules[i]);
+ log_err_status(status, "Collator creation failed %s -> %s\n", testrules[i], u_errorName(status));
return;
}
iter1 = ucol_openElements(coll, testdata[i], 2, &status);
@@ -2792,7 +2789,7 @@
rlen = u_unescape(testrules[i], rule, 32);
coll = ucol_openRules(rule, rlen, UCOL_ON, UCOL_TERTIARY,NULL, &status);
if (U_FAILURE(status)) {
- log_err("Collator creation failed %s\n", testrules[i]);
+ log_err_status(status, "Collator creation failed %s -> %s\n", testrules[i], u_errorName(status));
return;
}
@@ -3158,7 +3155,7 @@
if(U_SUCCESS(status)) {
genericOrderingTestWithResult(coll, test, 35, UCOL_EQUAL);
} else {
- log_err("Unable to open collator\n");
+ log_err_status(status, "Unable to open collator\n");
}
ucol_close(coll);
@@ -3851,7 +3848,7 @@
UCollator *coll = ucol_open("", &status);
if (U_FAILURE(status)) {
- log_err("Could not open UCA collation %s\n", u_errorName(status));
+ log_err_status(status, "Could not open UCA collation %s\n", u_errorName(status));
return;
}
/*ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);*/
@@ -4116,7 +4113,7 @@
}
coll = ucol_openRules(r, 0, UCOL_DEFAULT, UCOL_DEFAULT, NULL, &status);
if(U_FAILURE(status)) {
- log_err("Empty rules should have produced a valid collator\n");
+ log_err_status(status, "Empty rules should have produced a valid collator -> %s\n", u_errorName(status));
} else {
ucol_close(coll);
}
@@ -4218,7 +4215,7 @@
/* Open our collator. */
UCollator* coll = ucol_open("root", &status);
if (U_FAILURE(status)){
- log_err("ERROR: in using ucol_open()\n %s\n",
+ log_err_status(status, "ERROR: in using ucol_open() -> %s\n",
myErrorName(status));
return;
}
@@ -4304,7 +4301,7 @@
UCollator *coll = ucol_open("root", &status);
if(U_FAILURE(status)) {
- log_err("Couldn't open UCA\n");
+ log_err_status(status, "Couldn't open UCA -> %s\n", u_errorName(status));
return;
}
@@ -4417,35 +4414,48 @@
#if !UCONFIG_NO_SERVICE
e = ucol_openAvailableLocales(&ec);
- assertSuccess("ucol_openAvailableLocales", &ec);
- assertTrue("ucol_openAvailableLocales!=0", e!=0);
- n = checkUEnumeration("ucol_openAvailableLocales", e, AVAIL, LEN(AVAIL));
- /* Don't need to check n because we check list */
- uenum_close(e);
+ if (e != NULL) {
+ assertSuccess("ucol_openAvailableLocales", &ec);
+ assertTrue("ucol_openAvailableLocales!=0", e!=0);
+ n = checkUEnumeration("ucol_openAvailableLocales", e, AVAIL, LEN(AVAIL));
+ /* Don't need to check n because we check list */
+ uenum_close(e);
+ } else {
+ log_data_err("Error calling ucol_openAvailableLocales() -> %s (Are you missing data?)\n", u_errorName(ec));
+ }
#endif
e = ucol_getKeywords(&ec);
- assertSuccess("ucol_getKeywords", &ec);
- assertTrue("ucol_getKeywords!=0", e!=0);
- n = checkUEnumeration("ucol_getKeywords", e, KW, LEN(KW));
- /* Don't need to check n because we check list */
- uenum_close(e);
+ if (e != NULL) {
+ assertSuccess("ucol_getKeywords", &ec);
+ assertTrue("ucol_getKeywords!=0", e!=0);
+ n = checkUEnumeration("ucol_getKeywords", e, KW, LEN(KW));
+ /* Don't need to check n because we check list */
+ uenum_close(e);
+ } else {
+ log_data_err("Error calling ucol_getKeywords() -> %s (Are you missing data?)\n", u_errorName(ec));
+ }
e = ucol_getKeywordValues(KW[0], &ec);
- assertSuccess("ucol_getKeywordValues", &ec);
- assertTrue("ucol_getKeywordValues!=0", e!=0);
- n = checkUEnumeration("ucol_getKeywordValues", e, KWVAL, LEN(KWVAL));
- /* Don't need to check n because we check list */
- uenum_close(e);
+ if (e != NULL) {
+ assertSuccess("ucol_getKeywordValues", &ec);
+ assertTrue("ucol_getKeywordValues!=0", e!=0);
+ n = checkUEnumeration("ucol_getKeywordValues", e, KWVAL, LEN(KWVAL));
+ /* Don't need to check n because we check list */
+ uenum_close(e);
+ } else {
+ log_data_err("Error calling ucol_getKeywordValues() -> %s (Are you missing data?)\n", u_errorName(ec));
+ }
/* Try setting a warning before calling ucol_getKeywordValues */
ec = U_USING_FALLBACK_WARNING;
e = ucol_getKeywordValues(KW[0], &ec);
- assertSuccess("ucol_getKeywordValues [with warning code set]", &ec);
- assertTrue("ucol_getKeywordValues!=0 [with warning code set]", e!=0);
- n = checkUEnumeration("ucol_getKeywordValues [with warning code set]", e, KWVAL, LEN(KWVAL));
- /* Don't need to check n because we check list */
- uenum_close(e);
+ if (assertSuccess("ucol_getKeywordValues [with warning code set]", &ec)) {
+ assertTrue("ucol_getKeywordValues!=0 [with warning code set]", e!=0);
+ n = checkUEnumeration("ucol_getKeywordValues [with warning code set]", e, KWVAL, LEN(KWVAL));
+ /* Don't need to check n because we check list */
+ uenum_close(e);
+ }
/*
U_DRAFT int32_t U_EXPORT2
@@ -4456,17 +4466,19 @@
*/
n = ucol_getFunctionalEquivalent(loc, sizeof(loc), "collation", "fr",
&isAvailable, &ec);
- assertSuccess("getFunctionalEquivalent", &ec);
- assertEquals("getFunctionalEquivalent(fr)", "fr", loc);
- assertTrue("getFunctionalEquivalent(fr).isAvailable==TRUE",
- isAvailable == TRUE);
+ if (assertSuccess("getFunctionalEquivalent", &ec)) {
+ assertEquals("getFunctionalEquivalent(fr)", "fr", loc);
+ assertTrue("getFunctionalEquivalent(fr).isAvailable==TRUE",
+ isAvailable == TRUE);
+ }
n = ucol_getFunctionalEquivalent(loc, sizeof(loc), "collation", "fr_FR",
&isAvailable, &ec);
- assertSuccess("getFunctionalEquivalent", &ec);
- assertEquals("getFunctionalEquivalent(fr_FR)", "fr", loc);
- assertTrue("getFunctionalEquivalent(fr_FR).isAvailable==TRUE",
- isAvailable == TRUE);
+ if (assertSuccess("getFunctionalEquivalent", &ec)) {
+ assertEquals("getFunctionalEquivalent(fr_FR)", "fr", loc);
+ assertTrue("getFunctionalEquivalent(fr_FR).isAvailable==TRUE",
+ isAvailable == TRUE);
+ }
}
/* supercedes TestJ784 */
@@ -4563,7 +4575,7 @@
rlen = u_unescape(tests[i].rules, rlz, RULE_BUFFER_LEN);
coll = ucol_openRules(rlz, rlen, UCOL_DEFAULT, UCOL_DEFAULT,NULL, &status);
if(status != tests[i].expectedStatus) {
- log_err("Opening a collator with rules %s returned error code %s, expected %s\n",
+ log_err_status(status, "Opening a collator with rules %s returned error code %s, expected %s\n",
tests[i].rules, u_errorName(status), u_errorName(tests[i].expectedStatus));
}
ucol_close(coll);
@@ -4696,7 +4708,7 @@
coll = ucol_openRules(rlz, rlen, UCOL_DEFAULT, UCOL_DEFAULT,NULL, &status);
if(U_FAILURE(status)) {
- log_err("Could not open default collator!\n");
+ log_err_status(status, "Could not open default collator! -> %s\n", u_errorName(status));
} else {
res = ucol_strcoll(coll, &a, 1, &null, 1);
@@ -4724,7 +4736,7 @@
uint8_t expectedKey[256] = { 0x01, 0xe0, 0x4e, 0x01, 0x05, 0x00 };
UCollator *coll = ucol_open("th", &status);
if(U_FAILURE(status)) {
- log_err("Could not open a collator, exiting (%s)\n", u_errorName(status));
+ log_err_status(status, "Could not open a collator, exiting (%s)\n", u_errorName(status));
return;
}
@@ -4777,7 +4789,7 @@
static UCollator *coll = NULL;
coll = ucol_open("root", &status);
if(U_FAILURE(status)) {
- log_err("Couldn't open UCA\n");
+ log_err_status(status, "Couldn't open UCA -> %s\n", u_errorName(status));
return;
}
ucol_setStrength(coll, UCOL_PRIMARY);
@@ -4885,7 +4897,7 @@
/* Test Vietnamese sort. */
coll = ucol_open("vi", &status);
if(U_FAILURE(status)) {
- log_err("Couldn't open collator %d\n", &status);
+ log_err_status(status, "Couldn't open collator -> %s\n", u_errorName(status));
return;
}
log_verbose("\n\nVI collation:");
@@ -5050,7 +5062,7 @@
ruleLen = u_strlen(rule1);
coll = ucol_openRules(rule1, ruleLen, UCOL_OFF, UCOL_TERTIARY, NULL,&status);
if (U_FAILURE(status)) {
- log_err("Tailoring test: &[last primary ignorable] failed!");
+ log_err_status(status, "Tailoring test: &[last primary ignorable] failed! -> %s\n", u_errorName(status));
return;
}
tLen = u_strlen(tData1[0]);
@@ -5136,7 +5148,7 @@
log_verbose("\n\nEN collation:");
coll = ucol_open("en", &status);
if (U_FAILURE(status)) {
- log_err("Tailoring test: &z <<a|- failed!");
+ log_err_status(status, "Tailoring test: &z <<a|- failed! -> %s\n", u_errorName(status));
return;
}
for (j=0; j<11; j++) {
@@ -5240,7 +5252,7 @@
coll = ucol_open("root", &status);
if(U_FAILURE(status)) {
- log_err("Couldn't open UCA\n");
+ log_err_status(status, "Couldn't open UCA -> %s\n", u_errorName(status));
return;
}
ucol_setStrength(coll, UCOL_PRIMARY);
@@ -5275,7 +5287,7 @@
ucol = ucol_openFromShortString("LEN_S4", FALSE, NULL, &icuRC);
if (U_FAILURE(icuRC))
{
- log_err("ucol_openFromShortString failed\n");
+ log_err_status(icuRC, "ucol_openFromShortString failed -> %s\n", u_errorName(icuRC));
return;
}
@@ -5340,7 +5352,7 @@
ucol = ucol_openFromShortString(collString, FALSE, NULL, &status);
if (U_FAILURE(status)) {
- log_err("ucol_openFromShortString error in Craotian test.\n");
+ log_err_status(status, "ucol_openFromShortString error in Craotian test. -> %s\n", u_errorName(status));
return;
}
@@ -5385,7 +5397,7 @@
ucol = ucol_openFromShortString("LJA_AN_CX_EX_FX_HO_NX_S4", FALSE, NULL,
&status);
if (U_FAILURE(status)) {
- log_err("Error status: %s; Unable to open collator from short string.", u_errorName(status));
+ log_err_status(status, "Error status: %s; Unable to open collator from short string.\n", u_errorName(status));
return;
}
diff --git a/test/cintltst/cmsgtst.c b/test/cintltst/cmsgtst.c
index cf8a967..c1d4a8d 100644
--- a/test/cintltst/cmsgtst.c
+++ b/test/cintltst/cmsgtst.c
@@ -130,7 +130,7 @@
&status, 1, 3456.00, d1);
}
if(U_FAILURE(status)){
- log_err("ERROR: failure in message format on testcase %d: %s\n", i, myErrorName(status) );
+ log_data_err("ERROR: failure in message format on testcase %d: %s (Are you missing data?)\n", i, myErrorName(status) );
continue;
}
if(u_strcmp(result, testResultStrings[i])==0){
@@ -162,7 +162,7 @@
&status, 1, 3456.00, d1);
}
if(U_FAILURE(status)){
- log_err("ERROR: failure in message format on testcase %d: %s\n", i, myErrorName(status) );
+ log_data_err("ERROR: failure in message format on testcase %d: %s (Are you missing data?)\n", i, myErrorName(status) );
continue;
}
if(u_strcmp(result, testResultStrings[i])==0){
@@ -183,7 +183,7 @@
UMessageFormat formatter = umsg_open(testCasePatterns[0],patternLength,"en_US",NULL,&ec);
if(U_FAILURE(ec)){
- log_err("umsg_open() failed for testCasePattens[%d].\n",i);
+ log_data_err("umsg_open() failed for testCasePattens[%d]. -> %s (Are you missing data?)\n",i, u_errorName(ec));
return;
}
for(i = 0;i<cnt_testCases; i++){
@@ -286,7 +286,7 @@
u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, str, d);
}
if(U_FAILURE(status)){
- log_err("Error: failure in message format on test#1: %s\n", myErrorName(status));
+ log_data_err("Error: failure in message format on test#1: %s (Are you missing data?)\n", myErrorName(status));
}
else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#1\n");
@@ -317,7 +317,7 @@
u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, str, 23);
}
if(U_FAILURE(status)){
- log_err("Error: failure in message format on test#2 : %s\n", myErrorName(status));
+ log_data_err("Error: failure in message format on test#2 : %s (Are you missing data?)\n", myErrorName(status));
}
else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#2\n");
@@ -342,7 +342,7 @@
u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, str, 500.00);
}
if(U_FAILURE(status)){
- log_err("Error: failure in message format on test#3 : %s\n", myErrorName(status));
+ log_data_err("Error: failure in message format on test#3 : %s (Are you missing data?)\n", myErrorName(status));
}
else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#3\n");
@@ -399,7 +399,7 @@
resultlength=1;
fmt = umsg_open(pattern,u_strlen(pattern),"en_US",&parseError,&status);
if(U_FAILURE(status)){
- log_err("error in umsg_open : %s\n", u_errorName(status) );
+ log_data_err("error in umsg_open : %s (Are you missing data?)\n", u_errorName(status) );
return;
}
result=(UChar*)malloc(sizeof(UChar) * resultlength);
@@ -508,7 +508,7 @@
}
if(U_FAILURE(status)){
- log_err("ERROR: failure in message format test#4: %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in message format test#4: %s (Are you missing data?)\n", myErrorName(status));
}
else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#4\n");
@@ -523,7 +523,7 @@
u_parseMessageWithError("en_US", pattern, u_strlen(pattern), result, u_strlen(result), &parseError,&status, &d, ret, &value);
if(U_FAILURE(status)){
- log_err("ERROR: error in parsing: test#5: %s\n", myErrorName(status));
+ log_data_err("ERROR: error in parsing: test#5: %s (Are you missing data?)\n", myErrorName(status));
}
else if(value!=7 && u_strcmp(str,ret)!=0)
log_err("FAIL: Error in parseMessage on test#5 \n");
@@ -533,7 +533,7 @@
def1 = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,NULL, NULL, 0, NULL,0,&status);
if(U_FAILURE(status))
{
- log_err("error in creating the dateformat using short date and time style:\n %s\n", myErrorName(status));
+ log_data_err("error in creating the dateformat using short date and time style: %s (Are you missing data?)\n", myErrorName(status));
}else{
if(u_strcmp(myDateFormat(def1, d), myDateFormat(def1, d1))==0)
@@ -601,7 +601,7 @@
}
if(U_FAILURE(status)){
- log_err("ERROR: failure in message format test#4: %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in message format test#4: %s (Are you missing data?)\n", myErrorName(status));
}
else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#4\n");
@@ -616,7 +616,7 @@
u_parseMessage("en_US", pattern, u_strlen(pattern), result, u_strlen(result), &status, &d, ret, &value);
if(U_FAILURE(status)){
- log_err("ERROR: error in parsing: test#5: %s\n", myErrorName(status));
+ log_data_err("ERROR: error in parsing: test#5: %s (Are you missing data?)\n", myErrorName(status));
}
else if(value!=7 && u_strcmp(str,ret)!=0)
log_err("FAIL: Error in parseMessage on test#5 \n");
@@ -626,7 +626,7 @@
def1 = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,NULL, NULL, 0, NULL,0,&status);
if(U_FAILURE(status))
{
- log_err("error in creating the dateformat using short date and time style:\n %s\n", myErrorName(status));
+ log_data_err("error in creating the dateformat using short date and time style: %s (Are you missing data?)\n", myErrorName(status));
}else{
if(u_strcmp(myDateFormat(def1, d), myDateFormat(def1, d1))==0)
@@ -679,7 +679,7 @@
free(result);
}
if(U_FAILURE(status)){
- log_err("ERROR: failure in message format on test#6 : %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in message format on test#6 : %s (Are you missing data?)\n", myErrorName(status));
}
log_verbose("Testing message format with choice test #7\n:");
@@ -702,7 +702,7 @@
free(result);
}
if(U_FAILURE(status)){
- log_err("ERROR: failure in message format on test#7 : %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in message format on test#7 : %s (Are you missing data?)\n", myErrorName(status));
}
log_verbose("Testing message format with choice test #8\n:");
@@ -726,7 +726,7 @@
free(result);
}
if(U_FAILURE(status)){
- log_err("ERROR: failure in message format on test#8 : %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in message format on test#8 : %s (Are you missing data?)\n", myErrorName(status));
}
free(str);
@@ -751,7 +751,7 @@
u_parseMessage( "en_US", pattern, u_strlen(pattern), source, u_strlen(source), &status, str, &value);
if(U_FAILURE(status)){
- log_err("ERROR: failure in parse Message on test#9: %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in parse Message on test#9: %s (Are you missing data?)\n", myErrorName(status));
}
else if(value==500.00 && u_strcmp(str,res)==0)
log_verbose("PASS: parseMessage successful on test#9\n");
@@ -768,15 +768,12 @@
u_parseMessage( "en_US", pattern, u_strlen(pattern), source, u_strlen(source), &status, &value, str);
if(U_FAILURE(status)){
- log_err("ERROR: failure in parse Message on test#10: %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in parse Message on test#10: %s (Are you missing data?)\n", myErrorName(status));
}
else if(value==123.00 && u_strcmp(str,res)==0)
log_verbose("PASS: parseMessage successful on test#10\n");
else
log_err("FAIL: Error in parseMessage on test#10 \n");
-
-
-
}
static int32_t CallFormatMessage(const char* locale, UChar* testCasePattern, int32_t patternLength,
@@ -822,7 +819,7 @@
&status, 1, 3456.00, d1);
}
if(U_FAILURE(status)){
- log_err("ERROR: failure in message format on testcase %d: %s\n", i, myErrorName(status) );
+ log_data_err("ERROR: failure in message format on testcase %d: %s (Are you missing data?)\n", i, myErrorName(status) );
}
else if(u_strcmp(result, testResultStrings[i])==0){
log_verbose("PASS: MessagFormat successful on testcase : %d\n", i);
@@ -866,12 +863,12 @@
CallParseMessage( "en_US", pattern, u_strlen(pattern), source, u_strlen(source), &status, str, &value);
if(U_FAILURE(status)){
- log_err("ERROR: failure in parse Message on test#9: %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in parse Message on test#9: %s (Are you missing data?)\n", myErrorName(status));
}
- if(value==500.00 && u_strcmp(str,res)==0)
+ else if(value==500.00 && u_strcmp(str,res)==0)
log_verbose("PASS: parseMessage successful on test#9\n");
else
- log_err("FAIL: Error in parseMessage on test#9 \n");
+ log_err("FAIL: Error in parseMessage on test#9\n");
log_verbose("\nTesting a sample for parse Message test#10\n");
@@ -882,7 +879,7 @@
CallParseMessage( "en_US", pattern, u_strlen(pattern), source, u_strlen(source), &status, &value, str);
if(U_FAILURE(status)){
- log_err("ERROR: failure in parse Message on test#10: %s\n", myErrorName(status));
+ log_data_err("ERROR: failure in parse Message on test#10: %s (Are you missing data?)\n", myErrorName(status));
}
else if(value==123.00 && u_strcmp(str,res)==0)
log_verbose("PASS: parseMessage successful on test#10\n");
@@ -926,7 +923,7 @@
if (strcmp(cresult, EXP) == 0) {
log_verbose("Ok: \"%s\"\n", cresult);
} else {
- log_err("FAIL: got \"%s\", expected \"%s\"\n", cresult, EXP);
+ log_data_err("FAIL: got \"%s\", expected \"%s\" -> %s (Are you missing data?)\n", cresult, EXP, u_errorName(status));
}
ctest_resetTimeZone();
@@ -988,13 +985,13 @@
umsg_applyPattern(f1,pattern,(int32_t)strlen(PAT),NULL,&status);
if(U_FAILURE(status))
{
- log_err("umsg_applyPattern failed. Error %s \n",u_errorName(status));
+ log_data_err("umsg_applyPattern failed. Error %s (Are you missing data?)\n",u_errorName(status));
}
/* Test umsg_toPattern */
umsg_toPattern(f1,result,256,&status);
if(U_FAILURE(status) ){
- log_err("umsg_toPattern method failed. Error: %s \n",u_errorName(status));
+ log_data_err("umsg_toPattern method failed. Error: %s (Are you missing data?)\n",u_errorName(status));
} else {
if(u_strcmp(result,pattern)!=0){
u_UCharsToChars(result,cresult,256);
diff --git a/test/cintltst/cnmdptst.c b/test/cintltst/cnmdptst.c
index 0ed5579..0600fd1 100644
--- a/test/cintltst/cnmdptst.c
+++ b/test/cintltst/cnmdptst.c
@@ -77,7 +77,7 @@
u_uastrcpy(upat, pat[i]);
fmt= unum_open(UNUM_IGNORE,upat, u_strlen(upat), "en_US",NULL, &status);
if (U_FAILURE(status)) {
- log_err("FAIL: Number format constructor failed for pattern %s\n", pat[i]);
+ log_err_status(status, "FAIL: Number format constructor failed for pattern %s -> %s\n", pat[i], u_errorName(status));
continue;
}
lneed=0;
@@ -130,7 +130,7 @@
u_uastrcpy(pat, "a'fo''o'b#");
fmt =unum_open(UNUM_IGNORE,pat, u_strlen(pat), "en_US",NULL, &status);
if(U_FAILURE(status)){
- log_err("Error in number format costruction using pattern \"a'fo''o'b#\"\n");
+ log_err_status(status, "Error in number format costruction using pattern \"a'fo''o'b#\" -> %s\n", u_errorName(status));
}
lneed=0;
lneed=unum_format(fmt, 123, NULL, lneed, NULL, &status);
@@ -140,7 +140,7 @@
unum_format(fmt, 123, str, lneed+1, NULL, &status);
}
if(U_FAILURE(status) || !str) {
- log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status) );
+ log_err_status(status, "Error in formatting using unum_format(.....): %s\n", myErrorName(status) );
return;
}
log_verbose("Pattern \"%s\" \n", u_austrcpy(tempBuf, pat) );
@@ -254,7 +254,7 @@
u_uastrcpy(upat, pat[p]);
fmt=unum_open(UNUM_IGNORE,upat, u_strlen(upat), "en_US",NULL, &status);
if (U_FAILURE(status)) {
- log_err("FAIL: Bad status returned by Number format construction with pattern %s\n, pat[i]");
+ log_err_status(status, "FAIL: Bad status returned by Number format construction with pattern %s -> %s\n", pat[p], u_errorName(status));
continue;
}
lneed= u_strlen(upat) + 1;
@@ -350,7 +350,7 @@
pattern[0]=pattern[11]=0xa4; /* insert latin-1 currency symbol */
fmt = unum_open(UNUM_IGNORE,pattern, u_strlen(pattern), "en_US",NULL, &status);
if(U_FAILURE(status)){
- log_err("Error in number format construction with pattern \"\\xA4#,##0.00;-\\xA4#,##0.00\\\" \n");
+ log_err_status(status, "Error in number format construction with pattern \"\\xA4#,##0.00;-\\xA4#,##0.00\\\" -> %s\n", u_errorName(status));
}
lneed=0;
lneed=unum_formatDouble(fmt, 1234.56, NULL, lneed, NULL, &status);
@@ -360,7 +360,7 @@
unum_formatDouble(fmt, 1234.56, str, lneed+1, NULL, &status);
}
if(U_FAILURE(status)) {
- log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status) );
+ log_err_status(status, "Error in formatting using unum_format(.....): %s\n", myErrorName(status) );
}
lneed=0;
lneed=unum_toPattern(fmt, FALSE, NULL, lneed, &status);
@@ -376,7 +376,7 @@
u_uastrcpy(res, "$1,234.56");
if (u_strcmp(str, res) !=0) log_err("FAIL: Expected $1,234.56\n");
} else {
- log_err("Error formatting\n");
+ log_err_status(status, "Error formatting -> %s\n", u_errorName(status));
}
free(str);
free(res);
@@ -390,7 +390,7 @@
unum_formatDouble(fmt, -1234.56, str, lneed+1, NULL, &status);
}
if(U_FAILURE(status)) {
- log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status) );
+ log_err_status(status, "Error in formatting using unum_format(.....): %s\n", myErrorName(status) );
}
if(str) {
res=(UChar*)malloc(sizeof(UChar) * (strlen("-$1,234.56")+1) );
@@ -424,7 +424,7 @@
currencyFmt = unum_open(UNUM_CURRENCY, NULL,0,locale[i],NULL, &status);
if(U_FAILURE(status)){
- log_err("Error in the construction of number format with style currency:\n%s\n",
+ log_data_err("Error in the construction of number format with style currency: %s (Are you missing data?)\n",
myErrorName(status));
} else {
lneed=0;
@@ -470,8 +470,8 @@
};
const char* result[]={
- "2\\u00A0\\u20A7", "2\\u00A0F", "\\u00A31.50", "1,50\\u00A0mk", "2\\u00A0F", "\\u20A4\\u00A02",
- "1$50\\u00A0Esc.", "\\u00F6S\\u00A01,50", "1,50\\u00A0\\u0394\\u03C1\\u03C7", "\\u20A7\\u00A02", "1,50\\u00A0FB", "\\u00a31.50",
+ "2\\u00A0\\u20A7", "2\\u00A0F", "IR\\u00A31.50", "1,50\\u00A0mk", "2\\u00A0F", "IT\\u20A4\\u00A02",
+ "1$50\\u00A0Esc.", "\\u00F6S\\u00A01,50", "1,50\\u00A0\\u0394\\u03C1\\u03C7", "\\u20A7\\u00A02", "1,50\\u00A0FB", "IR\\u00a31.50",
"1,50\\u00A0BF", "1,50\\u00A0DM", "1,50\\u00A0BF", "2\\u00A0\\u20A7", "1,50\\u00A0F", "2\\u00A0\\u20A7",
"fl\\u00A01,50"
};
@@ -482,13 +482,13 @@
char curID[256] = {0};
uloc_canonicalize(locale[i], curID, 256, &status);
if(U_FAILURE(status)){
- log_err("Could not canonicalize %s. Error: %s \n", locale[i], u_errorName(status));
+ log_data_err("Could not canonicalize %s. Error: %s (Are you missing data?)\n", locale[i], u_errorName(status));
continue;
}
currencyFmt = unum_open(UNUM_CURRENCY, NULL,0,curID,NULL, &status);
if(U_FAILURE(status)){
- log_err("Error in the construction of number format with style currency:\n%s\n",
+ log_data_err("Error in the construction of number format with style currency: %s (Are you missing data?)\n",
myErrorName(status));
} else {
lneed=0;
@@ -554,7 +554,7 @@
UChar isoCode[16]={0};
currencyFmt = unum_open(UNUM_CURRENCY, NULL,0,locale[i],NULL, &status);
if(U_FAILURE(status)){
- log_err("Error in the construction of number format with style currency:\n%s\n",
+ log_data_err("Error in the construction of number format with style currency: %s (Are you missing data?)\n",
myErrorName(status));
} else {
if (*currency[i]) {
@@ -618,7 +618,7 @@
nnf = unum_open(UNUM_DEFAULT, NULL,0,"en_US",NULL, &status);
if(U_FAILURE(status)){
- log_err("FAIL: failure in the construction of number format: %s\n", myErrorName(status));
+ log_data_err("FAIL: failure in the construction of number format: %s (Are you missing data?)\n", myErrorName(status));
} else {
roundingTest(nnf, 0.00159999, 4, "0.0016");
roundingTest(nnf, 0.00995, 4, "0.01");
@@ -683,7 +683,7 @@
def=unum_open(style, NULL,0,NULL,NULL, &status);
if (U_FAILURE(status)) {
- log_err("Fail: error creating a default number formatter\n");
+ log_data_err("Fail: error creating a default number formatter -> %s (Are you missing data?)\n", u_errorName(status));
} else {
attr=UNUM_ROUNDING_INCREMENT;
dvalue=unum_getDoubleAttribute(def, attr);
@@ -718,7 +718,10 @@
u_uastrcpy(buffer, "#,##,###");
f = unum_open(UNUM_IGNORE,buffer, -1, "en_US",NULL, &status);
- CHECK(status, "DecimalFormat ct");
+ if (U_FAILURE(status)) {
+ log_data_err("Error DecimalFormat ct -> %s (Are you missing data?)\n", u_errorName(status));
+ return;
+ }
pos.field = 0;
unum_format(f, (int32_t)123456789L, resultBuffer, 512 , &pos, &status);
@@ -897,7 +900,7 @@
UEnumeration *ALL = ucurr_getKeywordValuesForLocale("currency", uloc_getDefault(), FALSE, &status);
if (ALL == NULL) {
- log_err("ERROR getting keyword value for default locale.\n");
+ log_err_status(status, "ERROR getting keyword value for default locale. -> %s\n", u_errorName(status));
return;
}
@@ -978,7 +981,7 @@
nnf = unum_open(UNUM_DEFAULT, NULL,0,"en_US",NULL, &status);
if(U_FAILURE(status)){
- log_err("FAIL: failure in the construction of number format: %s\n", myErrorName(status));
+ log_data_err("FAIL: failure in the construction of number format: %s (Are you missing data?)\n", myErrorName(status));
return;
}
diff --git a/test/cintltst/cnumtst.c b/test/cintltst/cnumtst.c
index cacfcdd..d1c5100 100644
--- a/test/cintltst/cnumtst.c
+++ b/test/cintltst/cnumtst.c
@@ -129,7 +129,7 @@
/* Might as well pack it in now if we can't even get a default NumberFormat... */
if(U_FAILURE(status))
{
- log_err("Error in creating default NumberFormat using unum_open(): %s\n", myErrorName(status));
+ log_data_err("Error in creating default NumberFormat using unum_open(): %s (Are you missing data?)\n", myErrorName(status));
return;
}
@@ -809,7 +809,7 @@
int32_t value, position = testPtr->startPos;
UNumberFormat *nf = unum_open(UNUM_SPELLOUT, NULL, 0, testPtr->locale, NULL, &status);
if (U_FAILURE(status)) {
- log_err("unum_open fails for UNUM_SPELLOUT with locale %s, status %s\n", testPtr->locale, myErrorName(status));
+ log_err_status(status, "unum_open fails for UNUM_SPELLOUT with locale %s, status %s\n", testPtr->locale, myErrorName(status));
continue;
}
value = unum_parse(nf, testPtr->source, -1, &position, &status);
@@ -886,7 +886,7 @@
pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), NULL, NULL,&status);
if(U_SUCCESS(status))
{
- log_err("error in unum_openPattern(%s): %s\n", temp1, myErrorName(status) );;
+ log_err("error in unum_openPattern(%s): %s\n", temp1, myErrorName(status) );
}
else
{
@@ -899,7 +899,7 @@
pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), "en_US",NULL, &status);
if(U_FAILURE(status))
{
- log_err("error in padding unum_openPattern(%s): %s\n", temp1, myErrorName(status) );;
+ log_err_status(status, "error in padding unum_openPattern(%s): %s\n", temp1, myErrorName(status) );;
}
else {
log_verbose("Pass: padding unum_openPattern() works fine\n");
@@ -1254,7 +1254,7 @@
/* Get a non-existent currency and make sure it returns the correct currency code. */
format = unum_open(UNUM_CURRENCY, NULL, 0, "th_TH@currency=QQQ", NULL, &status);
if (format == NULL || U_FAILURE(status)) {
- log_err("unum_open did not return expected result for non-existent requested currency: '%s'\n", u_errorName(status));
+ log_data_err("unum_open did not return expected result for non-existent requested currency: '%s' (Are you missing data?)\n", u_errorName(status));
}
else {
unum_getSymbol(format,
@@ -1287,25 +1287,25 @@
u_uastrcpy(pat, "#,##0.0#;(#,##0.0#)");
formats[0] = unum_open(UNUM_PATTERN_DECIMAL, pat, -1, "en_US", &perr, &status);
if (U_FAILURE(status)) {
- log_err("unable to open decimal pattern\n");
+ log_err_status(status, "unable to open decimal pattern -> %s\n", u_errorName(status));
}
status = U_ZERO_ERROR;
formats[1] = unum_open(UNUM_SPELLOUT, NULL, 0, "en_US", &perr, &status);
if (U_FAILURE(status)) {
- log_err("unable to open spellout\n");
+ log_err_status(status, "unable to open spellout -> %s\n", u_errorName(status));
}
status = U_ZERO_ERROR;
formats[2] = unum_open(UNUM_ORDINAL, NULL, 0, "en_US", &perr, &status);
if (U_FAILURE(status)) {
- log_err("unable to open ordinal\n");
+ log_err_status(status, "unable to open ordinal -> %s\n", u_errorName(status));
}
status = U_ZERO_ERROR;
formats[3] = unum_open(UNUM_DURATION, NULL, 0, "en_US", &perr, &status);
if (U_FAILURE(status)) {
- log_err("unable to open duration\n");
+ log_err_status(status, "unable to open duration %s\n", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -1348,10 +1348,10 @@
u_strcat(pat, tempUChars);
formats[4] = unum_open(UNUM_PATTERN_RULEBASED, pat, -1, "en_US", &perr, &status);
if (U_FAILURE(status)) {
- log_err("unable to open rulebased pattern\n");
+ log_err_status(status, "unable to open rulebased pattern -> %s\n", u_errorName(status));
}
if (U_FAILURE(status)) {
- log_err("Something failed with %s\n", u_errorName(status));
+ log_err_status(status, "Something failed with %s\n", u_errorName(status));
return;
}
@@ -1396,7 +1396,7 @@
cur = unum_open(UNUM_CURRENCY, NULL,0,"en_US", NULL, &status);
if(U_FAILURE(status)) {
- log_err("unum_open failed: %s\n", u_errorName(status));
+ log_data_err("unum_open failed: %s (Are you missing data?)\n", u_errorName(status));
return;
}
@@ -1430,7 +1430,7 @@
UErrorCode status = U_ZERO_ERROR;
UNumberFormat *nf = unum_open(UNUM_CURRENCY, NULL, 0, "en_US", NULL, &status);
if (U_FAILURE(status)) {
- log_err("FAILED 1\n");
+ log_data_err("FAILED 1 -> %s (Are you missing data?)\n", u_errorName(status));
return;
}
unum_setTextAttribute(nf, UNUM_CURRENCY_CODE, ubuffer, 3, &status);
@@ -1499,8 +1499,9 @@
testcase="ar_AE UNUM_CURRENCY";
nf = unum_open(UNUM_CURRENCY, NULL, -1, "ar_AE", NULL, &status);
- if(U_FAILURE(status)) {
- log_err("%s: unum_open failed with %s\n", testcase, u_errorName(status));
+ if(U_FAILURE(status) || nf == NULL) {
+ log_data_err("%s: unum_open failed with %s (Are you missing data?)\n", testcase, u_errorName(status));
+ return;
}
TestNBSPPatternRT(testcase, nf);
diff --git a/test/cintltst/crestst.c b/test/cintltst/crestst.c
index 64e5e1d..a282323 100644
--- a/test/cintltst/crestst.c
+++ b/test/cintltst/crestst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*******************************************************************************
@@ -116,12 +116,12 @@
he = ures_open(NULL, "he", &status);
iw = ures_open(NULL, "iw", &status);
if(U_FAILURE(status)) {
- log_err("Failed to get resource with %s\n", myErrorName(status));
+ log_err_status(status, "Failed to get resource with %s\n", myErrorName(status));
}
ures_close(iw);
result = ures_getStringByKey(he, "ExemplarCharacters", &resultLen, &status);
if(U_FAILURE(status) || result == NULL) {
- log_err("Failed to get resource with %s\n", myErrorName(status));
+ log_err_status(status, "Failed to get resource with %s\n", myErrorName(status));
}
ures_close(he);
}
@@ -426,7 +426,7 @@
fr_FR = ures_open(NULL, "fr_FR", &status);
if(U_FAILURE(status))
{
- log_err("Couldn't open fr_FR - %d\n", status);
+ log_err_status(status, "Couldn't open fr_FR - %s\n", u_errorName(status));
return;
}
diff --git a/test/cintltst/creststn.c b/test/cintltst/creststn.c
index 75933af..5cafe88 100644
--- a/test/cintltst/creststn.c
+++ b/test/cintltst/creststn.c
@@ -243,7 +243,7 @@
log_data_err("Resource not present, cannot test (%s:%d)\n", __FILE__, line);
}
if(status != expected) {
- log_err("%s:%d: Expected error code %s, got error code %s\n", __FILE__, line, u_errorName(expected), u_errorName(status));
+ log_err_status(status, "%s:%d: Expected error code %s, got error code %s\n", __FILE__, line, u_errorName(expected), u_errorName(status));
}
}
@@ -344,12 +344,12 @@
he = ures_open(NULL, "he", &status);
iw = ures_open(NULL, "iw", &status);
if(U_FAILURE(status)) {
- log_err("Failed to get resource with %s\n", myErrorName(status));
+ log_err_status(status, "Failed to get resource with %s\n", myErrorName(status));
}
ures_close(iw);
result = ures_getStringByKey(he, "ExemplarCharacters", &resultLen, &status);
if(U_FAILURE(status) || result == NULL) {
- log_err("Failed to get resource ExemplarCharacters with %s\n", myErrorName(status));
+ log_err_status(status, "Failed to get resource ExemplarCharacters with %s\n", myErrorName(status));
}
ures_close(he);
@@ -358,7 +358,7 @@
status = U_ZERO_ERROR;
norway = ures_open(NULL, norwayNames[i], &status);
if(U_FAILURE(status)) {
- log_err("Failed to get resource with %s for %s\n", myErrorName(status), norwayNames[i]);
+ log_err_status(status, "Failed to get resource with %s for %s\n", myErrorName(status), norwayNames[i]);
continue;
}
realName = ures_getLocale(norway, &status);
@@ -1028,7 +1028,7 @@
status = U_ZERO_ERROR;
ures_close(ures_openU(NULL, "root", &status));
if(U_FAILURE(status)){
- log_err("ERROR: ures_openU() failed path = NULL with %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: ures_openU() failed path = NULL with %s\n", myErrorName(status));
}
status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -1039,7 +1039,7 @@
status = U_ZERO_ERROR;
teRes=ures_openU(utestdatapath, "te", &status);
if(U_FAILURE(status)){
- log_err("ERROR: ures_openU() failed path =%s with %s\n", austrdup(utestdatapath), myErrorName(status));
+ log_err_status(status, "ERROR: ures_openU() failed path =%s with %s\n", austrdup(utestdatapath), myErrorName(status));
return;
}
/*Test ures_getLocale() */
@@ -1385,7 +1385,7 @@
log_verbose("Testing version number for locale %s\n", locName);
resB = ures_open(NULL,locName, &status);
if (U_FAILURE(status)) {
- log_err("Resource bundle creation for locale %s failed.: %s\n", locName, myErrorName(status));
+ log_err_status(status, "Resource bundle creation for locale %s failed.: %s\n", locName, myErrorName(status));
ures_close(resB);
return;
}
@@ -1420,7 +1420,7 @@
log_verbose("The ures_getVersion(%s) tests begin : \n", U_ICUDATA_COLL);
locs = ures_openAvailableLocales(U_ICUDATA_COLL, &status);
if (U_FAILURE(status)) {
- log_err("enumeration of %s failed.: %s\n", U_ICUDATA_COLL, myErrorName(status));
+ log_err_status(status, "enumeration of %s failed.: %s\n", U_ICUDATA_COLL, myErrorName(status));
return;
}
@@ -2016,7 +2016,7 @@
fr_FR = ures_open(NULL, "fr_FR", &status);
if(U_FAILURE(status))
{
- log_err("Couldn't open fr_FR - %d\n", status);
+ log_err_status(status, "Couldn't open fr_FR - %s\n", u_errorName(status));
return;
}
@@ -2061,7 +2061,7 @@
UResourceBundle* resLocID = ures_getByKey(myResB, "Version", NULL, &err);
UResourceBundle* tResB;
const UChar* version = NULL;
- static const UChar versionStr[] = { 0x0031, 0x002E, 0x0034, 0x0036, 0x0000};
+ static const UChar versionStr[] = { 0x0031, 0x002E, 0x0034, 0x0037, 0x0000};
if(err != U_ZERO_ERROR){
log_data_err("Expected U_ZERO_ERROR when trying to test no_NO_NY aliased to nn_NO for Version err=%s\n",u_errorName(err));
@@ -2147,7 +2147,7 @@
/* testing referencing/composed alias */
uk = ures_findResource("ja/LocaleScript/2", uk, &status);
if((uk == NULL) || U_FAILURE(status)) {
- log_err("Couldn't findResource('ja/LocaleScript/2') err %s\n", u_errorName(status));
+ log_err_status(status, "Couldn't findResource('ja/LocaleScript/2') err %s\n", u_errorName(status));
goto cleanup;
}
@@ -2372,7 +2372,7 @@
t2 = ures_open(NULL, "sr", &status);
if(U_FAILURE(status)) {
- log_err("Couldn't open 'sr' resource bundle, error %s\n", u_errorName(status));
+ log_err_status(status, "Couldn't open 'sr' resource bundle, error %s\n", u_errorName(status));
log_data_err("No 'sr', no test - you have bigger problems than testing direct access. "
"You probably have no data! Aborting this test\n");
}
@@ -2422,7 +2422,7 @@
t2 = ures_getByKeyWithFallback(t2, "islamic-civil", t2, &status);
t2 = ures_getByKeyWithFallback(t2, "eras", t2, &status);
if(U_FAILURE(status)) {
- log_err("Didn't get Eras. I know they are there!\n");
+ log_err_status(status, "Didn't get Eras. I know they are there!\n");
}
status = U_ZERO_ERROR;
@@ -2451,7 +2451,7 @@
t = ures_getByKeyWithFallback(t, "gregorian", t, &status);
t = ures_getByKeyWithFallback(t, "AmPmMarkers", t, &status);
if(U_FAILURE(status)) {
- log_err("This resource should be available?\n");
+ log_err_status(status, "This resource should be available?\n");
}
status = U_ZERO_ERROR;
@@ -2480,11 +2480,11 @@
}
}
if(foundStandard == FALSE) {
- log_err("'standard' was not found in the keyword list.\n");
+ log_err_status(status, "'standard' was not found in the keyword list.\n");
}
uenum_close(kwVals);
if(U_FAILURE(status)) {
- log_err("err %s getting collation values\n", u_errorName(status));
+ log_err_status(status, "err %s getting collation values\n", u_errorName(status));
}
status = U_ZERO_ERROR;
#endif
@@ -2504,11 +2504,11 @@
}
}
if(foundStandard == FALSE) {
- log_err("'japanese' was not found in the calendar keyword list.\n");
+ log_err_status(status, "'japanese' was not found in the calendar keyword list.\n");
}
uenum_close(kwVals);
if(U_FAILURE(status)) {
- log_err("err %s getting calendar values\n", u_errorName(status));
+ log_err_status(status, "err %s getting calendar values\n", u_errorName(status));
}
}
@@ -2527,7 +2527,7 @@
resName, keyword, inLocale,
&gotAvail, truncate, &status);
if(U_FAILURE(status) || (len <= 0)) {
- log_err("FAIL: got len %d, err %s on #%d: %c\t%s\t%s\n",
+ log_err_status(status, "FAIL: got len %d, err %s on #%d: %c\t%s\t%s\n",
len, u_errorName(status),
i/3,expectAvail?'t':'f', inLocale, expectLocale);
} else {
@@ -2971,7 +2971,7 @@
ulocdata_getCLDRVersion(cldrVersion, &status);
if(U_FAILURE(status)) {
/* the show is pretty much over at this point */
- log_err("FAIL: ulocdata_getCLDRVersion() returned %s\n", u_errorName(status));
+ log_err_status(status, "FAIL: ulocdata_getCLDRVersion() returned %s\n", u_errorName(status));
return;
} else {
u_versionToString(cldrVersion, tmp);
diff --git a/test/cintltst/cstrcase.c b/test/cintltst/cstrcase.c
index c1d2fcf..b17734b 100644
--- a/test/cintltst/cstrcase.c
+++ b/test/cintltst/cstrcase.c
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2002-2008, International Business Machines
+* Copyright (C) 2002-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -240,7 +240,7 @@
errorCode=U_ZERO_ERROR;
titleIterChars=ubrk_open(UBRK_CHARACTER, "", beforeTitle, sizeof(beforeTitle)/U_SIZEOF_UCHAR, &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("error: ubrk_open(UBRK_CHARACTER)->%s\n", u_errorName(errorCode));
+ log_err_status(errorCode, "error: ubrk_open(UBRK_CHARACTER)->%s\n", u_errorName(errorCode));
return;
}
@@ -344,7 +344,7 @@
errorCode=U_ZERO_ERROR;
titleIterWord=ubrk_open(UBRK_WORD, "", beforeTitle, sizeof(beforeTitle)/U_SIZEOF_UCHAR, &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("error: ubrk_open(UBRK_WORD)->%s\n", u_errorName(errorCode));
+ log_err_status(errorCode, "error: ubrk_open(UBRK_WORD)->%s\n", u_errorName(errorCode));
return;
}
@@ -895,18 +895,19 @@
0!=u_memcmp(buffer, titleWord, length) ||
buffer[length]!=0
) {
- log_err("ucasemap_toTitle(default iterator)=%ld failed - %s\n", (long)length, u_errorName(errorCode));
+ log_err_status(errorCode, "ucasemap_toTitle(default iterator)=%ld failed - %s\n", (long)length, u_errorName(errorCode));
}
-
- iter=ucasemap_getBreakIterator(csm);
- if(iter==NULL) {
- log_err("ucasemap_getBreakIterator() returns NULL after titlecasing\n");
+ if (U_SUCCESS(errorCode)) {
+ iter=ucasemap_getBreakIterator(csm);
+ if(iter==NULL) {
+ log_err("ucasemap_getBreakIterator() returns NULL after titlecasing\n");
+ }
}
/* Try U_TITLECASE_NO_BREAK_ADJUSTMENT. */
ucasemap_setOptions(csm, U_TITLECASE_NO_BREAK_ADJUSTMENT, &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("error: ucasemap_setOptions(U_TITLECASE_NO_BREAK_ADJUSTMENT) failed - %s\n", u_errorName(errorCode));
+ log_err_status(errorCode, "error: ucasemap_setOptions(U_TITLECASE_NO_BREAK_ADJUSTMENT) failed - %s\n", u_errorName(errorCode));
return;
}
diff --git a/test/cintltst/cturtst.c b/test/cintltst/cturtst.c
index c4a1767..d6ed2b6 100644
--- a/test/cintltst/cturtst.c
+++ b/test/cintltst/cturtst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -96,7 +96,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("tr", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
log_verbose("Testing Turkish Collation with Tertiary strength\n");
@@ -116,7 +116,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("tr", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
log_verbose("Testing Turkish Collation with Primary strength\n");
diff --git a/test/cintltst/cucdapi.c b/test/cintltst/cucdapi.c
index 24a719d..1c368fa 100644
--- a/test/cintltst/cucdapi.c
+++ b/test/cintltst/cucdapi.c
@@ -1,5 +1,5 @@
/********************************************************************
- * Copyright (c) 1997-2008, International Business Machines
+ * Copyright (c) 1997-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
@@ -72,7 +72,7 @@
UScriptCode script[10]={USCRIPT_INVALID_CODE};
uscript_getCode(testNames[i],script,capacity, &err);
if( script[0] != expected[i]){
- log_err("Error getting script code Got: %i Expected: %i for name %s\n",
+ log_data_err("Error getting script code Got: %i Expected: %i for name %s (Error code does not propagate if data is not present. Are you missing data?)\n",
script[0],expected[i],testNames[i]);
numErrors++;
}
@@ -368,12 +368,12 @@
int32_t i;
for(i=0; i<LENGTHOF(falseValues); ++i) {
if(FALSE!=u_getPropertyValueEnum(UCHAR_ALPHABETIC, falseValues[i])) {
- log_err("u_getPropertyValueEnum(UCHAR_ALPHABETIC, \"%s\")!=FALSE\n", falseValues[i]);
+ log_data_err("u_getPropertyValueEnum(UCHAR_ALPHABETIC, \"%s\")!=FALSE (Are you missing data?)\n", falseValues[i]);
}
}
for(i=0; i<LENGTHOF(trueValues); ++i) {
if(TRUE!=u_getPropertyValueEnum(UCHAR_ALPHABETIC, trueValues[i])) {
- log_err("u_getPropertyValueEnum(UCHAR_ALPHABETIC, \"%s\")!=TRUE\n", trueValues[i]);
+ log_data_err("u_getPropertyValueEnum(UCHAR_ALPHABETIC, \"%s\")!=TRUE (Are you missing data?)\n", trueValues[i]);
}
}
}
diff --git a/test/cintltst/cucdtst.c b/test/cintltst/cucdtst.c
index 3fead47..b97fa31 100644
--- a/test/cintltst/cucdtst.c
+++ b/test/cintltst/cucdtst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*******************************************************************************
@@ -98,7 +98,7 @@
u_parseDelimitedFile(backupPath, ';', fields, fieldCount, lineFn, context, pErrorCode);
}
if(U_FAILURE(*pErrorCode)) {
- log_err("error parsing %s: %s\n", filename, u_errorName(*pErrorCode));
+ log_err_status(*pErrorCode, "error parsing %s: %s\n", filename, u_errorName(*pErrorCode));
}
}
@@ -1040,7 +1040,7 @@
*fields[11][1]=0;
i=u_getISOComment(c, buffer, sizeof(buffer), pErrorCode);
if(U_FAILURE(*pErrorCode) || 0!=strcmp(fields[11][0], buffer)) {
- log_err("error: u_getISOComment(U+%04lx) wrong (%s): \"%s\" should be \"%s\"\n",
+ log_err_status(*pErrorCode, "error: u_getISOComment(U+%04lx) wrong (%s): \"%s\" should be \"%s\"\n",
c, u_errorName(*pErrorCode),
U_FAILURE(*pErrorCode) ? buffer : "[error]",
fields[11][0]);
@@ -1838,7 +1838,7 @@
set=uset_openPattern(mirroredPattern, 17, &errorCode);
if (U_FAILURE(errorCode)) {
- log_data_err("uset_openPattern(mirroredPattern, 17, &errorCode) failed!");
+ log_data_err("uset_openPattern(mirroredPattern, 17, &errorCode) failed!\n");
} else {
for(i=0; 0==uset_getItem(set, i, &start, &end, NULL, 0, &errorCode); ++i) {
do {
@@ -2908,7 +2908,7 @@
uset_remove(set1, 0xff65); /* halfwidth variant */
showAMinusB(set1, set2, "[:Hyphen:]", "[:Dash:]", FALSE);
} else {
- log_err("error opening [:Hyphen:] or [:Dash:] - %s\n", u_errorName(errorCode));
+ log_data_err("error opening [:Hyphen:] or [:Dash:] - %s (Are you missing data?)\n", u_errorName(errorCode));
}
/* check that Cf is neither Hyphen nor Dash nor Alphabetic */
@@ -2919,7 +2919,7 @@
showAIntersectB(set3, set2, "[:Cf:]", "[:Dash:]", TRUE);
showAIntersectB(set3, set4, "[:Cf:]", "[:Alphabetic:]", TRUE);
} else {
- log_err("error opening [:Cf:] or [:Alpbabetic:] - %s\n", u_errorName(errorCode));
+ log_data_err("error opening [:Cf:] or [:Alpbabetic:] - %s (Are you missing data?)\n", u_errorName(errorCode));
}
uset_close(set1);
@@ -2966,7 +2966,7 @@
}
}
} else {
- log_err("error opening [:Lowercase:] - %s\n", u_errorName(errorCode));
+ log_data_err("error opening [:Lowercase:] - %s (Are you missing data?)\n", u_errorName(errorCode));
}
uset_close(set1);
@@ -3019,7 +3019,7 @@
"[assigned Math block chars]", "[math blocks]&[:Math:]",
TRUE);
} else {
- log_err("error opening [math blocks] or [:Math:] or [:Cn:] - %s\n", u_errorName(errorCode));
+ log_data_err("error opening [math blocks] or [:Math:] or [:Cn:] - %s (Are you missing data?)\n", u_errorName(errorCode));
}
uset_close(set1);
uset_close(set2);
@@ -3034,7 +3034,7 @@
"[:sc=Unknown:]", "[[:Cn:][:Co:][:Cs:]]",
TRUE);
} else {
- log_err("error opening [:sc=Unknown:] or [[:Cn:][:Co:][:Cs:]] - %s\n", u_errorName(errorCode));
+ log_data_err("error opening [:sc=Unknown:] or [[:Cn:][:Co:][:Cs:]] - %s (Are you missing data?)\n", u_errorName(errorCode));
}
uset_close(set1);
uset_close(set2);
diff --git a/test/cintltst/currtest.c b/test/cintltst/currtest.c
index 15ee318..7bcc804 100644
--- a/test/cintltst/currtest.c
+++ b/test/cintltst/currtest.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2005-2008, International Business Machines Corporation and
+ * Copyright (c) 2005-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
#include "unicode/utypes.h"
@@ -163,7 +163,7 @@
const char expectedSecond[] = "123,46\\u00A0Ft";
const char expectedThird[] = "123,456\\u00A0Ft";
if (U_FAILURE(status)) {
- log_err("Error: unum_open returned %s\n", myErrorName(status));
+ log_data_err("Error: unum_open returned %s (Are you missing data?)\n", myErrorName(status));
return;
}
/* Make sure that you can format normal fraction digits. */
@@ -203,7 +203,7 @@
status = U_ZERO_ERROR;
parser = unum_open(UNUM_CURRENCY, NULL, -1, "en_US", NULL, &status);
if (U_FAILURE(status)) {
- log_err("Error: unum_open returned %s\n", u_errorName(status));
+ log_data_err("Error: unum_open returned %s (Are you missing data?)\n", u_errorName(status));
return;
}
diff --git a/test/cintltst/encoll.c b/test/cintltst/encoll.c
index 1c48eca..5d4ff5c 100644
--- a/test/cintltst/encoll.c
+++ b/test/cintltst/encoll.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2003, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@@ -267,7 +267,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("en_US", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
log_verbose("Testing English Collation with Tertiary strength\n");
@@ -309,7 +309,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("en_US", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
ucol_setStrength(myCollation, UCOL_PRIMARY);
@@ -328,7 +328,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = ucol_open("en_US", &status);
if(U_FAILURE(status)){
- log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
+ log_err_status(status, "ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
}
ucol_setStrength(myCollation, UCOL_SECONDARY);
diff --git a/test/cintltst/hpmufn.c b/test/cintltst/hpmufn.c
index 9af3017..eedd44f 100644
--- a/test/cintltst/hpmufn.c
+++ b/test/cintltst/hpmufn.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2003-2006, International Business Machines Corporation and
+ * Copyright (c) 2003-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*
@@ -47,7 +47,7 @@
#define TEST_STATUS(status, expected) \
if (status != expected) { \
-log_err("FAIL at %s:%d. Actual status = \"%s\"; Expected status = \"%s\"\n", \
+log_err_status(status, "FAIL at %s:%d. Actual status = \"%s\"; Expected status = \"%s\"\n", \
__FILE__, __LINE__, u_errorName(status), u_errorName(expected)); gMutexFailures++; }
diff --git a/test/cintltst/idnatest.c b/test/cintltst/idnatest.c
index 6196523..850812f 100644
--- a/test/cintltst/idnatest.c
+++ b/test/cintltst/idnatest.c
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
- * Copyright (C) 2003-2007, International Business Machines
+ * Copyright (C) 2003-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -107,7 +107,7 @@
}
if(status != expectedStatus){
- log_err( "Did not get the expected error for %s null terminated source failed. Expected: %s Got: %s\n",testName, u_errorName(expectedStatus), u_errorName(status));
+ log_err_status(status, "Did not get the expected error for %s null terminated source failed. Expected: %s Got: %s\n",testName, u_errorName(expectedStatus), u_errorName(status));
free(tSrc);
return;
}
@@ -467,7 +467,7 @@
bufLen = u_unescape(domainNames[i],buf, bufLen+1);
func(buf,bufLen,expected,MAX_DEST_SIZE, UIDNA_ALLOW_UNASSIGNED, &parseError,&status);
if(U_FAILURE(status)){
- log_err( "%s failed to convert domainNames[%i].Error: %s \n",testName, i, u_errorName(status));
+ log_err_status(status, "%s failed to convert domainNames[%i].Error: %s \n",testName, i, u_errorName(status));
break;
}
testAPI(buf,expected,testName,FALSE,U_ZERO_ERROR, TRUE, TRUE, func);
@@ -497,7 +497,7 @@
bufLen = u_unescape(domainNames[i],buf, bufLen+1);
func(buf,bufLen,expected,MAX_DEST_SIZE, UIDNA_ALLOW_UNASSIGNED, &parseError,&status);
if(U_FAILURE(status)){
- log_err( "%s failed to convert domainNames[%i].Error: %s \n",testName,i, u_errorName(status));
+ log_err_status(status, "%s failed to convert domainNames[%i].Error: %s \n",testName,i, u_errorName(status));
break;
}
testAPI(buf,expected,testName, FALSE,U_ZERO_ERROR, TRUE, TRUE, func);
@@ -526,7 +526,7 @@
log_err("Did not get the expected result for %s with null termniated strings.\n",testName);
}
if(U_FAILURE(status)){
- log_err( "%s null terminated source failed. Error: %s\n", testName,u_errorName(status));
+ log_err_status(status, "%s null terminated source failed. Error: %s\n", testName,u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -536,7 +536,7 @@
log_err("Did not get the expected result for %s with null termniated strings with options set.\n", testName);
}
if(U_FAILURE(status)){
- log_err( "%s null terminated source and options set failed. Error: %s\n",testName, u_errorName(status));
+ log_err_status(status, "%s null terminated source and options set failed. Error: %s\n",testName, u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -546,7 +546,7 @@
log_err("Did not get the expected result for %s with string length.\n",testName);
}
if(U_FAILURE(status)){
- log_err( "%s with string length. Error: %s\n",testName, u_errorName(status));
+ log_err_status(status, "%s with string length. Error: %s\n",testName, u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -556,7 +556,7 @@
log_err("Did not get the expected result for %s with string length and options set.\n",testName);
}
if(U_FAILURE(status)){
- log_err( "%s with string length and options set. Error: %s\n", u_errorName(status), testName);
+ log_err_status(status, "%s with string length and options set. Error: %s\n", u_errorName(status), testName);
}
}
@@ -684,13 +684,13 @@
int32_t dest2Len = 40;
dest1Len = uidna_toASCII(src1, src1Len, dest1, dest1Len,UIDNA_DEFAULT, &ps, &status);
if(U_FAILURE(status)){
- log_err("uidna_toUnicode failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toUnicode failed with error %s.\n", u_errorName(status));
}
src2 = dest1;
src2Len = dest1Len;
dest2Len = uidna_toUnicode(src2, src2Len, dest2, dest2Len, UIDNA_DEFAULT, &ps, &status);
if(U_FAILURE(status)){
- log_err("uidna_toUnicode failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toUnicode failed with error %s.\n", u_errorName(status));
}
}
}
@@ -713,7 +713,8 @@
destLen = uidna_toASCII(src, srcLen, dest, destLen,UIDNA_DEFAULT, &ps, &status);
if(U_FAILURE(status)){
- log_err("uidna_toASCII failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toASCII failed with error %s.\n", u_errorName(status));
+ continue;
}
if(u_strncmp(input[i], dest, srcLen)!=0){
log_err("uidna_toASCII did not return the expected output.\n");
@@ -753,7 +754,7 @@
u_charsToUChars(cl, ul, len+1);
destLen = uidna_toUnicode(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_ZERO_ERROR){
- log_err("uidna_toUnicode failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toUnicode failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -761,14 +762,14 @@
len = -1;
destLen = uidna_toUnicode(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_ZERO_ERROR){
- log_err("uidna_toUnicode failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toUnicode failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
destLen = LENGTHOF(dest);
len = (int32_t)strlen(cl);
destLen = uidna_toASCII(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_LABEL_TOO_LONG_ERROR){
- log_err("uidna_toASCII failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toASCII failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -776,14 +777,14 @@
len = -1;
destLen = uidna_toASCII(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_LABEL_TOO_LONG_ERROR){
- log_err("uidna_toASCII failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toASCII failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
destLen = LENGTHOF(dest);
destLen = uidna_toASCII(ul1, len1, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_ZERO_ERROR){
- log_err("uidna_toASCII failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toASCII failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -791,7 +792,7 @@
len1 = -1;
destLen = uidna_toASCII(ul1, len1, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_ZERO_ERROR){
- log_err("uidna_toASCII failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_toASCII failed with error %s.\n", u_errorName(status));
}
}
{
@@ -806,7 +807,7 @@
destLen = uidna_IDNToUnicode(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
- log_err("uidna_IDNToUnicode failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_IDNToUnicode failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -814,7 +815,7 @@
len = -1;
destLen = uidna_IDNToUnicode(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
- log_err("uidna_IDNToUnicode failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_IDNToUnicode failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -822,7 +823,7 @@
len = (int32_t)strlen(cl);
destLen = uidna_IDNToASCII(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
- log_err("uidna_IDNToASCII failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_IDNToASCII failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -830,17 +831,17 @@
len = -1;
destLen = uidna_IDNToASCII(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
- log_err("uidna_IDNToASCII failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_IDNToASCII failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
uidna_compare(ul, len, ul, len, UIDNA_DEFAULT, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
- log_err("uidna_compare failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_compare failed with error %s.\n", u_errorName(status));
}
uidna_compare(ul, -1, ul, -1, UIDNA_DEFAULT, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
- log_err("uidna_compare failed with error %s.\n", u_errorName(status));
+ log_err_status(status, "uidna_compare failed with error %s.\n", u_errorName(status));
}
}
}
@@ -853,23 +854,23 @@
UParseError prsError;
int32_t outLen = uidna_toUnicode(invalid_idn, len, output, 50, UIDNA_DEFAULT, &prsError, &status);
if(U_FAILURE(status)){
- log_err("uidna_toUnicode failed with error: %s\n", u_errorName(status));
+ log_err_status(status, "uidna_toUnicode failed with error: %s\n", u_errorName(status));
}
status = U_ZERO_ERROR;
outLen = uidna_toUnicode(invalid_idn, len, output, 50, UIDNA_USE_STD3_RULES, &prsError, &status);
if(U_FAILURE(status)){
- log_err("uidna_toUnicode failed with error: %s\n", u_errorName(status));
+ log_err_status(status, "uidna_toUnicode failed with error: %s\n", u_errorName(status));
}
status = U_ZERO_ERROR;
outLen = uidna_IDNToUnicode(invalid_idn, len, output, 50, UIDNA_DEFAULT, &prsError, &status);
if(U_FAILURE(status)){
- log_err("uidna_toUnicode failed with error: %s\n", u_errorName(status));
+ log_err_status(status, "uidna_toUnicode failed with error: %s\n", u_errorName(status));
}
status = U_ZERO_ERROR;
outLen = uidna_IDNToUnicode(invalid_idn, len, output, 50, UIDNA_USE_STD3_RULES, &prsError, &status);
if(U_FAILURE(status)){
- log_err("uidna_toUnicode failed with error: %s\n", u_errorName(status));
+ log_err_status(status, "uidna_toUnicode failed with error: %s\n", u_errorName(status));
}
}
#endif
diff --git a/test/cintltst/ncnvtst.c b/test/cintltst/ncnvtst.c
index b6dd52a..50f66ae 100644
--- a/test/cintltst/ncnvtst.c
+++ b/test/cintltst/ncnvtst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2007, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
@@ -1944,7 +1944,7 @@
name=ucnv_getAvailableName(i);
cnv=ucnv_open(name, &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("error: unable to open converter %s - %s\n",
+ log_data_err("error: unable to open converter %s - %s\n",
name, u_errorName(errorCode));
continue;
}
@@ -1967,7 +1967,7 @@
name=completeSetNames[i];
cnv=ucnv_open(name, &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("error: unable to open converter %s - %s\n",
+ log_data_err("error: unable to open converter %s - %s\n",
name, u_errorName(errorCode));
continue;
}
@@ -1990,7 +1990,7 @@
name=lmbcsNames[i];
cnv=ucnv_open(name, &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("error: unable to open converter %s - %s\n",
+ log_data_err("error: unable to open converter %s - %s\n",
name, u_errorName(errorCode));
continue;
}
diff --git a/test/cintltst/nucnvtst.c b/test/cintltst/nucnvtst.c
index a27887e..f504f27 100644
--- a/test/cintltst/nucnvtst.c
+++ b/test/cintltst/nucnvtst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*******************************************************************************
@@ -2482,7 +2482,7 @@
UErrorCode errorCode=U_ZERO_ERROR;
UConverter *cnv=ucnv_open("LATIN_1", &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("Unable to open a LATIN_1 converter: %s\n", u_errorName(errorCode));
+ log_data_err("Unable to open a LATIN_1 converter: %s\n", u_errorName(errorCode));
return;
}
TestNextUChar(cnv, source, limit, results, "LATIN_1");
@@ -5292,7 +5292,7 @@
}
myCollator = ucol_open("zh", &status);
if(U_FAILURE(status)){
- log_err("Could not open collator for zh locale. Error: %s\n", u_errorName(status));
+ log_data_err("Could not open collator for zh locale. Error: %s\n", u_errorName(status));
ucnv_close(utf8cnv);
return;
}
@@ -5376,6 +5376,12 @@
const char* source = data;
const char* sourceLimit = data+strlen(data);
const UChar* exp = expected;
+
+ if (U_FAILURE(status)) {
+ log_data_err("Unable to open converter: iscii-gur got errorCode: %s\n", u_errorName(status));
+ return;
+ }
+
log_verbose("Testing switching back to default script when new line is encountered.\n");
ucnv_toUnicode(conv, &target, targetLimit, &source, sourceLimit, NULL, TRUE, &status);
if(U_FAILURE(status)){
diff --git a/test/cintltst/reapits.c b/test/cintltst/reapits.c
index 3dd2014..89bc44c 100644
--- a/test/cintltst/reapits.c
+++ b/test/cintltst/reapits.c
@@ -29,10 +29,10 @@
#include "cintltst.h"
#define TEST_ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \
-log_err("Failure at file %s, line %d, error = %s\n", __FILE__, __LINE__, u_errorName(status));}}
+log_data_err("Failure at file %s, line %d, error = %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status));}}
#define TEST_ASSERT(expr) {if ((expr)==FALSE) { \
-log_err("Test Failure at file %s, line %d\n", __FILE__, __LINE__);}}
+log_data_err("Test Failure at file %s, line %d (Are you missing data?)\n", __FILE__, __LINE__);}}
/*
* TEST_SETUP and TEST_TEARDOWN
@@ -137,7 +137,7 @@
u_uastrncpy(pat, "abc*", sizeof(pat)/2);
re = uregex_open(pat, -1, 0, 0, &status);
if (U_FAILURE(status)) {
- log_err("Failed to open regular expression, line %d, error is \"%s\"\n", __LINE__, u_errorName(status));
+ log_data_err("Failed to open regular expression, line %d, error is \"%s\" (Are you missing data?)\n", __LINE__, u_errorName(status));
return;
}
uregex_close(re);
diff --git a/test/cintltst/spooftest.c b/test/cintltst/spooftest.c
index ac75928..d8e96bd 100644
--- a/test/cintltst/spooftest.c
+++ b/test/cintltst/spooftest.c
@@ -29,7 +29,7 @@
#include "cintltst.h"
#define TEST_ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \
- log_err("Failure at file %s, line %d, error = %s\n", __FILE__, __LINE__, u_errorName(status));}}
+ log_err_status(status, "Failure at file %s, line %d, error = %s\n", __FILE__, __LINE__, u_errorName(status));}}
#define TEST_ASSERT(expr) {if ((expr)==FALSE) { \
log_err("Test Failure at file %s, line %d: \"%s\" is false.\n", __FILE__, __LINE__, #expr);};}
diff --git a/test/cintltst/spreptst.c b/test/cintltst/spreptst.c
index eec7815..ed7ccbf 100644
--- a/test/cintltst/spreptst.c
+++ b/test/cintltst/spreptst.c
@@ -768,7 +768,7 @@
profileName = profile_test_case[i];
sprep = usprep_openByType(getTypeFromProfileName(profileName), &status);
if (U_FAILURE(status)) {
- log_err("Unable to open String Prep Profile with: %s\n", profileName);
+ log_data_err("Unable to open String Prep Profile with: %s\n", profileName);
break;
}
diff --git a/test/cintltst/stdnmtst.c b/test/cintltst/stdnmtst.c
index 2da9614..f8d7319 100644
--- a/test/cintltst/stdnmtst.c
+++ b/test/cintltst/stdnmtst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2000-2007, International Business Machines Corporation and
+ * Copyright (c) 2000-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*
@@ -44,7 +44,7 @@
error = U_ZERO_ERROR;
tag = ucnv_getStandardName(name, standard, &error);
if (!tag && expected) {
- log_err("FAIL: could not find %s standard name for %s\n", standard, name);
+ log_err_status(error, "FAIL: could not find %s standard name for %s\n", standard, name);
res = 0;
} else if (expected && (name == tag || uprv_strcmp(expected, tag))) {
log_err("FAIL: expected %s for %s standard name for %s, got %s\n", expected, standard, name, tag);
@@ -124,7 +124,7 @@
res = 0;
}
else if (!tag && expected) {
- log_err("FAIL: could not find %s canonical name for %s\n", (standard ? "\"\"" : standard), name);
+ log_err_status(error, "FAIL: could not find %s canonical name for %s\n", (standard ? "\"\"" : standard), name);
res = 0;
}
else if (expected && (name == tag || uprv_strcmp(expected, tag) != 0)) {
@@ -173,6 +173,11 @@
const char *enumName, *testName;
int32_t enumCount = uenum_count(myEnum, &err);
int32_t idx, len, repeatTimes = 3;
+
+ if (err == U_FILE_ACCESS_ERROR) {
+ log_data_err("Unable to open standard names for %s of standard: %s\n", name, standard);
+ return 0;
+ }
if (size != enumCount) {
log_err("FAIL: different size arrays for %s. Got %d. Expected %d\n", name, enumCount, size);
return 0;
@@ -219,6 +224,12 @@
UEnumeration *myEnum = ucnv_openStandardNames(name, standard, &err);
int32_t enumCount = uenum_count(myEnum, &err);
int32_t idx, repeatTimes = 3;
+
+ if (err == U_FILE_ACCESS_ERROR) {
+ log_data_err("Unable to open standard names for %s of standard: %s\n", name, standard);
+ return 0;
+ }
+
if (size != enumCount) {
log_err("FAIL: different size arrays. Got %d. Expected %d\n", enumCount, size);
return 0;
diff --git a/test/cintltst/ucnvseltst.c b/test/cintltst/ucnvseltst.c
index ede7c77..bbb0580 100644
--- a/test/cintltst/ucnvseltst.c
+++ b/test/cintltst/ucnvseltst.c
@@ -46,6 +46,10 @@
return TRUE;
}
gCountAvailable = ucnv_countAvailable();
+ if (gCountAvailable == 0) {
+ log_data_err("No converters available.\n");
+ return FALSE;
+ }
gAvailableNames = (const char **)uprv_malloc(gCountAvailable * sizeof(const char *));
if (gAvailableNames == NULL) {
log_err("unable to allocate memory for %ld available converter names\n",
diff --git a/test/cintltst/ucsdetst.c b/test/cintltst/ucsdetst.c
index c571b37..71a0d7f 100644
--- a/test/cintltst/ucsdetst.c
+++ b/test/cintltst/ucsdetst.c
@@ -250,7 +250,7 @@
name = ucsdet_getName(match, &status);
if (strcmp(name, "windows-1252") != 0) {
- log_err("English text with C1 bytes does not detect as windows-1252, but as %s\n", name);
+ log_data_err("English text with C1 bytes does not detect as windows-1252, but as %s. (Are you missing data?)\n", name);
}
ucsdet_setText(csd, bISO, lISO, &status);
@@ -487,7 +487,7 @@
name = ucsdet_getName(match, &status);
if (strcmp(name, "IBM424_rtl") != 0) {
- log_err("Encoding detection failure for IBM424_rtl: got %s\n", name);
+ log_data_err("Encoding detection failure for IBM424_rtl: got %s. (Are you missing data?)\n", name);
}
ucsdet_setText(csd, bytes_r, brLength, &status);
@@ -500,7 +500,7 @@
name = ucsdet_getName(match, &status);
if (strcmp(name, "IBM424_ltr") != 0) {
- log_err("Encoding detection failure for IBM424_ltr: got %s\n", name);
+ log_data_err("Encoding detection failure for IBM424_ltr: got %s. (Are you missing data?)\n", name);
}
bail:
@@ -565,7 +565,7 @@
name = ucsdet_getName(match, &status);
if (strcmp(name, "IBM420_rtl") != 0) {
- log_err("Encoding detection failure for IBM420_rtl: got %s\n", name);
+ log_data_err("Encoding detection failure for IBM420_rtl: got %s. (Are you missing data?)\n", name);
}
ucsdet_setText(csd, bytes_r, brLength, &status);
@@ -578,7 +578,7 @@
name = ucsdet_getName(match, &status);
if (strcmp(name, "IBM420_ltr") != 0) {
- log_err("Encoding detection failure for IBM420_ltr: got %s\n", name);
+ log_data_err("Encoding detection failure for IBM420_ltr: got %s. (Are you missing data?)\n", name);
}
bail:
diff --git a/test/cintltst/udatatst.c b/test/cintltst/udatatst.c
index 502f079..2e7f8cb 100644
--- a/test/cintltst/udatatst.c
+++ b/test/cintltst/udatatst.c
@@ -497,7 +497,7 @@
u_setDataDirectory(icuDataDir);
u_init(&status);
if(U_FAILURE(status)){
- log_err("%s\n", u_errorName(status));
+ log_err_status(status, "%s\n", u_errorName(status));
}
free(icuDataDir);
ctest_resetICU();
diff --git a/test/cintltst/udatpg_test.c b/test/cintltst/udatpg_test.c
index 0e53345..488e350 100644
--- a/test/cintltst/udatpg_test.c
+++ b/test/cintltst/udatpg_test.c
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2007, International Business Machines
+* Copyright (C) 2007-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -76,7 +76,7 @@
/* Open a DateTimePatternGenerator for the default locale. */
dtpg=udatpg_open(NULL, &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("udatpg_open(NULL) failed - %s\n", u_errorName(errorCode));
+ log_err_status(errorCode, "udatpg_open(NULL) failed - %s\n", u_errorName(errorCode));
return;
}
udatpg_close(dtpg);
@@ -120,7 +120,7 @@
dtpg=udatpg_open("fi", &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("udatpg_open(fi) failed - %s\n", u_errorName(errorCode));
+ log_err_status(errorCode, "udatpg_open(fi) failed - %s\n", u_errorName(errorCode));
return;
}
length = udatpg_getBestPattern(dtpg, testSkeleton1, 4,
diff --git a/test/cintltst/usettest.c b/test/cintltst/usettest.c
index 77918f1..6e321a3 100644
--- a/test/cintltst/usettest.c
+++ b/test/cintltst/usettest.c
@@ -286,7 +286,7 @@
(isIn ? "contains" : "does not contain"),
strCopy);
} else {
- log_err("FAIL: %s %s \"%s\"\n", pat,
+ log_data_err("FAIL: %s %s \"%s\" (Are you missing data?)\n", pat,
(isIn ? "does not contain" : "contains"),
strCopy);
}
@@ -303,7 +303,7 @@
(isIn ? "contains" : "does not contain"),
*p);
} else {
- log_err("FAIL: %s %s '%c'\n", pat,
+ log_data_err("FAIL: %s %s '%c' (Are you missing data?)\n", pat,
(isIn ? "does not contain" : "contains"),
*p);
}
@@ -318,7 +318,7 @@
(isIn ? "contains" : "does not contain"),
rangeStart, rangeEnd);
} else {
- log_err("FAIL: %s %s U+%04X-U+%04X\n", pat,
+ log_data_err("FAIL: %s %s U+%04X-U+%04X (Are you missing data?)\n", pat,
(isIn ? "does not contain" : "contains"),
rangeStart, rangeEnd);
}
@@ -336,7 +336,7 @@
(isIn ? "contains" : "does not contain"),
rangeStart, rangeEnd);
} else {
- log_err("FAIL: %s %s U+%04X-U+%04X\n", pat,
+ log_data_err("FAIL: %s %s U+%04X-U+%04X (Are you missing data?)\n", pat,
(isIn ? "does not contain" : "contains"),
rangeStart, rangeEnd);
}
@@ -374,7 +374,7 @@
pat=aescstrdup(ustr, length);
if (uset_isEmpty(set) != (strlen(items)==0)) {
- log_err("FAIL: %s should return %s from isEmpty\n",
+ log_data_err("FAIL: %s should return %s from isEmpty (Are you missing data?)\n",
pat,
strlen(items)==0 ? "TRUE" : "FALSE");
}
@@ -391,7 +391,7 @@
if (start > end || start == -1) {
/* Fetch our next item */
if (itemIndex >= itemCount) {
- log_err("FAIL: ran out of items iterating %s\n", pat);
+ log_data_err("FAIL: ran out of items iterating %s (Are you missing data?)\n", pat);
return;
}
@@ -488,7 +488,7 @@
errorCode=U_ZERO_ERROR;
set=uset_openPattern(pattern, -1, &errorCode);
if(U_FAILURE(errorCode)) {
- log_err("uset_openPattern([:Cf:]) failed - %s\n", u_errorName(errorCode));
+ log_data_err("uset_openPattern([:Cf:]) failed - %s (Are you missing data?)\n", u_errorName(errorCode));
return;
}
@@ -556,7 +556,7 @@
idSet=openIDSet();
if (idSet == NULL) {
- log_err("openIDSet() returned NULL\n");
+ log_data_err("openIDSet() returned NULL. (Are you missing data?)\n");
uset_close(idSet);
return;
}
@@ -606,7 +606,7 @@
USet *idSet=openIDSet();
if (idSet == NULL) {
- log_err("openIDSet() returned NULL\n");
+ log_data_err("openIDSet() returned NULL (Are you missing data?)\n");
return;
}
diff --git a/test/cintltst/usrchtst.c b/test/cintltst/usrchtst.c
index cda8cbf..7b5982d 100644
--- a/test/cintltst/usrchtst.c
+++ b/test/cintltst/usrchtst.c
@@ -48,24 +48,21 @@
/**
* Opening all static collators and break iterators
*/
-static void open(void)
+static void open(UErrorCode* status)
{
if (TOCLOSE_) {
- UErrorCode status = U_ZERO_ERROR;
UChar rules[1024];
int32_t rulelength = 0;
+ *status = U_ZERO_ERROR;
- EN_US_ = ucol_open("en_US", &status);
- if(status == U_FILE_ACCESS_ERROR) {
- log_data_err("Is your data around?\n");
- return;
- } else if(U_FAILURE(status)) {
- log_err("Error opening collator\n");
+ EN_US_ = ucol_open("en_US", status);
+ if(U_FAILURE(*status)) {
+ log_err_status(*status, "Error opening collator\n");
return;
}
- FR_FR_ = ucol_open("fr_FR", &status);
- DE_ = ucol_open("de_DE", &status);
- ES_ = ucol_open("es_ES", &status);
+ FR_FR_ = ucol_open("fr_FR", status);
+ DE_ = ucol_open("de_DE", status);
+ ES_ = ucol_open("es_ES", status);
u_strcpy(rules, ucol_getRules(DE_, &rulelength));
u_unescape(EXTRACOLLATIONRULE, rules + rulelength, 1024 - rulelength);
@@ -73,17 +70,17 @@
ucol_close(DE_);
DE_ = ucol_openRules(rules, u_strlen(rules), UCOL_ON, UCOL_TERTIARY,
- (UParseError *)NULL, &status);
+ (UParseError *)NULL, status);
u_strcpy(rules, ucol_getRules(ES_, &rulelength));
u_unescape(EXTRACOLLATIONRULE, rules + rulelength, 1024 - rulelength);
ucol_close(ES_);
ES_ = ucol_openRules(rules, u_strlen(rules), UCOL_ON, UCOL_TERTIARY,
- NULL, &status);
+ NULL, status);
#if !UCONFIG_NO_BREAK_ITERATION
- EN_WORDBREAKER_ = ubrk_open(UBRK_WORD, "en_US", NULL, 0, &status);
+ EN_WORDBREAKER_ = ubrk_open(UBRK_WORD, "en_US", NULL, 0, status);
EN_CHARACTERBREAKER_ = ubrk_open(UBRK_CHARACTER, "en_US", NULL, 0,
- &status);
+ status);
#endif
TOCLOSE_ = TRUE;
}
@@ -94,7 +91,12 @@
*/
static void TestStart(void)
{
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
TOCLOSE_ = FALSE;
}
@@ -241,17 +243,25 @@
status = U_ZERO_ERROR;
result = usearch_open(pattern, 3, text, 6, "en_US", NULL, &status);
if (U_FAILURE(status) || result == NULL) {
- log_err("Error: NULL break iterator is valid for opening search\n");
+ log_err_status(status, "Error: NULL break iterator is valid for opening search\n");
}
else {
usearch_close(result);
}
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
status = U_ZERO_ERROR;
result = usearch_openFromCollator(pattern, 3, text, 6, EN_US_, NULL,
&status);
if (U_FAILURE(status) || result == NULL) {
- log_err("Error: NULL break iterator is valid for opening search\n");
+ if (EN_US_ == NULL) {
+ log_data_err("Opening collator failed.\n");
+ } else {
+ log_err("Error: NULL break iterator is valid for opening search\n");
+ }
}
else {
usearch_close(result);
@@ -263,7 +273,7 @@
result = usearch_open(pattern, 3, text, 6, "en_US", breakiter, &status);
if (U_FAILURE(status) || result == NULL) {
- log_err("Error: Break iterator is valid for opening search\n");
+ log_err_status(status, "Error: Break iterator is valid for opening search\n");
}
else {
usearch_close(result);
@@ -272,7 +282,11 @@
result = usearch_openFromCollator(pattern, 3, text, 6, EN_US_, breakiter,
&status);
if (U_FAILURE(status) || result == NULL) {
- log_err("Error: Break iterator is valid for opening search\n");
+ if (EN_US_ == NULL) {
+ log_data_err("Opening collator failed.\n");
+ } else {
+ log_err("Error: Break iterator is valid for opening search\n");
+ }
}
else {
usearch_close(result);
@@ -293,7 +307,11 @@
/* simple test on the pattern ce construction */
pattern[0] = 0x41;
pattern[1] = 0x42;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
result = usearch_openFromCollator(pattern, 2, text, 3, EN_US_, NULL,
&status);
if (U_FAILURE(status)) {
@@ -462,7 +480,7 @@
ucol_setStrength(collator, search.strength);
ucol_setAttribute(collator, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator,
- breaker, &status);
+ breaker, &status);
usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON,
&status);
if (U_FAILURE(status)) {
@@ -524,7 +542,12 @@
static void TestBasic(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (BASIC[count].text != NULL) {
if (!assertEqual(BASIC[count])) {
log_err("Error at test number %d\n", count);
@@ -538,7 +561,11 @@
{
int count = 0;
UErrorCode status = U_ZERO_ERROR;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
ucol_setAttribute(EN_US_, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
if (U_FAILURE(status)) {
log_err("Error setting collation normalization %s\n",
@@ -571,7 +598,12 @@
static void TestStrength(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (STRENGTH[count].text != NULL) {
if (!assertEqual(STRENGTH[count])) {
log_err("Error at test number %d\n", count);
@@ -591,7 +623,11 @@
CHECK_BREAK("x");
#if !UCONFIG_NO_BREAK_ITERATION
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
if (usearch_getBreakIterator(NULL) != NULL) {
log_err("Expected NULL breakiterator from NULL string search\n");
}
@@ -686,7 +722,11 @@
{
int count = 0;
UErrorCode status = U_ZERO_ERROR;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
ucol_setAttribute(EN_US_, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &status);
if (U_FAILURE(status)) {
log_err("Error setting collation alternate attribute %s\n",
@@ -707,7 +747,12 @@
static void TestOverlap(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (OVERLAP[count].text != NULL) {
if (!assertEqualWithAttribute(OVERLAP[count], USEARCH_OFF,
USEARCH_ON)) {
@@ -730,7 +775,7 @@
const SearchData *search = &(OVERLAP[count]);
UCollator *collator = getCollator(search->collator);
UStringSearch *strsrch;
- UErrorCode status = U_ZERO_ERROR;
+ status = U_ZERO_ERROR;
u_unescape(search->text, text, 128);
u_unescape(search->pattern, pattern, 32);
@@ -806,7 +851,7 @@
}
usearch_close(strsrch);
- open();
+ open(&status);
if (usearch_getCollator(NULL) != NULL) {
log_err("Expected NULL collator from NULL string search\n");
@@ -866,7 +911,11 @@
int32_t templength;
UErrorCode status = U_ZERO_ERROR;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
if (usearch_getPattern(NULL, &templength) != NULL) {
log_err("Error NULL string search expected returning NULL pattern\n");
}
@@ -971,7 +1020,11 @@
u_unescape(TEXT[0].text, text, 128);
u_unescape(TEXT[0].pattern, pattern, 32);
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
if (usearch_getText(NULL, &templength) != NULL) {
log_err("Error NULL string search should return NULL text\n");
@@ -1035,7 +1088,12 @@
static void TestCompositeBoundaries(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (COMPOSITEBOUNDARIES[count].text != NULL) {
log_verbose("composite %d\n", count);
if (!assertEqual(COMPOSITEBOUNDARIES[count])) {
@@ -1056,7 +1114,11 @@
memset(pattern, 0, 32*sizeof(UChar));
memset(text, 0, 128*sizeof(UChar));
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
if (usearch_getOffset(NULL) != USEARCH_DONE) {
log_err("usearch_getOffset(NULL) expected USEARCH_DONE\n");
}
@@ -1154,7 +1216,11 @@
memset(pattern, 0, 32*sizeof(UChar));
memset(text, 0, 128*sizeof(UChar));
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
if (usearch_getAttribute(NULL, USEARCH_OVERLAP) != USEARCH_DEFAULT ||
usearch_getAttribute(NULL, USEARCH_CANONICAL_MATCH) !=
USEARCH_DEFAULT) {
@@ -1238,7 +1304,11 @@
int32_t textlength;
UChar matchtext[128];
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
if (usearch_getMatchedStart(NULL) != USEARCH_DONE ||
usearch_getMatchedLength(NULL) != USEARCH_DONE) {
@@ -1325,8 +1395,12 @@
static void TestSetMatch(void)
{
int count = 0;
-
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (MATCH[count].text != NULL) {
SearchData search = MATCH[count];
int size = 0;
@@ -1334,7 +1408,7 @@
UChar text[128];
UChar pattern[32];
UStringSearch *strsrch;
- UErrorCode status = U_ZERO_ERROR;
+ status = U_ZERO_ERROR;
if (usearch_first(NULL, &status) != USEARCH_DONE ||
usearch_last(NULL, &status) != USEARCH_DONE) {
@@ -1408,7 +1482,11 @@
UChar pattern[] = {0x73};
UStringSearch *strsrch;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
strsrch = usearch_openFromCollator(pattern, 1, text, 9,
EN_US_, NULL, &status);
if (U_FAILURE(status)) {
@@ -1448,7 +1526,12 @@
static void TestSupplementary(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (SUPPLEMENTARY[count].text != NULL) {
if (!assertEqual(SUPPLEMENTARY[count])) {
log_err("Error at test number %d\n", count);
@@ -1560,7 +1643,7 @@
strsrch = usearch_open(pattern, 1, text, 1, uloc_getDefault(), NULL, &status);
if (U_FAILURE(status)) {
- log_err("Error opening string search %s\n", u_errorName(status));
+ log_err_status(status, "Error opening string search %s\n", u_errorName(status));
return;
}
@@ -1601,7 +1684,12 @@
static void TestCanonical(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (BASICCANONICAL[count].text != NULL) {
if (!assertCanonicalEqual(BASICCANONICAL[count])) {
log_err("Error at test number %d\n", count);
@@ -1615,7 +1703,11 @@
{
int count = 0;
UErrorCode status = U_ZERO_ERROR;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
ucol_setAttribute(EN_US_, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
count = 0;
while (NORMCANONICAL[count].text != NULL) {
@@ -1631,7 +1723,12 @@
static void TestStrengthCanonical(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (STRENGTHCANONICAL[count].text != NULL) {
if (!assertCanonicalEqual(STRENGTHCANONICAL[count])) {
log_err("Error at test number %d\n", count);
@@ -1649,7 +1746,11 @@
#if !UCONFIG_NO_BREAK_ITERATION
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (count < 4) {
/* 0-3 test are fixed */
UChar pattern[32];
@@ -1722,7 +1823,11 @@
{
int count = 0;
UErrorCode status = U_ZERO_ERROR;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
ucol_setAttribute(EN_US_, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &status);
if (U_FAILURE(status)) {
log_err("Error setting collation alternate attribute %s\n",
@@ -1743,7 +1848,12 @@
static void TestOverlapCanonical(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (OVERLAPCANONICAL[count].text != NULL) {
if (!assertEqualWithAttribute(OVERLAPCANONICAL[count], USEARCH_ON,
USEARCH_ON)) {
@@ -1766,7 +1876,7 @@
const SearchData *search = &(OVERLAPCANONICAL[count]);
UCollator *collator = getCollator(search->collator);
UStringSearch *strsrch;
- UErrorCode status = U_ZERO_ERROR;
+ status = U_ZERO_ERROR;
u_unescape(search->text, text, 128);
u_unescape(search->pattern, pattern, 32);
@@ -1818,7 +1928,11 @@
UChar text[128];
UStringSearch *strsrch;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
u_unescape(COLLATORCANONICAL[0].text, text, 128);
u_unescape(COLLATORCANONICAL[0].pattern, pattern, 32);
@@ -1886,7 +2000,11 @@
int32_t templength;
UErrorCode status = U_ZERO_ERROR;
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
u_unescape(PATTERNCANONICAL[0].text, text, 128);
u_unescape(PATTERNCANONICAL[0].pattern, pattern, 32);
@@ -1960,7 +2078,11 @@
u_unescape(TEXTCANONICAL[0].text, text, 128);
u_unescape(TEXTCANONICAL[0].pattern, pattern, 32);
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_,
NULL, &status);
usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON,
@@ -2015,7 +2137,12 @@
static void TestCompositeBoundariesCanonical(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (COMPOSITEBOUNDARIESCANONICAL[count].text != NULL) {
log_verbose("composite %d\n", count);
if (!assertCanonicalEqual(COMPOSITEBOUNDARIESCANONICAL[count])) {
@@ -2038,7 +2165,11 @@
memset(pattern, 0, 32*sizeof(UChar));
memset(text, 0, 128*sizeof(UChar));
- open();
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
strsrch = usearch_openFromCollator(pattern, 16, text, 32, EN_US_, NULL,
&status);
@@ -2123,7 +2254,12 @@
static void TestSupplementaryCanonical(void)
{
int count = 0;
- open();
+ UErrorCode status = U_ZERO_ERROR;
+ open(&status);
+ if (U_FAILURE(status)) {
+ log_err_status(status, "Unable to open static collators %s\n", u_errorName(status));
+ return;
+ }
while (SUPPLEMENTARYCANONICAL[count].text != NULL) {
if (!assertCanonicalEqual(SUPPLEMENTARYCANONICAL[count])) {
log_err("Error at test number %d\n", count);
@@ -2221,7 +2357,7 @@
coll = ucol_open("en_GB", &status);
if (U_FAILURE(status)) {
- log_err("ucol_open failed: %s\n", u_errorName(status));
+ log_err_status(status, "ucol_open failed: %s\n", u_errorName(status));
goto exitTestForwardBackward;
}
ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_PRIMARY, &status);
@@ -2263,7 +2399,7 @@
}
#define TEST_ASSERT(x) \
- {if ((x)==FALSE) {log_err("%s:%d: FAIL: test assertion failure \"%s\"\n", __FILE__, __LINE__, #x);\
+ {if (U_FAILURE(x)) {log_err_status(x, "%s:%d: FAIL: test assertion failure \n", __FILE__, __LINE__);\
}}
static void TestSearchForNull(void) {
@@ -2317,35 +2453,37 @@
coll = ucol_open("en_US", &ec);
/* make sure we didn't fail. */
- TEST_ASSERT (U_SUCCESS (ec));
+ TEST_ASSERT (ec);
ucol_setStrength(coll, UCOL_IDENTICAL);
/* open a search looking for 0 */
search = usearch_openFromCollator(pattern, PATTERN_LEN, text,
TEXT_LEN, coll, NULL, &ec);
- TEST_ASSERT (U_SUCCESS (ec));
+ TEST_ASSERT (ec);
+
+ if (coll != NULL && search != NULL) {
+ pos = usearch_first(search, &ec);
+ len = usearch_getMatchedLength(search);
+ if (pos != expectedPos) {
+ log_err("Expected search result: %d; Got instead: %d\n", expectedPos,
+ pos);
+ }
- pos = usearch_first(search, &ec);
- len = usearch_getMatchedLength(search);
- if (pos != expectedPos) {
- log_err("Expected search result: %d; Got instead: %d\n", expectedPos,
- pos);
- }
+ if (len != expectedLen) {
+ log_err("Expected search result length: %d; Got instead: %d\n",
+ expectedLen, len);
+ }
- if (len != expectedLen) {
- log_err("Expected search result length: %d; Got instead: %d\n",
- expectedLen, len);
- }
+ for (pos = usearch_first(search, &ec); pos != USEARCH_DONE; pos
+ = usearch_next(search, &ec)) {
+ log_verbose("Match at %d\n", pos);
+ count += 1;
+ }
- for (pos = usearch_first(search, &ec); pos != USEARCH_DONE; pos
- = usearch_next(search, &ec)) {
- log_verbose("Match at %d\n", pos);
- count += 1;
- }
-
- if (count != expectedNum) {
- log_err("Expected %d search hits, found %d\n", expectedNum, count);
+ if (count != expectedNum) {
+ log_err("Expected %d search hits, found %d\n", expectedNum, count);
+ }
}
ucol_close(coll);
@@ -2372,35 +2510,37 @@
coll = ucol_open ("en_US", &ec);
/* make sure we didn't fail. */
- TEST_ASSERT (U_SUCCESS (ec));
+ TEST_ASSERT (ec);
ucol_setStrength( coll, UCOL_TERTIARY);
/* open a search looking for 0 */
search = usearch_openFromCollator (pattern, pLen, text, tLen, coll, NULL, &ec);
- TEST_ASSERT (U_SUCCESS (ec));
+ TEST_ASSERT (ec);
- pos = usearch_first(search, &ec);
- len = usearch_getMatchedLength(search);
+ if (coll != NULL && search != NULL) {
+ pos = usearch_first(search, &ec);
+ len = usearch_getMatchedLength(search);
- if(pos != expectedPos) {
- log_err("Expected search result: %d; Got instead: %d\n", expectedPos, pos);
- }
+ if(pos != expectedPos) {
+ log_err("Expected search result: %d; Got instead: %d\n", expectedPos, pos);
+ }
- if(len != expectedLen) {
- log_err("Expected search result length: %d; Got instead: %d\n", expectedLen, len);
- }
+ if(len != expectedLen) {
+ log_err("Expected search result length: %d; Got instead: %d\n", expectedLen, len);
+ }
- /* Now try it at strength == UCOL_IDENTICAL */
- ucol_setStrength(coll, UCOL_IDENTICAL);
- usearch_reset(search);
+ /* Now try it at strength == UCOL_IDENTICAL */
+ ucol_setStrength(coll, UCOL_IDENTICAL);
+ usearch_reset(search);
- pos = usearch_first(search, &ec);
- len = usearch_getMatchedLength(search);
+ pos = usearch_first(search, &ec);
+ len = usearch_getMatchedLength(search);
- if(pos != -1) {
- log_err("Expected failure for strentgh = UCOL_IDENTICAL: got %d instead.\n", pos);
- }
+ if(pos != -1) {
+ log_err("Expected failure for strentgh = UCOL_IDENTICAL: got %d instead.\n", pos);
+ }
+ }
usearch_close(search);
ucol_close(coll);
diff --git a/test/cintltst/utransts.c b/test/cintltst/utransts.c
index e0e970c..440b915 100644
--- a/test/cintltst/utransts.c
+++ b/test/cintltst/utransts.c
@@ -271,7 +271,7 @@
status = U_ZERO_ERROR;
t1=utrans_open(TransID[i], UTRANS_FORWARD,NULL,0,NULL, &status);
if(t1 == NULL || U_FAILURE(status)){
- log_err("FAIL: in instantiation for id=%s\n", TransID[i]);
+ log_data_err("FAIL: in instantiation for id=%s -> %s (Are you missing data?)\n", TransID[i], u_errorName(status));
continue;
}
inverse1=utrans_openInverse(t1, &status);
@@ -299,7 +299,7 @@
t1=utrans_open("Latin-Devanagari", UTRANS_FORWARD, NULL,0,NULL,&status);
if(U_FAILURE(status)){
- log_err("FAIL: construction\n");
+ log_data_err("FAIL: construction -> %s (Are you missing data?)\n", u_errorName(status));
return;
}
t2=utrans_open("Latin-Greek", UTRANS_FORWARD, NULL,0,NULL,&status);
@@ -585,7 +585,7 @@
&parseErr, &status);
if (U_FAILURE(status)) {
utrans_close(trans);
- log_err("FAIL: utrans_openRules(%s) failed, error=%s\n",
+ log_data_err("FAIL: utrans_openRules(%s) failed, error=%s (Are you missing data?)\n",
crules, u_errorName(status));
return;
}