[sword-svn] r213 - in trunk/source/test: cintltst compat intltest perf perf/strsrchperf testdata
chrislit at crosswire.org
chrislit at crosswire.org
Thu Jul 2 12:31:12 MST 2009
Author: chrislit
Date: 2009-07-02 12:31:11 -0700 (Thu, 02 Jul 2009)
New Revision: 213
Modified:
trunk/source/test/cintltst/callcoll.c
trunk/source/test/cintltst/calltest.c
trunk/source/test/cintltst/capitst.c
trunk/source/test/cintltst/cbiapts.c
trunk/source/test/cintltst/ccaltst.c
trunk/source/test/cintltst/ccapitst.c
trunk/source/test/cintltst/ccurrtst.c
trunk/source/test/cintltst/cdattst.c
trunk/source/test/cintltst/cdetst.c
trunk/source/test/cintltst/cdtdptst.c
trunk/source/test/cintltst/cdtrgtst.c
trunk/source/test/cintltst/cestst.c
trunk/source/test/cintltst/cfintst.c
trunk/source/test/cintltst/cfrtst.c
trunk/source/test/cintltst/cg7coll.c
trunk/source/test/cintltst/cintltst.c
trunk/source/test/cintltst/citertst.c
trunk/source/test/cintltst/cjaptst.c
trunk/source/test/cintltst/cloctst.c
trunk/source/test/cintltst/cmsccoll.c
trunk/source/test/cintltst/cmsgtst.c
trunk/source/test/cintltst/cnmdptst.c
trunk/source/test/cintltst/cnumtst.c
trunk/source/test/cintltst/crestst.c
trunk/source/test/cintltst/creststn.c
trunk/source/test/cintltst/cstrcase.c
trunk/source/test/cintltst/cturtst.c
trunk/source/test/cintltst/cucdapi.c
trunk/source/test/cintltst/cucdtst.c
trunk/source/test/cintltst/currtest.c
trunk/source/test/cintltst/encoll.c
trunk/source/test/cintltst/hpmufn.c
trunk/source/test/cintltst/idnatest.c
trunk/source/test/cintltst/ncnvtst.c
trunk/source/test/cintltst/nucnvtst.c
trunk/source/test/cintltst/reapits.c
trunk/source/test/cintltst/spooftest.c
trunk/source/test/cintltst/spreptst.c
trunk/source/test/cintltst/stdnmtst.c
trunk/source/test/cintltst/ucnvseltst.c
trunk/source/test/cintltst/ucsdetst.c
trunk/source/test/cintltst/udatatst.c
trunk/source/test/cintltst/udatpg_test.c
trunk/source/test/cintltst/usettest.c
trunk/source/test/cintltst/usrchtst.c
trunk/source/test/cintltst/utransts.c
trunk/source/test/compat/tzone.pl
trunk/source/test/intltest/allcoll.cpp
trunk/source/test/intltest/apicoll.cpp
trunk/source/test/intltest/astrotst.cpp
trunk/source/test/intltest/calregts.cpp
trunk/source/test/intltest/caltest.cpp
trunk/source/test/intltest/caltztst.cpp
trunk/source/test/intltest/caltztst.h
trunk/source/test/intltest/convtest.cpp
trunk/source/test/intltest/cpdtrtst.cpp
trunk/source/test/intltest/csdetest.cpp
trunk/source/test/intltest/currcoll.cpp
trunk/source/test/intltest/dadrcal.cpp
trunk/source/test/intltest/dadrcoll.cpp
trunk/source/test/intltest/dadrfmt.cpp
trunk/source/test/intltest/dcfmapts.cpp
trunk/source/test/intltest/decoll.cpp
trunk/source/test/intltest/dtfmapts.cpp
trunk/source/test/intltest/dtfmrgts.cpp
trunk/source/test/intltest/dtfmtrtts.cpp
trunk/source/test/intltest/dtfmttst.cpp
trunk/source/test/intltest/dtifmtts.cpp
trunk/source/test/intltest/dtifmtts.h
trunk/source/test/intltest/encoll.cpp
trunk/source/test/intltest/escoll.cpp
trunk/source/test/intltest/ficoll.cpp
trunk/source/test/intltest/frcoll.cpp
trunk/source/test/intltest/g7coll.cpp
trunk/source/test/intltest/icusvtst.cpp
trunk/source/test/intltest/idnaconf.cpp
trunk/source/test/intltest/incaltst.cpp
trunk/source/test/intltest/intltest.cpp
trunk/source/test/intltest/intltest.h
trunk/source/test/intltest/itercoll.cpp
trunk/source/test/intltest/itrbnf.cpp
trunk/source/test/intltest/itrbnfrt.cpp
trunk/source/test/intltest/itspoof.cpp
trunk/source/test/intltest/jacoll.cpp
trunk/source/test/intltest/jamotest.cpp
trunk/source/test/intltest/lcukocol.cpp
trunk/source/test/intltest/loctest.cpp
trunk/source/test/intltest/miscdtfm.cpp
trunk/source/test/intltest/mnkytst.cpp
trunk/source/test/intltest/msfmrgts.cpp
trunk/source/test/intltest/msfmrgts.h
trunk/source/test/intltest/nmfmapts.cpp
trunk/source/test/intltest/nmfmtrt.cpp
trunk/source/test/intltest/nmfmtrt.h
trunk/source/test/intltest/normconf.cpp
trunk/source/test/intltest/numfmtst.cpp
trunk/source/test/intltest/numrgts.cpp
trunk/source/test/intltest/numrgts.h
trunk/source/test/intltest/plurfmts.cpp
trunk/source/test/intltest/pptest.cpp
trunk/source/test/intltest/pptest.h
trunk/source/test/intltest/rbbiapts.cpp
trunk/source/test/intltest/rbbitst.cpp
trunk/source/test/intltest/regcoll.cpp
trunk/source/test/intltest/regextst.cpp
trunk/source/test/intltest/restest.cpp
trunk/source/test/intltest/restsnew.cpp
trunk/source/test/intltest/srchtest.cpp
trunk/source/test/intltest/ssearch.cpp
trunk/source/test/intltest/strcase.cpp
trunk/source/test/intltest/svccoll.cpp
trunk/source/test/intltest/tchcfmt.cpp
trunk/source/test/intltest/testidn.cpp
trunk/source/test/intltest/testidna.cpp
trunk/source/test/intltest/thcoll.cpp
trunk/source/test/intltest/tmsgfmt.cpp
trunk/source/test/intltest/transapi.cpp
trunk/source/test/intltest/transrt.cpp
trunk/source/test/intltest/transtst.cpp
trunk/source/test/intltest/trcoll.cpp
trunk/source/test/intltest/trnserr.cpp
trunk/source/test/intltest/tsdate.cpp
trunk/source/test/intltest/tsdcfmsy.cpp
trunk/source/test/intltest/tsdtfmsy.cpp
trunk/source/test/intltest/tsmthred.cpp
trunk/source/test/intltest/tsnmfmt.cpp
trunk/source/test/intltest/tufmtts.cpp
trunk/source/test/intltest/tufmtts.h
trunk/source/test/intltest/tzbdtest.cpp
trunk/source/test/intltest/tzfmttst.cpp
trunk/source/test/intltest/tzoffloc.cpp
trunk/source/test/intltest/tzregts.cpp
trunk/source/test/intltest/tzrulets.cpp
trunk/source/test/intltest/tztest.cpp
trunk/source/test/intltest/ucaconf.cpp
trunk/source/test/intltest/ucdtest.cpp
trunk/source/test/intltest/uobjtest.cpp
trunk/source/test/intltest/usettest.cpp
trunk/source/test/perf/Makefile.in
trunk/source/test/perf/strsrchperf/Makefile.in
trunk/source/test/perf/strsrchperf/StrSrchPerf_r.pl
trunk/source/test/perf/strsrchperf/strsrchperf.cpp
trunk/source/test/perf/strsrchperf/strsrchperf.h
trunk/source/test/testdata/NumberFormatTestCases.txt
trunk/source/test/testdata/pkgdataMakefile.in
trunk/source/test/testdata/structLocale.txt
Log:
ICU 4.2.1 update, fifth pass
Modified: trunk/source/test/cintltst/callcoll.c
===================================================================
--- trunk/source/test/cintltst/callcoll.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/callcoll.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);
Modified: trunk/source/test/cintltst/calltest.c
===================================================================
--- trunk/source/test/cintltst/calltest.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/calltest.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -44,8 +44,8 @@
{
addCnvSelTest(root);
addUDataTest(root);
+ addPUtilTest(root);
addHeapMutexTest(root);
- addPUtilTest(root);
addUTF16Test(root);
addUTF8Test(root);
addUtility(root);
Modified: trunk/source/test/cintltst/capitst.c
===================================================================
--- trunk/source/test/cintltst/capitst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/capitst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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 at collation=pinyin", &status);
+ if (coll == NULL || status == U_FILE_ACCESS_ERROR) {
+ log_data_err("Unable to open collator es at 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 at 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);
Modified: trunk/source/test/cintltst/cbiapts.c
===================================================================
--- trunk/source/test/cintltst/cbiapts.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cbiapts.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/ccaltst.c
===================================================================
--- trunk/source/test/cintltst/ccaltst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/ccaltst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);
}
Modified: trunk/source/test/cintltst/ccapitst.c
===================================================================
--- trunk/source/test/cintltst/ccapitst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/ccapitst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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));
Modified: trunk/source/test/cintltst/ccurrtst.c
===================================================================
--- trunk/source/test/cintltst/ccurrtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/ccurrtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/cdattst.c
===================================================================
--- trunk/source/test/cintltst/cdattst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cdattst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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));
}
}
Modified: trunk/source/test/cintltst/cdetst.c
===================================================================
--- trunk/source/test/cintltst/cdetst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cdetst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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");
Modified: trunk/source/test/cintltst/cdtdptst.c
===================================================================
--- trunk/source/test/cintltst/cdtdptst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cdtdptst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);
Modified: trunk/source/test/cintltst/cdtrgtst.c
===================================================================
--- trunk/source/test/cintltst/cdtrgtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cdtrgtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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));
}
}
Modified: trunk/source/test/cintltst/cestst.c
===================================================================
--- trunk/source/test/cintltst/cestst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cestst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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");
Modified: trunk/source/test/cintltst/cfintst.c
===================================================================
--- trunk/source/test/cintltst/cfintst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cfintst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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 at 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 at 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);
Modified: trunk/source/test/cintltst/cfrtst.c
===================================================================
--- trunk/source/test/cintltst/cfrtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cfrtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/cg7coll.c
===================================================================
--- trunk/source/test/cintltst/cg7coll.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cg7coll.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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++)
Modified: trunk/source/test/cintltst/cintltst.c
===================================================================
--- trunk/source/test/cintltst/cintltst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cintltst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
Modified: trunk/source/test/cintltst/citertst.c
===================================================================
--- trunk/source/test/cintltst/citertst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/citertst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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");
Modified: trunk/source/test/cintltst/cjaptst.c
===================================================================
--- trunk/source/test/cintltst/cjaptst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cjaptst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/cloctst.c
===================================================================
--- trunk/source/test/cintltst/cloctst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cloctst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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) {
Modified: trunk/source/test/cintltst/cmsccoll.c
===================================================================
--- trunk/source/test/cintltst/cmsccoll.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cmsccoll.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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,12 +1625,9 @@
noOfLoc = uloc_countAvailable();
coll = ucol_open("", &status);
- if(status == U_FILE_ACCESS_ERROR) {
- log_data_err("Is your data around?\n");
+ if (U_FAILURE(status)) {
+ log_data_err("Error opening collator -> %s (Are you missing data?)\n", u_errorName(status));
return;
- } else if(U_FAILURE(status)) {
- log_err("Error opening collator\n");
- return;
}
charsToTestSize = uset_size(charsToTest);
if (charsToTestSize <= 0) {
@@ -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;
}
Modified: trunk/source/test/cintltst/cmsgtst.c
===================================================================
--- trunk/source/test/cintltst/cmsgtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cmsgtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);
Modified: trunk/source/test/cintltst/cnmdptst.c
===================================================================
--- trunk/source/test/cintltst/cnmdptst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cnmdptst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/cnumtst.c
===================================================================
--- trunk/source/test/cintltst/cnumtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cnumtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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 at 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);
Modified: trunk/source/test/cintltst/crestst.c
===================================================================
--- trunk/source/test/cintltst/crestst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/crestst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/creststn.c
===================================================================
--- trunk/source/test/cintltst/creststn.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/creststn.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);
Modified: trunk/source/test/cintltst/cstrcase.c
===================================================================
--- trunk/source/test/cintltst/cstrcase.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cstrcase.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/cturtst.c
===================================================================
--- trunk/source/test/cintltst/cturtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cturtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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");
Modified: trunk/source/test/cintltst/cucdapi.c
===================================================================
--- trunk/source/test/cintltst/cucdapi.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cucdapi.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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]);
}
}
}
Modified: trunk/source/test/cintltst/cucdtst.c
===================================================================
--- trunk/source/test/cintltst/cucdtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/cucdtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);
Modified: trunk/source/test/cintltst/currtest.c
===================================================================
--- trunk/source/test/cintltst/currtest.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/currtest.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/encoll.c
===================================================================
--- trunk/source/test/cintltst/encoll.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/encoll.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);
Modified: trunk/source/test/cintltst/hpmufn.c
===================================================================
--- trunk/source/test/cintltst/hpmufn.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/hpmufn.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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++; }
Modified: trunk/source/test/cintltst/idnatest.c
===================================================================
--- trunk/source/test/cintltst/idnatest.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/idnatest.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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
Modified: trunk/source/test/cintltst/ncnvtst.c
===================================================================
--- trunk/source/test/cintltst/ncnvtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/ncnvtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/nucnvtst.c
===================================================================
--- trunk/source/test/cintltst/nucnvtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/nucnvtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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)){
Modified: trunk/source/test/cintltst/reapits.c
===================================================================
--- trunk/source/test/cintltst/reapits.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/reapits.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);
Modified: trunk/source/test/cintltst/spooftest.c
===================================================================
--- trunk/source/test/cintltst/spooftest.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/spooftest.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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);};}
Modified: trunk/source/test/cintltst/spreptst.c
===================================================================
--- trunk/source/test/cintltst/spreptst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/spreptst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/stdnmtst.c
===================================================================
--- trunk/source/test/cintltst/stdnmtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/stdnmtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
Modified: trunk/source/test/cintltst/ucnvseltst.c
===================================================================
--- trunk/source/test/cintltst/ucnvseltst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/ucnvseltst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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",
Modified: trunk/source/test/cintltst/ucsdetst.c
===================================================================
--- trunk/source/test/cintltst/ucsdetst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/ucsdetst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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:
Modified: trunk/source/test/cintltst/udatatst.c
===================================================================
--- trunk/source/test/cintltst/udatatst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/udatatst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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();
Modified: trunk/source/test/cintltst/udatpg_test.c
===================================================================
--- trunk/source/test/cintltst/udatpg_test.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/udatpg_test.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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,
Modified: trunk/source/test/cintltst/usettest.c
===================================================================
--- trunk/source/test/cintltst/usettest.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/usettest.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/cintltst/usrchtst.c
===================================================================
--- trunk/source/test/cintltst/usrchtst.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/usrchtst.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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");
+ EN_US_ = ucol_open("en_US", status);
+ if(U_FAILURE(*status)) {
+ log_err_status(*status, "Error opening collator\n");
return;
- } else if(U_FAILURE(status)) {
- log_err("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,37 +2453,39 @@
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);
usearch_close(search);
}
@@ -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);
Modified: trunk/source/test/cintltst/utransts.c
===================================================================
--- trunk/source/test/cintltst/utransts.c 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/cintltst/utransts.c 2009-07-02 19:31:11 UTC (rev 213)
@@ -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;
}
Modified: trunk/source/test/compat/tzone.pl
===================================================================
--- trunk/source/test/compat/tzone.pl 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/compat/tzone.pl 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,65 +1,65 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2007-2007, International Business Machines
-# Corporation and others. All Rights Reserved.
-#
-
-if ($ARGV[0] eq '-h' || $ARGV[0] eq '--help') {
- print "Usage: tzone [year month day hour minute]\n";
- exit(0);
-}
-
-my $LIBRARY = '../../lib';
-
-my @TZONE_RAW = `locate zoneinfo | grep '^/usr/share/zoneinfo/' | grep -v 'tab\$' | grep -v '/right/' | grep -v '/posix/' | grep -v '/posixrules\$' | grep -v '/Factory\$'`;
-my @TZONE;
-my $index = 0;
-my $USECURRENT = 0;
-my $year = 0;
-my $month = 0;
-my $day = 0;
-my $hour = 0;
-my $minute = 0;
-
-
-if (scalar(@ARGV) == 5) {
- ($year, $month, $day, $hour, $minute) = @ARGV;
- print "The date we are using is: $month-$day-$year $hour:$minute.\n";
-} else {
- print "We are using the current date.\n";
- $USECURRENT = 1;
-}
-
-#filter out the time zones
-foreach my $tzone (@TZONE_RAW) {
- chomp($tzone);
- if (-e $tzone) {
- $TZONE[$index] = substr($tzone, 20);
- $index++;
- }
-}
-
-#go through each timezone and test
-$count = 0;
-$ENV{'LD_LIBRARY_PATH'} = $LIBRARY;
-
-print "The following time zones had wrong results.\n";
-
-foreach my $tzone (@TZONE) {
- #set system time zone
- $ENV{'TZ'} = "$tzone";
-
- my @result = `./tzdate $year $month $day $hour $minute $USECURRENT`;
-
- #if the result is wrong print the time zone information to a log file
- if (scalar(@result) > 0) {
- print "\nTIME ZONE: $tzone\n";
- print "@result\n";
- $count++;
- }
-}
-
-print "\nThe number of time zones with wrong results: $count out of $index\n";
-
-print("\n\nGood Bye!\n");
-exit(0);
+#!/usr/bin/perl
+#
+# Copyright (C) 2007-2007, International Business Machines
+# Corporation and others. All Rights Reserved.
+#
+
+if ($ARGV[0] eq '-h' || $ARGV[0] eq '--help') {
+ print "Usage: tzone [year month day hour minute]\n";
+ exit(0);
+}
+
+my $LIBRARY = '../../lib';
+
+my @TZONE_RAW = `locate zoneinfo | grep '^/usr/share/zoneinfo/' | grep -v 'tab\$' | grep -v '/right/' | grep -v '/posix/' | grep -v '/posixrules\$' | grep -v '/Factory\$'`;
+my @TZONE;
+my $index = 0;
+my $USECURRENT = 0;
+my $year = 0;
+my $month = 0;
+my $day = 0;
+my $hour = 0;
+my $minute = 0;
+
+
+if (scalar(@ARGV) == 5) {
+ ($year, $month, $day, $hour, $minute) = @ARGV;
+ print "The date we are using is: $month-$day-$year $hour:$minute.\n";
+} else {
+ print "We are using the current date.\n";
+ $USECURRENT = 1;
+}
+
+#filter out the time zones
+foreach my $tzone (@TZONE_RAW) {
+ chomp($tzone);
+ if (-e $tzone) {
+ $TZONE[$index] = substr($tzone, 20);
+ $index++;
+ }
+}
+
+#go through each timezone and test
+$count = 0;
+$ENV{'LD_LIBRARY_PATH'} = $LIBRARY;
+
+print "The following time zones had wrong results.\n";
+
+foreach my $tzone (@TZONE) {
+ #set system time zone
+ $ENV{'TZ'} = "$tzone";
+
+ my @result = `./tzdate $year $month $day $hour $minute $USECURRENT`;
+
+ #if the result is wrong print the time zone information to a log file
+ if (scalar(@result) > 0) {
+ print "\nTIME ZONE: $tzone\n";
+ print "@result\n";
+ $count++;
+ }
+}
+
+print "\nThe number of time zones with wrong results: $count out of $index\n";
+
+print("\n\nGood Bye!\n");
+exit(0);
Modified: trunk/source/test/intltest/allcoll.cpp
===================================================================
--- trunk/source/test/intltest/allcoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/allcoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2004, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -35,7 +35,7 @@
}
myCollation = new RuleBasedCollator(ruleset, status);
if(U_FAILURE(status)){
- errln("ERROR: in creation of rule based collator from ruleset");
+ errcheckln(status, "ERROR: in creation of rule based collator from ruleset - %s", u_errorName(status));
delete myCollation;
myCollation = 0;
}
@@ -204,7 +204,7 @@
default: name = ""; break;
}
} else {
- errln("Collator couldn't be instantiated!");
+ dataerrln("Collator couldn't be instantiated!");
name = "";
}
}
Modified: trunk/source/test/intltest/apicoll.cpp
===================================================================
--- trunk/source/test/intltest/apicoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/apicoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -114,7 +114,7 @@
if (U_FAILURE(success))
{
- errln("Default Collator creation failed.");
+ errcheckln(success, "Default Collator creation failed. - %s", u_errorName(success));
return;
}
@@ -286,7 +286,7 @@
col1 = new RuleBasedCollator(ruleset1, status);
if (U_FAILURE(status)) {
- errln("RuleBased Collator creation failed.\n");
+ errcheckln(status, "RuleBased Collator creation failed. - %s", u_errorName(status));
return;
}
else {
@@ -367,7 +367,7 @@
coll = (RuleBasedCollator *)Collator::createInstance(Locale::getEnglish(), status);
if (U_FAILURE(status)) {
- errln("English Collator creation failed.\n");
+ errcheckln(status, "English Collator creation failed. - %s", u_errorName(status));
return;
}
else {
@@ -394,7 +394,7 @@
*vi_VN = Collator::createInstance("vi_VN", status);
if (U_FAILURE(status)) {
- errln("ERROR: collation creation failed.\n");
+ errcheckln(status, "ERROR: collation creation failed. - %s", u_errorName(status));
return;
}
@@ -435,7 +435,7 @@
someCollators[1] = Collator::createInstance("ko", err);
someCollators[2] = Collator::createInstance("ja_JP", err);
if(U_FAILURE(err)) {
- errln("Couldn't instantiate collators. Error: %s", u_errorName(err));
+ errcheckln(err, "Couldn't instantiate collators. Error: %s", u_errorName(err));
delete someCollators[0];
delete someCollators[1];
delete someCollators[2];
@@ -472,7 +472,7 @@
col1 = Collator::createInstance(Locale::getEnglish(), success);
if (U_FAILURE(success))
{
- errln("Default collation creation failed.");
+ errcheckln(success, "Default collation creation failed. - %s", u_errorName(success));
return;
}
@@ -531,7 +531,7 @@
col = Collator::createInstance(Locale::getEnglish(), success);
if (U_FAILURE(success))
{
- errln("Default collation creation failed.");
+ errcheckln(success, "Default collation creation failed. - %s", u_errorName(success));
return;
}
col->setStrength(Collator::TERTIARY);
@@ -654,7 +654,7 @@
col = Collator::createInstance(Locale::getEnglish(), success);
if (U_FAILURE(success))
{
- errln("Default collation creation failed.");
+ errcheckln(success, "Default collation creation failed. - %s", u_errorName(success));
return;
}
@@ -847,7 +847,7 @@
UnicodeString ruleset2("< a, A < b, B < c, C < d, D, e, E");
RuleBasedCollator *col1 = new RuleBasedCollator(ruleset1, success);
if (U_FAILURE(success)) {
- errln("RuleBasedCollator creation failed.");
+ errcheckln(success, "RuleBasedCollator creation failed. - %s", u_errorName(success));
return;
}
success = U_ZERO_ERROR;
@@ -979,7 +979,7 @@
UErrorCode success = U_ZERO_ERROR;
col = Collator::createInstance(Locale::getEnglish(), success);
if (U_FAILURE(success)) {
- errln("Default collation creation failed.");
+ errcheckln(success, "Default collation creation failed. - %s", u_errorName(success));
return;
}
UnicodeString test1("Abcda"), test2("abcda");
@@ -1048,7 +1048,7 @@
}
if (count1 == 0 || list == NULL) {
- errln("getAvailableLocales(int&) returned an empty list");
+ dataerrln("getAvailableLocales(int&) returned an empty list");
}
logln("Trying Collator::getAvailableLocales()");
@@ -1058,7 +1058,7 @@
count2 = 0;
if (localeEnum == NULL) {
- errln("getAvailableLocales() returned NULL");
+ dataerrln("getAvailableLocales() returned NULL");
return;
}
@@ -1101,7 +1101,7 @@
*/
Collator *col = Collator::createInstance(Locale::getEnglish(), status);
if (U_FAILURE(status)) {
- errln("ERROR: Default collation creation failed.: %s\n", u_errorName(status));
+ errcheckln(status, "ERROR: Default collation creation failed.: %s\n", u_errorName(status));
return;
}
@@ -1309,7 +1309,7 @@
UnicodeString rule("&a < ab < c/aba < d < z < ch");
RuleBasedCollator coll(rule, status);
if(U_FAILURE(status)) {
- errln("Collator creation failed with error %s", u_errorName(status));
+ errcheckln(status, "Collator creation failed with error %s", u_errorName(status));
return;
}
UnicodeString str(ch);
@@ -1418,7 +1418,7 @@
UErrorCode error = U_ZERO_ERROR;
Collator *coll = Collator::createInstance("en_US", error);
if (U_FAILURE(error)) {
- errln("Failure creating english collator");
+ errcheckln(error, "Failure creating english collator - %s", u_errorName(error));
return;
}
UnicodeString name;
@@ -1443,7 +1443,7 @@
Collator *coll = Collator::createInstance(error);
if (U_FAILURE(error)) {
- errln("Creation of default collator failed");
+ errcheckln(error, "Creation of default collator failed - %s", u_errorName(error));
return;
}
@@ -1548,7 +1548,7 @@
Collator *coll = Collator::createInstance(status);
if(U_FAILURE(status)) {
delete coll;
- errln("Collator creation failed with error %s", u_errorName(status));
+ errcheckln(status, "Collator creation failed with error %s", u_errorName(status));
return;
}
@@ -1688,7 +1688,7 @@
Collator *coll = Collator::createInstance(Locale("sh"), status);
if(U_FAILURE(status)) {
delete coll;
- errln("Collator creation failed with %s", u_errorName(status));
+ errcheckln(status, "Collator creation failed with %s", u_errorName(status));
return;
}
@@ -1849,7 +1849,7 @@
}
delete set;
} else {
- errln("Couldn't open collator with rules %s\n", setTest[i].rules);
+ errcheckln(status, "Couldn't open collator with rules %s - %s", setTest[i].rules, u_errorName(status));
}
delete coll;
}
@@ -1866,7 +1866,7 @@
= (RuleBasedCollator *)Collator::createInstance(status);
if(U_FAILURE(status)) {
delete coll;
- errln("Collator creation failed with %s", u_errorName(status));
+ errcheckln(status, "Collator creation failed with %s", u_errorName(status));
return;
}
id = *((char *)coll->getDynamicClassID());
@@ -2242,7 +2242,9 @@
UnicodeString second((UChar)0);
RuleBasedCollator *coll = new RuleBasedCollator(UnicodeString(buf, len), status);
if(U_FAILURE(status)) {
- errln("Failed to open collator");
+ delete coll;
+ errcheckln(status, "Failed to open collator - %s", u_errorName(status));
+ return;
}
UCollationResult res = coll->compare(first, second, status);
if(res != UCOL_LESS) {
@@ -2257,7 +2259,7 @@
RuleBasedCollator* c0 = (RuleBasedCollator*)Collator::createInstance(status);
if (U_FAILURE(status)) {
- errln("Collator::CreateInstance(status) failed with %s", u_errorName(status));
+ errcheckln(status, "Collator::CreateInstance(status) failed with %s", u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/astrotst.cpp
===================================================================
--- trunk/source/test/intltest/astrotst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/astrotst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1996-2008, International Business Machines Corporation and
+ * Copyright (c) 1996-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -50,7 +50,7 @@
if(U_FAILURE(status)) return;
if((astro != NULL) || (gc != NULL)) {
- errln("Err: initAstro() called twice!");
+ dataerrln("Err: initAstro() called twice!");
closeAstro(status);
if(U_SUCCESS(status)) {
status = U_INTERNAL_PROGRAM_ERROR;
@@ -279,7 +279,7 @@
DateFormat *df_d = DateFormat::createDateInstance(DateFormat::MEDIUM,Locale::getUS());
DateFormat *df_dt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS());
if(!df_t || !df_d || !df_dt) {
- errln("couldn't create dateformats.");
+ dataerrln("couldn't create dateformats.");
return;
}
df_t->adoptTimeZone(tz->clone());
@@ -373,7 +373,10 @@
void AstroTest::TestBasics(void) {
UErrorCode status = U_ZERO_ERROR;
initAstro(status);
- ASSERT_OK(status);
+ if (U_FAILURE(status)) {
+ dataerrln("Got error: %s", u_errorName(status));
+ return;
+ }
// Check that our JD computation is the same as the book's (p. 88)
GregorianCalendar *cal3 = new GregorianCalendar(TimeZone::getGMT()->clone(), Locale::getUS(), status);
Modified: trunk/source/test/intltest/calregts.cpp
===================================================================
--- trunk/source/test/intltest/calregts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/calregts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -113,7 +113,7 @@
CalendarRegressionTest::failure(UErrorCode status, const char* msg)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ errcheckln(status, UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
return TRUE;
}
@@ -435,7 +435,7 @@
Calendar *cal = Calendar::createInstance(TimeZone::createTimeZone("GMT"),
Locale::getUK(),status);
if(U_FAILURE(status)) {
- errln("Error creating Calendar: %s", u_errorName(status));
+ errcheckln(status, "Error creating Calendar: %s", u_errorName(status));
delete cal;
delete fmt;
return;
@@ -466,7 +466,7 @@
UErrorCode status = U_ZERO_ERROR;
Calendar *cal = new GregorianCalendar(status);
if(status == U_USING_FALLBACK_WARNING) {
- errln("Error creating Calendar: %s", u_errorName(status));
+ dataerrln("Error creating Calendar: %s", u_errorName(status));
delete cal;
return;
}
@@ -706,7 +706,7 @@
date = new SimpleDateFormat(UnicodeString("dd MMM yyy (zzzz) 'is in week' ww"),status);
Calendar *cal = Calendar::createInstance(status);
if(U_FAILURE(status)) {
- errln("Error creating Calendar: %s", u_errorName(status));
+ errcheckln(status, "Error creating Calendar: %s", u_errorName(status));
delete cal;
delete newZone;
delete date;
@@ -910,7 +910,7 @@
UnicodeString output, testDesc, str, str2;
GregorianCalendar *testCal = (GregorianCalendar*)Calendar::createInstance(status);
if(U_FAILURE(status)) {
- errln("Error creating calendar: %s", u_errorName(status));
+ errcheckln(status, "Error creating calendar: %s", u_errorName(status));
delete testCal;
return;
}
@@ -1171,7 +1171,7 @@
for (int32_t j=0; j<3; ++j) {
UnicodeString temp;
if (n[j] == 0)
- errln(UnicodeString("Fail: No locales for ") + locales[i].getName());
+ dataerrln(UnicodeString("Fail: No locales for ") + locales[i].getName());
}
}
//}
@@ -1488,7 +1488,7 @@
UErrorCode status = U_ZERO_ERROR;
GregorianCalendar *calendar = new GregorianCalendar(status);
if(status == U_USING_FALLBACK_WARNING || U_FAILURE(status)) {
- errln("Error creating calendar %s", u_errorName(status));
+ dataerrln("Error creating calendar %s", u_errorName(status));
delete calendar;
return;
}
@@ -1558,7 +1558,7 @@
UErrorCode status = U_ZERO_ERROR;
GregorianCalendar *calendar = new GregorianCalendar(status);
if(status == U_USING_FALLBACK_WARNING || U_FAILURE(status)) {
- errln("Error creating calendar %s", u_errorName(status));
+ dataerrln("Error creating calendar %s", u_errorName(status));
delete calendar;
return;
}
@@ -1815,7 +1815,7 @@
DateFormat *format = new SimpleDateFormat(UnicodeString("EEE MMM dd HH:mm:ss zzz yyyy G"),
Locale::getUS(), status);
if(U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat");
+ errcheckln(status, "Couldn't create SimpleDateFormat - %s", u_errorName(status));
return;
}
@@ -1906,7 +1906,7 @@
Locale::getUS(), status);
fmt.setCalendar(cal);
if (U_FAILURE(status)) {
- errln("Couldn't initialize test");
+ errcheckln(status, "Couldn't initialize test - %s", u_errorName(status));
return;
}
@@ -1968,7 +1968,7 @@
GregorianCalendar cal(TimeZone::createTimeZone("GMT"), Locale::getUS(), status);
SimpleDateFormat fmt("HH:mm 'w'w 'd'D E d MMM yyyy", Locale::getUS(), status);
if (U_FAILURE(status)) {
- errln("Error: Cannot create calendar or format");
+ errcheckln(status, "Error: Cannot create calendar or format - %s", u_errorName(status));
return;
}
fmt.setCalendar(cal);
@@ -2184,7 +2184,7 @@
int32_t DATA_length = (int32_t)(sizeof(DATA)/sizeof(DATA[0]));
Calendar* pcal = Calendar::createInstance(Locale::getUS(), ec);
if(U_FAILURE(ec)) {
- errln("Error creating calendar %s", u_errorName(ec));
+ errcheckln(ec, "Error creating calendar %s", u_errorName(ec));
delete pcal;
return;
}
@@ -2605,7 +2605,7 @@
}
if (U_FAILURE(ec)) {
- errln("FAIL: %s", u_errorName(ec));
+ errcheckln(ec, "FAIL: %s", u_errorName(ec));
}
delete tz;
Modified: trunk/source/test/intltest/caltest.cpp
===================================================================
--- trunk/source/test/intltest/caltest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/caltest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -408,7 +408,7 @@
const Locale* loc = Calendar::getAvailableLocales(count);
if (count < 1 || loc == 0)
{
- errln("FAIL: getAvailableLocales failed");
+ dataerrln("FAIL: getAvailableLocales failed");
}
else
{
@@ -1112,7 +1112,11 @@
if (U_FAILURE(status)) { errln("Calendar::getTime failed"); return; }
UnicodeString s;
dateToString(d, s);
- if (s.indexOf(":00 ") < 0) errln("Expected to see :00 in " + s);
+ if (s.indexOf("DATE_FORMAT_FAILURE") >= 0) {
+ dataerrln("Got: \"DATE_FORMAT_FAILURE\".");
+ } else if (s.indexOf(":00 ") < 0) {
+ errln("Expected to see :00 in " + s);
+ }
delete cal;
}
@@ -1309,7 +1313,7 @@
Calendar *cal=Calendar::createInstance(Locale::getGermany(), status);
if (U_FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; }
SimpleDateFormat *sdf=new SimpleDateFormat(UnicodeString("YYYY'-W'ww-ee"), Locale::getGermany(), status);
- if (U_FAILURE(status)) { errln("Couldn't create SimpleDateFormat"); return; }
+ if (U_FAILURE(status)) { errcheckln(status, "Couldn't create SimpleDateFormat - %s", u_errorName(status)); return; }
// ICU no longer use localized date-time pattern characters by default.
// So we set pattern chars using 'J' instead of 'Y'.
@@ -1548,7 +1552,7 @@
#define CHECK(status, msg) \
if (U_FAILURE(status)) { \
- errln(msg); \
+ errcheckln(status, msg); \
return; \
}
Modified: trunk/source/test/intltest/caltztst.cpp
===================================================================
--- trunk/source/test/intltest/caltztst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/caltztst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
/*
@@ -24,11 +24,15 @@
DateFormat* CalendarTimeZoneTest::fgDateFormat = 0;
Calendar* CalendarTimeZoneTest::fgCalendar = 0;
-UBool CalendarTimeZoneTest::failure(UErrorCode status, const char* msg)
+UBool CalendarTimeZoneTest::failure(UErrorCode status, const char* msg, UBool possibleDataError)
{
if (U_FAILURE(status))
{
- errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ if (possibleDataError) {
+ dataerrln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ } else {
+ errcheckln(status, UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ }
return TRUE;
}
return FALSE;
@@ -57,7 +61,7 @@
{
delete theFormat;
theFormat = 0;
- errln("FAIL: Could not create SimpleDateFormat");
+ errcheckln(status, "FAIL: Could not create SimpleDateFormat - %s", u_errorName(status));
}
}
Modified: trunk/source/test/intltest/caltztst.h
===================================================================
--- trunk/source/test/intltest/caltztst.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/caltztst.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -27,7 +27,7 @@
protected:
// Return true if the given status indicates failure. Also has the side effect
// of calling errln(). Msg should be of the form "Class::Method" in general.
- UBool failure(UErrorCode status, const char* msg);
+ UBool failure(UErrorCode status, const char* msg, UBool possibleDataError=FALSE);
// Utility method for formatting dates for printing; useful for Java->C++ conversion.
// Tries to mimic the Java Date.toString() format.
Modified: trunk/source/test/intltest/convtest.cpp
===================================================================
--- trunk/source/test/intltest/convtest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/convtest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2003-2008, International Business Machines
+* Copyright (C) 2003-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -185,7 +185,7 @@
delete dataModule;
}
else {
- dataerrln("[DATA] Could not load test conversion data");
+ dataerrln("Could not load test conversion data");
}
}
@@ -338,7 +338,7 @@
delete dataModule;
}
else {
- dataerrln("[DATA] Could not load test conversion data");
+ dataerrln("Could not load test conversion data");
}
}
@@ -417,7 +417,7 @@
cnv=cnv_open(charset, errorCode);
if(U_FAILURE(errorCode)) {
- errln("error opening \"%s\" for conversion/getUnicodeSet test case %d - %s",
+ errcheckln(errorCode, "error opening \"%s\" for conversion/getUnicodeSet test case %d - %s",
charset, i, u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
continue;
@@ -462,7 +462,7 @@
delete dataModule;
}
else {
- dataerrln("[DATA] Could not load test conversion data");
+ dataerrln("Could not load test conversion data");
}
}
@@ -551,7 +551,7 @@
UErrorCode errorCode=U_ZERO_ERROR;
UConverter *cnv=cnv_open(cnvNames[i], errorCode);
if(U_FAILURE(errorCode)) {
- errln("failed to open converter %s - %s", cnvNames[i], u_errorName(errorCode));
+ errcheckln(errorCode, "failed to open converter %s - %s", cnvNames[i], u_errorName(errorCode));
continue;
}
UnicodeSet expected;
@@ -945,7 +945,7 @@
errorCode=U_ZERO_ERROR;
cnv=cnv_open(cc.charset, errorCode);
if(U_FAILURE(errorCode)) {
- errln("toUnicode[%d](%s cb=\"%s\" fb=%d flush=%d) ucnv_open() failed - %s",
+ errcheckln(errorCode, "toUnicode[%d](%s cb=\"%s\" fb=%d flush=%d) ucnv_open() failed - %s",
cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
return FALSE;
}
@@ -1352,7 +1352,7 @@
errorCode=U_ZERO_ERROR;
cnv=cnv_open(cc.charset, errorCode);
if(U_FAILURE(errorCode)) {
- errln("fromUnicode[%d](%s cb=\"%s\" fb=%d flush=%d) ucnv_open() failed - %s",
+ errcheckln(errorCode, "fromUnicode[%d](%s cb=\"%s\" fb=%d flush=%d) ucnv_open() failed - %s",
cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
return FALSE;
}
Modified: trunk/source/test/intltest/cpdtrtst.cpp
===================================================================
--- trunk/source/test/intltest/cpdtrtst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/cpdtrtst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/***************************************************************************
*
-* Copyright (C) 2000-2005, International Business Machines
+* Copyright (C) 2000-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
************************************************************************
@@ -46,7 +46,7 @@
Transliterator* t3=Transliterator::createInstance(names[2], UTRANS_FORWARD, parseError, status);
Transliterator* t4=Transliterator::createInstance(names[3], UTRANS_FORWARD, parseError, status);
if(U_FAILURE(status)){
- errln("Transliterator construction failed");
+ dataerrln("Transliterator construction failed - %s", u_errorName(status));
return;
}
@@ -117,7 +117,7 @@
UParseError parseError;
CompoundTransliterator *ct1=new CompoundTransliterator("Greek-Latin;Latin-Devanagari",parseError,status);
if(U_FAILURE(status)){
- errln("construction failed");
+ dataerrln("construction failed - %s", u_errorName(status));
delete ct1;
return;
}
@@ -194,7 +194,7 @@
CompoundTransliterator *ct2=new CompoundTransliterator("Any-Hex;Hex-Any;Cyrillic-Latin;Latin-Cyrillic", parseError, status);
CompoundTransliterator *ct3=(CompoundTransliterator*)ct1;
if (U_FAILURE(status)) {
- errln("FAILED: CompoundTransliterator constructor failed");
+ dataerrln("FAILED: CompoundTransliterator constructor failed - %s", u_errorName(status));
return;
}
CompoundTransliterator *ct4=new CompoundTransliterator("Latin-Devanagari", parseError, status);
@@ -241,7 +241,7 @@
UParseError parseError;
CompoundTransliterator *ct1=new CompoundTransliterator(ID, parseError, status);
if(U_FAILURE(status)){
- errln("CompoundTransliterator construction failed");
+ dataerrln("CompoundTransliterator construction failed - %s", u_errorName(status));
return;
}
int32_t count=ct1->getCount();
@@ -390,7 +390,7 @@
CompoundTransliterator *ct2=new CompoundTransliterator(Data[i+0], parseError, status);
if(U_FAILURE(status)){
- errln("CompoundTransliterator construction failed for " + Data[i+0]);
+ dataerrln("CompoundTransliterator construction failed for " + Data[i+0] + " - " + u_errorName(status));
} else {
expect(*ct2, Data[i+1], Data[i+2]);
}
Modified: trunk/source/test/intltest/csdetest.cpp
===================================================================
--- trunk/source/test/intltest/csdetest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/csdetest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -452,7 +452,7 @@
match = ucsdet_detect(csd, &status);
if (match == NULL) {
- errln("English test with C1 bytes got no matches.");
+ errcheckln(status, "English test with C1 bytes got no matches. - %s", u_errorName(status));
goto bail;
}
@@ -496,7 +496,11 @@
}
UXMLParser *parser = UXMLParser::createParser(status);
- if (!assertSuccess("UXMLParser::createParser",status)) return;
+ if (U_FAILURE(status)) {
+ dataerrln("FAIL: UXMLParser::createParser (%s)", u_errorName(status));
+ return;
+ }
+
UXMLElement *root = parser->parseFile(testFilePath, status);
if (!assertSuccess( "parseFile",status)) return;
@@ -582,6 +586,9 @@
char *bytes_r = extractBytes(s2, "IBM424", brLength);
UCharsetDetector *csd = ucsdet_open(&status);
+ if (U_FAILURE(status)) {
+ errln("Error opening charset detector. - %s", u_errorName(status));
+ }
const UCharsetMatch *match;
const char *name;
@@ -589,26 +596,26 @@
match = ucsdet_detect(csd, &status);
if (match == NULL) {
- errln("Encoding detection failure for IBM424_rtl: got no matches.\n");
+ errcheckln(status, "Encoding detection failure for IBM424_rtl: got no matches. - %s", u_errorName(status));
goto bail;
}
name = ucsdet_getName(match, &status);
if (strcmp(name, "IBM424_rtl") != 0) {
- errln("Encoding detection failure for IBM424_rtl: got %s\n", name);
+ errln("Encoding detection failure for IBM424_rtl: got %s", name);
}
ucsdet_setText(csd, bytes_r, brLength, &status);
match = ucsdet_detect(csd, &status);
if (match == NULL) {
- errln("Encoding detection failure for IBM424_ltr: got no matches.\n");
+ errln("Encoding detection failure for IBM424_ltr: got no matches.");
goto bail;
}
name = ucsdet_getName(match, &status);
if (strcmp(name, "IBM424_ltr") != 0) {
- errln("Encoding detection failure for IBM424_ltr: got %s\n", name);
+ errln("Encoding detection failure for IBM424_ltr: got %s", name);
}
bail:
@@ -663,6 +670,9 @@
char *bytes_r = extractBytes(s2, "IBM420", brLength);
UCharsetDetector *csd = ucsdet_open(&status);
+ if (U_FAILURE(status)) {
+ errln("Error opening charset detector. - %s", u_errorName(status));
+ }
const UCharsetMatch *match;
const char *name;
@@ -670,7 +680,7 @@
match = ucsdet_detect(csd, &status);
if (match == NULL) {
- errln("Encoding detection failure for IBM420_rtl: got no matches.\n");
+ errcheckln(status, "Encoding detection failure for IBM420_rtl: got no matches. - %s", u_errorName(status));
goto bail;
}
Modified: trunk/source/test/intltest/currcoll.cpp
===================================================================
--- trunk/source/test/intltest/currcoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/currcoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -85,7 +85,7 @@
if (U_FAILURE(status))
{
- errln ("Collator::createInstance() failed!");
+ errcheckln (status, "Collator::createInstance() failed! - %s", u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/dadrcal.cpp
===================================================================
--- trunk/source/test/intltest/dadrcal.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dadrcal.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -62,7 +62,7 @@
name = "";
}
} else {
- dataerrln("[DATA] format/DataDriven*Test data (calendar.res) not initialized!");
+ dataerrln("format/DataDriven*Test data (calendar.res) not initialized!");
name = "";
}
@@ -88,7 +88,7 @@
SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy / YYYY'-W'ww-ee"),
status);
if (U_FAILURE(status)) {
- errln("FAIL: Couldn't create SimpleDateFormat: %s\n",
+ errcheckln(status, "FAIL: Couldn't create SimpleDateFormat: %s",
u_errorName(status));
return;
}
@@ -383,7 +383,7 @@
SimpleDateFormat fmt(UnicodeString("EEE MMM dd yyyy / YYYY'-W'ww-ee"),
status);
if (U_FAILURE(status)) {
- errln("FAIL: Couldn't create SimpleDateFormat: %s\n",
+ errcheckln(status, "FAIL: Couldn't create SimpleDateFormat: %s",
u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/dadrcoll.cpp
===================================================================
--- trunk/source/test/intltest/dadrcoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dadrcoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -73,7 +73,7 @@
name = "";
}
} else {
- dataerrln("[DATA] collate/DataDrivenTest data not initialized!");
+ dataerrln("collate/DataDrivenTest data not initialized!");
name = "";
}
Modified: trunk/source/test/intltest/dadrfmt.cpp
===================================================================
--- trunk/source/test/intltest/dadrfmt.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dadrfmt.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -64,7 +64,7 @@
name = "";
}
} else {
- dataerrln("[DATA] format/DataDriven*Test data (format.res) not initialized!");
+ dataerrln("format/DataDriven*Test data (format.res) not initialized!");
name = "";
}
@@ -99,7 +99,7 @@
SimpleDateFormat basicFmt(UnicodeString("EEE MMM dd yyyy / YYYY'-W'ww-ee"),
status);
if (U_FAILURE(status)) {
- errln("FAIL: Couldn't create basic SimpleDateFormat: %s\n",
+ errcheckln(status, "FAIL: Couldn't create basic SimpleDateFormat: %s\n",
u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/dcfmapts.cpp
===================================================================
--- trunk/source/test/intltest/dcfmapts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dcfmapts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -65,7 +65,7 @@
DecimalFormat def(status);
if(U_FAILURE(status)) {
- errln((UnicodeString)"ERROR: Could not create DecimalFormat (default)");
+ errcheckln(status, "ERROR: Could not create DecimalFormat (default) - %s", u_errorName(status));
return;
}
@@ -381,7 +381,7 @@
};
DecimalFormat pat(status);
if(U_FAILURE(status)) {
- errln((UnicodeString)"ERROR: Could not create DecimalFormat (default)");
+ errcheckln(status, "ERROR: Could not create DecimalFormat (default) - %s", u_errorName(status));
return;
}
uint16_t mode;
@@ -426,7 +426,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat pat(UnicodeString("#,##0.00"),status);
if(U_FAILURE(status)) {
- errln((UnicodeString)"ERROR: Could not create DecimalFormat (default)");
+ errcheckln(status, "ERROR: Could not create DecimalFormat (default) - %s", u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/decoll.cpp
===================================================================
--- trunk/source/test/intltest/decoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/decoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -38,7 +38,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = Collator::createInstance(Locale::getGermany(), status);
if(!myCollation || U_FAILURE(status)) {
- errln(__FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
+ errcheckln(status, __FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
/* if it wasn't already: */
delete myCollation;
myCollation = NULL;
@@ -103,7 +103,7 @@
void CollationGermanTest::TestTertiary(/* char* par */)
{
if(myCollation == NULL ) {
- errln("decoll: cannot start test, collator is null\n");
+ dataerrln("decoll: cannot start test, collator is null\n");
return;
}
@@ -119,7 +119,7 @@
void CollationGermanTest::TestPrimary(/* char* par */)
{
if(myCollation == NULL ) {
- errln("decoll: cannot start test, collator is null\n");
+ dataerrln("decoll: cannot start test, collator is null\n");
return;
}
int32_t i;
Modified: trunk/source/test/intltest/dtfmapts.cpp
===================================================================
--- trunk/source/test/intltest/dtfmapts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dtfmapts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/***********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2005, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -225,7 +225,7 @@
status = U_ZERO_ERROR;
DateFormat *test = new SimpleDateFormat(status);
if(U_FAILURE(status)) {
- errln("ERROR: Couldn't create a DateFormat");
+ errcheckln(status, "ERROR: Couldn't create a DateFormat - %s", u_errorName(status));
}
if(test->getDynamicClassID() != SimpleDateFormat::getStaticClassID()) {
@@ -267,7 +267,7 @@
dateFmt->format(dateObj, str, fpos, status);
delete dateFmt;
} else {
- errln("FAIL: Can't create DateFormat");
+ dataerrln("FAIL: Can't create DateFormat");
}
}
@@ -296,7 +296,7 @@
fmt->format(numObj, str, fpos, status);
delete fmt;
} else {
- errln("FAIL: Can't create NumberFormat()");
+ dataerrln("FAIL: Can't create NumberFormat()");
}
}
@@ -317,7 +317,7 @@
fmt.parse(str, obj, ppos);
fmt.parse(str, obj, status);
} else {
- errln("FAIL: Couldn't instantiate DecimalFormat, error %s. Quitting test", u_errorName(status));
+ errcheckln(status, "FAIL: Couldn't instantiate DecimalFormat, error %s. Quitting test", u_errorName(status));
}
}
Modified: trunk/source/test/intltest/dtfmrgts.cpp
===================================================================
--- trunk/source/test/intltest/dtfmrgts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dtfmrgts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -224,7 +224,10 @@
//try {
SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("yyMMdd"), Locale::getUS(), status);
- failure(status, "new SimpleDateFormat");
+ if (failure(status, "new SimpleDateFormat")) {
+ delete fmt;
+ return;
+ }
UDate start = date(1809-1900, UCAL_DECEMBER, 25);
fmt->set2DigitYearStart(start, status);
failure(status, "fmt->setTwoDigitStartDate");
@@ -388,7 +391,7 @@
SimpleDateFormat *df = new SimpleDateFormat(UnicodeString("dd/MM/yyyy"), status);
if(U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat, error: %s", u_errorName(status));
+ errcheckln(status, "Couldn't create SimpleDateFormat, error: %s", u_errorName(status));
delete df;
return;
}
@@ -566,7 +569,7 @@
UErrorCode ec = U_ZERO_ERROR;
SimpleDateFormat fmt("dd/MM/yy", Locale::getUK(), ec);
if (U_FAILURE(ec)) {
- errln("FAIL: SimpleDateFormat constructor");
+ errcheckln(ec, "FAIL: SimpleDateFormat constructor - %s", u_errorName(ec));
return;
}
UnicodeString tests [] = {
@@ -605,7 +608,7 @@
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat *f = new SimpleDateFormat(status);
if(U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat, error %s", u_errorName(status));
+ errcheckln(status, "Couldn't create SimpleDateFormat, error %s", u_errorName(status));
delete f;
delete def;
delete z;
@@ -767,7 +770,7 @@
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat *simple = new SimpleDateFormat(UnicodeString("MM/dd/yyyy HH:mm"), status);
if(U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat, error %s", u_errorName(status));
+ errcheckln(status, "Couldn't create SimpleDateFormat, error %s", u_errorName(status));
delete simple;
return;
}
@@ -792,7 +795,7 @@
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat *sdf = new SimpleDateFormat(status);
if(U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat, error %s", u_errorName(status));
+ errcheckln(status, "Couldn't create SimpleDateFormat, error %s", u_errorName(status));
delete sdf;
return;
}
@@ -857,7 +860,7 @@
SimpleDateFormat *sdf = new SimpleDateFormat(status);
if(U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat, error %s", u_errorName(status));
+ errcheckln(status, "Couldn't create SimpleDateFormat, error %s", u_errorName(status));
delete sdf;
return;
}
@@ -900,7 +903,7 @@
new SimpleDateFormat(UnicodeString("yyyyMMddHHmmss %"), status)
};
if(U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat, error %s", u_errorName(status));
+ errcheckln(status, "Couldn't create SimpleDateFormat, error %s", u_errorName(status));
delete sdfs[0];
delete sdfs[1];
delete sdfs[2];
@@ -1077,7 +1080,7 @@
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat df(format, Locale::getUS(), status);
if(U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat");
+ errcheckln(status, "Couldn't create SimpleDateFormat - %s", u_errorName(status));
return;
}
@@ -1103,7 +1106,7 @@
SimpleDateFormat fmt("MM/dd/yy", Locale::getUS(), status);
SimpleDateFormat dispFmt("MMM dd yyyy GG", Locale::getUS(), status);
if (U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat");
+ errcheckln(status, "Couldn't create SimpleDateFormat - %s", u_errorName(status));
return;
}
@@ -1188,7 +1191,7 @@
DateFormat& fmt = *(DateFormat*)&sfmt; // Yuck: See j25
DateFormat& disp = *(DateFormat*)&sdisp; // Yuck: See j25
if (U_FAILURE(status)) {
- errln("Couldn't create SimpleDateFormat");
+ errcheckln(status, "Couldn't create SimpleDateFormat - %s", u_errorName(status));
return;
}
Calendar* calx = (Calendar*)fmt.getCalendar(); // cast away const!
Modified: trunk/source/test/intltest/dtfmtrtts.cpp
===================================================================
--- trunk/source/test/intltest/dtfmtrtts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dtfmtrtts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -258,7 +258,7 @@
logln("Testing dstyle" + UnicodeString(styleName((DateFormat::EStyle)dstyle)) + ", tstyle" + UnicodeString(styleName((DateFormat::EStyle)tstyle)) );
DateFormat *df = DateFormat::createDateTimeInstance((DateFormat::EStyle)dstyle, (DateFormat::EStyle)tstyle, loc);
if(df == NULL) {
- errln(UnicodeString("Could not DF::createDateTimeInstance ") + UnicodeString(styleName((DateFormat::EStyle)dstyle)) + ", tstyle" + UnicodeString(styleName((DateFormat::EStyle)tstyle)) + "Locale: " + loc.getDisplayName(temp));
+ dataerrln(UnicodeString("Could not DF::createDateTimeInstance ") + UnicodeString(styleName((DateFormat::EStyle)dstyle)) + ", tstyle" + UnicodeString(styleName((DateFormat::EStyle)tstyle)) + "Locale: " + loc.getDisplayName(temp));
} else {
test(df, loc);
delete df;
Modified: trunk/source/test/intltest/dtfmttst.cpp
===================================================================
--- trunk/source/test/intltest/dtfmttst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dtfmttst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -27,7 +27,7 @@
#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
-#define ASSERT_OK(status) if(U_FAILURE(status)) {errln(#status " = %s @ %s:%d", u_errorName(status), __FILE__, __LINE__); return; }
+#define ASSERT_OK(status) if(U_FAILURE(status)) {errcheckln(status, #status " = %s @ %s:%d", u_errorName(status), __FILE__, __LINE__); return; }
// *****************************************************************************
// class DateFormatTest
@@ -237,7 +237,7 @@
UnicodeString str;
if(U_FAILURE(status)) {
- errln("Could not set up test. exitting");
+ errcheckln(status, "Could not set up test. exitting - %s", u_errorName(status));
return;
}
@@ -341,6 +341,9 @@
// Verify data
DateFormatSymbols rootSyms(Locale(""), ec);
assertSuccess("DateFormatSymbols", ec);
+ if (U_FAILURE(ec)) {
+ return;
+ }
// local pattern chars data is not longer loaded
// from icu locale bundle
@@ -452,6 +455,10 @@
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat* f = new SimpleDateFormat(status);
ASSERT_OK(status);
+ if (U_FAILURE(status)) {
+ delete f;
+ return;
+ }
UDate null = 0;
tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:11:42", date(97, 1 - 1, 17, 10, 11, 42));
tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:", null);
@@ -740,7 +747,7 @@
int32_t strings_length = (int32_t)(sizeof(strings) / sizeof(strings[0]));
DateFormat *full = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG);
if(full==NULL) {
- errln("could not create date time instance");
+ dataerrln("could not create date time instance");
return;
}
UnicodeString expected("March 1, 2000 1:23:45 AM ");
@@ -826,7 +833,7 @@
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat* dateParse = new SimpleDateFormat(status);
if(U_FAILURE(status)) {
- errln("Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status));
+ errcheckln(status, "Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status));
delete dateParse;
return;
}
@@ -907,7 +914,7 @@
UErrorCode ec = U_ZERO_ERROR;
SimpleDateFormat fmt("dd/MM/yy", Locale::getUK(), ec);
if (U_FAILURE(ec)) {
- errln("FAIL: SimpleDateFormat constructor");
+ errcheckln(ec, "FAIL: SimpleDateFormat constructor - %s", u_errorName(ec));
return;
}
parse2DigitYear(fmt, "5/6/17", date(117, UCAL_JUNE, 5));
@@ -948,7 +955,7 @@
logln((UnicodeString)"Date 1997/3/25 00:00 GMT: " + date);
formatter = new SimpleDateFormat((UnicodeString)"dd-MMM-yyyyy HH:mm", Locale::getUK(), status);
if(U_FAILURE(status)) {
- errln("Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status));
+ errcheckln(status, "Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status));
delete formatter;
return;
}
@@ -1092,7 +1099,7 @@
/* Create a formatter for date fields. */
date = DateFormat::createDateInstance(DateFormat::kShort, Locale::getUS());
if (date == NULL) {
- errln("FAIL: createDateInstance failed");
+ dataerrln("FAIL: createDateInstance failed");
goto FAIL;
}
@@ -1540,7 +1547,7 @@
SimpleDateFormat ref(data[i++], loc, ec);
SimpleDateFormat gotfmt("G yyyy MM dd HH:mm:ss z", loc, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: SimpleDateFormat constructor");
+ errcheckln(ec, "FAIL: SimpleDateFormat constructor - %s", u_errorName(ec));
return;
}
@@ -1939,7 +1946,7 @@
DateFormat *fullrelative = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
if (fullrelative == NULL) {
- errln("DateFormat::createDateInstance(DateFormat::kFullRelative, %s) returned NULL", loc.getName());
+ dataerrln("DateFormat::createDateInstance(DateFormat::kFullRelative, %s) returned NULL", loc.getName());
return;
}
@@ -2044,7 +2051,7 @@
UDate now = Calendar::getNow();
DateFormat *full = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
if (full == NULL) {
- errln("FAIL: Can't create Relative date instance");
+ dataerrln("FAIL: Can't create Relative date instance");
return;
}
UnicodeString result1;
@@ -2074,7 +2081,7 @@
UDate now = Calendar::getNow();
DateFormat *full = DateFormat::createDateInstance(DateFormat::kFull, loc);
if (full == NULL) {
- errln("FAIL: Can't create Relative date instance");
+ dataerrln("FAIL: Can't create Relative date instance");
return;
}
UnicodeString result1;
@@ -3159,6 +3166,16 @@
DateFormat* fmtl = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::FULL, loc);
DateFormat* fmtm = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL, loc);
DateFormat* fmts = DateFormat::createDateTimeInstance(DateFormat::SHORT, DateFormat::FULL, loc);
+ if (fmtf == NULL || fmtl == NULL || fmtm == NULL || fmts == NULL) {
+ dataerrln("Unable to create DateFormat. got NULL.");
+ /* It may not be true that if one is NULL all is NULL. Just to be safe. */
+ delete fmtf;
+ delete fmtl;
+ delete fmtm;
+ delete fmts;
+
+ return;
+ }
strf = fmtf->format(dt, strf);
strl = fmtl->format(dt, strl);
strm = fmtm->format(dt, strm);
@@ -3237,6 +3254,10 @@
}
DateFormat *fmt = DateFormat::createTimeInstance(DateFormat::kFull, Locale("zh"));
+ if (fmt == NULL) {
+ dataerrln("Unable to create DateFormat. Got NULL.");
+ return;
+ }
fmt->adoptTimeZone(tz);
fmt->format(d1, s1);
Modified: trunk/source/test/intltest/dtifmtts.cpp
===================================================================
--- trunk/source/test/intltest/dtifmtts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dtifmtts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,1214 +1,1214 @@
-
-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 1997-2009, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-
-//TODO: define it in compiler flag
-//#define DTIFMTTS_DEBUG 1
-
-
-#ifdef DTIFMTTS_DEBUG
-#include <iostream>
-#endif
-
-
-#include "cstring.h"
-#include "dtifmtts.h"
-#include "unicode/gregocal.h"
-#include "unicode/dtintrv.h"
-#include "unicode/dtitvinf.h"
-#include "unicode/dtitvfmt.h"
-
-
-
-#ifdef DTIFMTTS_DEBUG
-//#define PRINTMESG(msg) { std::cout << "(" << __FILE__ << ":" << __LINE__ << ") " << msg << "\n"; }
-#define PRINTMESG(msg) { std::cout << msg; }
-#endif
-
-#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
-
-#include <stdio.h>
-
-
-void DateIntervalFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) {
- if (exec) logln("TestSuite DateIntervalFormat");
- switch (index) {
- TESTCASE(0, testAPI);
- TESTCASE(1, testFormat);
- TESTCASE(2, testFormatUserDII);
- TESTCASE(3, testStress);
- default: name = ""; break;
- }
-}
-
-/**
- * Test various generic API methods of DateIntervalFormat for API coverage.
- */
-void DateIntervalFormatTest::testAPI() {
-
- /* ====== Test create interval instance with default locale and skeleton
- */
- UErrorCode status = U_ZERO_ERROR;
- logln("Testing DateIntervalFormat create instance with default locale and skeleton");
-
- DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, status);
- if(U_FAILURE(status)) {
- dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + default locale) - exitting");
- return;
- } else {
- delete dtitvfmt;
- }
-
-
- /* ====== Test create interval instance with given locale and skeleton
- */
- status = U_ZERO_ERROR;
- logln("Testing DateIntervalFormat create instance with given locale and skeleton");
-
- dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, Locale::getJapanese(), status);
- if(U_FAILURE(status)) {
- dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + locale) - exitting");
- return;
- } else {
- delete dtitvfmt;
- }
-
-
- /* ====== Test create interval instance with dateIntervalInfo and skeleton
- */
- status = U_ZERO_ERROR;
- logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
-
- DateIntervalInfo* dtitvinf = new DateIntervalInfo(Locale::getSimplifiedChinese(), status);
-
- dtitvfmt = DateIntervalFormat::createInstance("EEEdMMMyhms", *dtitvinf, status);
- delete dtitvinf;
-
- if(U_FAILURE(status)) {
- dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + default locale) - exitting");
- return;
- } else {
- delete dtitvfmt;
- }
-
-
- /* ====== Test create interval instance with dateIntervalInfo and skeleton
- */
- status = U_ZERO_ERROR;
- logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
-
- dtitvinf = new DateIntervalInfo(Locale::getSimplifiedChinese(), status);
-
- dtitvfmt = DateIntervalFormat::createInstance("EEEdMMMyhms", Locale::getSimplifiedChinese(), *dtitvinf, status);
- delete dtitvinf;
- if(U_FAILURE(status)) {
- dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + locale) - exitting");
- return;
- }
- // not deleted, test clone
-
-
- // ====== Test clone()
- status = U_ZERO_ERROR;
- logln("Testing DateIntervalFormat clone");
-
- DateIntervalFormat* another = (DateIntervalFormat*)dtitvfmt->clone();
- if ( (*another) != (*dtitvfmt) ) {
- dataerrln("ERROR: clone failed");
- }
-
-
- // ====== Test getDateIntervalInfo, setDateIntervalInfo, adoptDateIntervalInfo
- status = U_ZERO_ERROR;
- logln("Testing DateIntervalFormat getDateIntervalInfo");
- const DateIntervalInfo* inf = another->getDateIntervalInfo();
- dtitvfmt->setDateIntervalInfo(*inf, status);
- const DateIntervalInfo* anotherInf = dtitvfmt->getDateIntervalInfo();
- if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
- dataerrln("ERROR: getDateIntervalInfo/setDateIntervalInfo failed");
- }
-
- /*
- status = U_ZERO_ERROR;
- DateIntervalInfo* nonConstInf = inf->clone();
- dtitvfmt->adoptDateIntervalInfo(nonConstInf, status);
- anotherInf = dtitvfmt->getDateIntervalInfo();
- if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
- dataerrln("ERROR: adoptDateIntervalInfo failed");
- }
- */
-
- // ====== Test getDateFormat, setDateFormat, adoptDateFormat
-
- status = U_ZERO_ERROR;
- logln("Testing DateIntervalFormat getDateFormat");
- /*
- const DateFormat* fmt = another->getDateFormat();
- dtitvfmt->setDateFormat(*fmt, status);
- const DateFormat* anotherFmt = dtitvfmt->getDateFormat();
- if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
- dataerrln("ERROR: getDateFormat/setDateFormat failed");
- }
-
- status = U_ZERO_ERROR;
- DateFormat* nonConstFmt = (DateFormat*)fmt->clone();
- dtitvfmt->adoptDateFormat(nonConstFmt, status);
- anotherFmt = dtitvfmt->getDateFormat();
- if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
- dataerrln("ERROR: adoptDateFormat failed");
- }
- delete fmt;
- */
-
-
- // ======= Test getStaticClassID()
-
- logln("Testing getStaticClassID()");
-
-
- if(dtitvfmt->getDynamicClassID() != DateIntervalFormat::getStaticClassID()) {
- errln("ERROR: getDynamicClassID() didn't return the expected value");
- }
-
- delete another;
-
- // ====== test constructor/copy constructor and assignment
- /* they are protected, no test
- logln("Testing DateIntervalFormat constructor and assigment operator");
- status = U_ZERO_ERROR;
-
- DateFormat* constFmt = (constFmt*)dtitvfmt->getDateFormat()->clone();
- inf = dtitvfmt->getDateIntervalInfo()->clone();
-
-
- DateIntervalFormat* dtifmt = new DateIntervalFormat(fmt, inf, status);
- if(U_FAILURE(status)) {
- dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
- return;
- }
-
- DateIntervalFormat* dtifmt2 = new(dtifmt);
- if ( (*dtifmt) != (*dtifmt2) ) {
- dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
- return;
- }
-
- DateIntervalFormat dtifmt3 = (*dtifmt);
- if ( (*dtifmt) != dtifmt3 ) {
- dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
- return;
- }
-
- delete dtifmt2;
- delete dtifmt3;
- delete dtifmt;
- */
-
-
- //===== test format and parse ==================
- Formattable formattable;
- formattable.setInt64(10);
- UnicodeString res;
- FieldPosition pos = 0;
- status = U_ZERO_ERROR;
- dtitvfmt->format(formattable, res, pos, status);
- if ( status != U_ILLEGAL_ARGUMENT_ERROR ) {
- dataerrln("ERROR: format non-date-interval object should set U_ILLEGAL_ARGUMENT_ERROR - exitting");
- return;
- }
-
- DateInterval* dtitv = new DateInterval(3600*24*365, 3600*24*366);
- formattable.adoptObject(dtitv);
- res.remove();
- pos = 0;
- status = U_ZERO_ERROR;
- dtitvfmt->format(formattable, res, pos, status);
- if ( U_FAILURE(status) ) {
- dataerrln("ERROR: format date interval failed - exitting");
- return;
- }
-
- const DateFormat* dfmt = dtitvfmt->getDateFormat();
- Calendar* fromCal = dfmt->getCalendar()->clone();
- Calendar* toCal = dfmt->getCalendar()->clone();
- res.remove();
- pos = 0;
- status = U_ZERO_ERROR;
- dtitvfmt->format(*fromCal, *toCal, res, pos, status);
- if ( U_FAILURE(status) ) {
- dataerrln("ERROR: format date interval failed - exitting");
- return;
- }
- delete fromCal;
- delete toCal;
-
-
- Formattable fmttable;
- status = U_ZERO_ERROR;
- // TODO: why do I need cast?
- ((Format*)dtitvfmt)->parseObject(res, fmttable, status);
- if ( status != U_INVALID_FORMAT_ERROR ) {
- dataerrln("ERROR: parse should set U_INVALID_FORMAT_ERROR - exitting");
- return;
- }
-
- delete dtitvfmt;
-
-
- //====== test format in testFormat()
-
-}
-
-
-/**
- * Test format
- */
-void DateIntervalFormatTest::testFormat() {
- // first item is date pattern
- // followed by a group of locale/from_data/to_data/skeleton/interval_data
- const char* DATA[] = {
- "yyyy MM dd HH:mm:ss",
- // test root
- "root", "2007 11 10 10:10:10", "2007 12 10 10:10:10", "yM", "2007-11 \\u2013 12",
-
- // test 'H' and 'h', using availableFormat in fallback
- "en", "2007 11 10 10:10:10", "2007 11 10 15:10:10", "Hms", "10:10:10 \\u2013 15:10:10",
- "en", "2007 11 10 10:10:10", "2007 11 10 15:10:10", "hms", "10:10:10 AM \\u2013 3:10:10 PM",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMM", "October 2007 \\u2013 October 2008",
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMM", "Oct 2007 \\u2013 Oct 2008",
- // test skeleton with both date and time
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMyhm", "Nov 10, 2007 10:10 AM \\u2013 Nov 20, 2007 10:10 AM",
-
- "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "dMMMyhm", "Nov 10, 2007 10:10\\u201311:10 AM",
-
- "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "hms", "10:10:10 AM \\u2013 11:10:10 AM",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10, 2007 \\u2013 Friday, October 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMMy", "October 10, 2007 \\u2013 October 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMM", "October 10, 2007 \\u2013 October 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMMy", "October 2007 \\u2013 October 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10, 2007 \\u2013 Friday, October 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMMMy", "Wed, Oct 10, 2007 \\u2013 Fri, Oct 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMy", "Oct 10, 2007 \\u2013 Oct 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMM", "Oct 10, 2007 \\u2013 Oct 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMy", "Oct 2007 \\u2013 Oct 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMMM", "Wed, Oct 10, 2007 \\u2013 Fri, Oct 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMy", "10/10/07 \\u2013 10/10/08",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dM", "10/10/07 \\u2013 10/10/08",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "My", "10/07 \\u2013 10/08",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdM", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "d", "10/10/07 \\u2013 10/10/08",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Ed", "10 Wed \\u2013 10 Fri",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "y", "2007\\u20132008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "M", "10/07 \\u2013 10/08",
-
-
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hm", "10/10/2007 10:10 AM \\u2013 10/10/2008 10:10 AM",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hmv", "10/10/2007 10:10 AM PT \\u2013 10/10/2008 10:10 AM PT",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hmz", "10/10/2007 10:10 AM PDT \\u2013 10/10/2008 10:10 AM PDT",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "h", "10/10/2007 10 \\u2013 10/10/2008 10",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hv", "10/10/2007 PT (Hour: 10) \\u2013 10/10/2008 PT (Hour: 10)",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hz", "10/10/2007 PDT (Hour: 10) \\u2013 10/10/2008 PDT (Hour: 10)",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EddMMy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hhmm", "10/10/2007 10:10 AM \\u2013 10/10/2008 10:10 AM",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hhmmzz", "10/10/2007 10:10 AM PDT \\u2013 10/10/2008 10:10 AM PDT",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hms", "10/10/2007 10:10:10 AM \\u2013 10/10/2008 10:10:10 AM",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMMMy", "O 10, 2007 \\u2013 O 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEEdM", "W, 10/10/07 \\u2013 F, 10/10/08",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10 \\u2013 Saturday, November 10, 2007",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMy", "October 10 \\u2013 November 10, 2007",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMM", "October 10 \\u2013 November 10",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMMy", "October\\u2013November 2007",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10 \\u2013 Saturday, November 10",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMMMy", "Wed, Oct 10 \\u2013 Sat, Nov 10, 2007",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMy", "Oct 10 \\u2013 Nov 10, 2007",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMM", "Oct 10 \\u2013 Nov 10",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMy", "Oct\\u2013Nov 2007",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMMM", "Wed, Oct 10 \\u2013 Sat, Nov 10",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMy", "10/10/07 \\u2013 11/10/07",
-
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "My", "10/07 \\u2013 11/07",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdM", "Wed, 10/10 \\u2013 Sat, 11/10",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "d", "10/10 \\u2013 11/10",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "Ed", "10 Wed \\u2013 10 Sat",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "y", "2007",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "M", "10\\u201311",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Oct\\u2013Nov",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMM", "October-November",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hm", "10/10/2007 10:10 AM \\u2013 11/10/2007 10:10 AM",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "10/10/2007 10:10 AM PT \\u2013 11/10/2007 10:10 AM PT",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmz", "10/10/2007 10:10 AM PDT \\u2013 11/10/2007 10:10 AM PST",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "h", "10/10/2007 10 \\u2013 11/10/2007 10",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hv", "10/10/2007 PT (Hour: 10) \\u2013 11/10/2007 PT (Hour: 10)",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hz", "10/10/2007 PDT (Hour: 10) \\u2013 11/10/2007 PST (Hour: 10)",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EddMMy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
-
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hhmmzz", "10/10/2007 10:10 AM PDT \\u2013 11/10/2007 10:10 AM PST",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10/10/2007 10:10:10 AM \\u2013 11/10/2007 10:10:10 AM",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMMy", "O 10 \\u2013 N 10, 2007",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEEdM", "W, 10/10 \\u2013 S, 11/10",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "Saturday, November 10 \\u2013 Tuesday, November 20, 2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMMy", "November 10\\u201320, 2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMM", "November 10\\u201320",
-
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMM", "Saturday, November 10 \\u2013 Tuesday, November 20",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMMMy", "Sat, Nov 10 \\u2013 Tue, Nov 20, 2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMy", "Nov 10\\u201320, 2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMM", "Nov 10\\u201320",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMy", "Nov 2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMMM", "Sat, Nov 10 \\u2013 Tue, Nov 20",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMy", "11/10/07 \\u2013 11/20/07",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "11/10 \\u2013 11/20",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "11/2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdM", "Sat, 11/10 \\u2013 Tue, 11/20",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "d", "10\\u201320",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Ed", "10 Sat \\u2013 20 Tue",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "Nov",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMM", "November",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hm", "11/10/2007 10:10 AM \\u2013 11/20/2007 10:10 AM",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "11/10/2007 10:10 AM PT \\u2013 11/20/2007 10:10 AM PT",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "11/10/2007 10:10 AM PST \\u2013 11/20/2007 10:10 AM PST",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "11/10/2007 10 \\u2013 11/20/2007 10",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hv", "11/10/2007 PT (Hour: 10) \\u2013 11/20/2007 PT (Hour: 10)",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hz", "11/10/2007 PST (Hour: 10) \\u2013 11/20/2007 PST (Hour: 10)",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEddMMyyyy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EddMMy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hhmm", "11/10/2007 10:10 AM \\u2013 11/20/2007 10:10 AM",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hhmmzz", "11/10/2007 10:10 AM PST \\u2013 11/20/2007 10:10 AM PST",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hms", "11/10/2007 10:10:10 AM \\u2013 11/20/2007 10:10:10 AM",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMMMy", "N 10\\u201320, 2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEEdM", "S, 11/10 \\u2013 T, 11/20",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMMy", "Wednesday, January 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMMy", "January 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMM", "January 10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMMy", "January 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMM", "Wednesday, January 10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdMMMy", "Wed, Jan 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMy", "Jan 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMM", "Jan 10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMy", "Jan 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdMMM", "Wed, Jan 10",
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMy", "1/10/2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dM", "1/10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "My", "1/2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdM", "Wed, 1/10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "d", "10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Ed", "10 Wed",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "y", "2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "M", "1",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMM", "Jan",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMM", "January",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "10:00 AM \\u2013 2:10 PM",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmv", "10:00 AM \\u2013 2:10 PM PT",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "10:00 AM \\u2013 2:10 PM PST",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10 AM \\u2013 2 PM",
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hz", "10 AM \\u2013 2 PM PST",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEddMMyyyy", "Wed, 01/10/2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EddMMy", "Wed, 01/10/2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hhmm", "10:00 AM \\u2013 2:10 PM",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hhmmzz", "10:00 AM \\u2013 2:10 PM PST",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hms", "10:00:10 AM \\u2013 2:10:10 PM",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMMMy", "J 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEEdM", "W, 1/10",
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMMy", "January 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMM", "January 10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "MMMMy", "January 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EEEEdMMMM", "Wednesday, January 10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMMMy", "Wed, Jan 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMy", "Jan 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMM", "Jan 10",
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMMM", "Wed, Jan 10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMy", "Wed, 1/10/2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMy", "1/10/2007",
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "My", "1/2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdM", "Wed, 1/10",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "d", "10",
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "y", "2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "M", "1",
-
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "10:00\\u201310:20 AM",
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00\\u201310:20 AM PST",
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hv", "PT (Hour: 10)",
-
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EddMMy", "Wed, 01/10/2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hhmm", "10:00\\u201310:20 AM",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hhmmzz", "10:00\\u201310:20 AM PST",
-
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMMMy", "J 10, 2007",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMMy", "Wednesday, January 10, 2007",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMMy", "January 10, 2007",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "MMMMy", "January 2007",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMM", "Wednesday, January 10",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMy", "Jan 10, 2007",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMM", "Jan 10",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdMMM", "Wed, Jan 10",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdMy", "Wed, 1/10/2007",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMy", "1/10/2007",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "My", "1/2007",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdM", "Wed, 1/10",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "d", "10",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "y", "2007",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "M", "1",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "MMMM", "January",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hm", "10:10 AM",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 AM PST",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "10",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "PT (Hour: 10)",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEddMMyyyy", "Wed, 01/10/2007",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hhmm", "10:10 AM",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hhmmzz", "10:10 AM PST",
-
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMMMy", "J 10, 2007",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEEdM", "W, 1/10",
-
- "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e09\\u81f32008\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e94",
-
-
- "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u81f311\\u670810\\u65e5",
-
-
- "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMMy", "2007\\u5e7410\\u6708\\u81f311\\u6708",
-
-
- "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "2007\\u5e7410\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)\\u20132007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)",
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "2007\\u5e7411\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
-
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMM", "11\\u670810\\u65e5\\u81f320\\u65e5",
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMMy", "2007\\u5E7411\\u6708", // (fixed expected result per ticket:6626:)
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMM", "11\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
-
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "07-11-10\\u5468\\u516d\\u81f307-11-20\\u5468\\u4e8c",
-
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "11-10\\u81f311-20",
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "2007-11",
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdM", "11-10\\u5468\\u516d\\u81f311-20\\u5468\\u4e8c",
-
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007\\u5E74", // (fixed expected result per ticket:6626:)
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11",
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "11\\u6708", // (fixed expected result per ticket:6626:)
-
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "2007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800\\u20132007\\u5e7411\\u670820\\u65e5 \\u4e0a\\u534810:10 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800",
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "2007\\u5e7411\\u670810\\u65e5 10\\u65F6\\u20132007\\u5e7411\\u670820\\u65e5 10\\u65F6", // (fixed expected result per ticket:6626:)
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMMy", "2007\\u5e741\\u670810\\u65e5\\u661f\\u671f\\u4e09", // (fixed expected result per ticket:6626:)
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
-
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6",
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hv", "\\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6",
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "\\u4e0a\\u534810:00\\u81f310:20",
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "\\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)\\u4e0a\\u534810:00\\u81f310:20",
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800 (\\u5c0f\\u65f6: 10\\u65F6)", // (fixed expected result per ticket:6626:)
-
- "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hm", "\\u4e0a\\u534810:10",
-
- "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "10\\u65F6", // (fixed expected result per ticket:6626:)
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt 2007 - Freitag, 10. Okt 2008",
-
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMM", "10. Okt 2007 - 10. Okt 2008",
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMy", "Okt 2007 - Okt 2008",
-
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMy", "Mi., 10.10.07 - Fr., 10.10.08",
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMy", "10.10.07 - 10.10.08",
-
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "My", "10.07 - 10.08",
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdM", "Mi., 10.10.07 - Fr., 10.10.08",
-
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "y", "2007-2008",
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "M", "10.07 - 10.08",
-
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hm", "10.10.2007 10:10 vorm. - 10.10.2008 10:10 vorm.",
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt - Samstag, 10. Nov 2007",
-
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMM", "10. Okt - 10. Nov",
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMy", "Okt-Nov 2007",
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMM", "Mittwoch, 10. Okt - Samstag, 10. Nov",
-
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dM", "10.10. - 10.11.",
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "My", "10.07 - 11.07",
-
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "d", "10.10. - 10.11.",
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "y", "2007",
-
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Okt-Nov",
-
-
- "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10.10.2007 10:10:10 vorm. - 10.11.2007 10:10:10 vorm.",
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMy", "Samstag, 10. - Dienstag, 20. Nov 2007",
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMy", "10.-20. Nov 2007",
-
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMy", "Nov 2007",
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMM", "Samstag, 10. - Dienstag, 20. Nov",
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "Sa., 10.11.07 - Di., 20.11.07",
-
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "10.11. - 20.11.",
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "2007-11",
-
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "d", "10.-20.",
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007",
-
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "10.11.2007 10:10 vorm. Vereinigte Staaten (Los Angeles) - 20.11.2007 10:10 vorm. Vereinigte Staaten (Los Angeles)",
-
- "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMy", "Mittwoch, 10. Jan 2007",
-
-
- "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMM", "10. Jan",
-
- "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMy", "Jan 2007",
-
- "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMM", "Mittwoch 10. Jan",
-
-
- "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10-14",
-
- "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EEEEdMMM", "Mittwoch 10. Jan",
-
-
- "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "10:00-10:20 Vereinigte Staaten (Los Angeles)",
-
- "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00-10:20 GMT-08:00",
-
- "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "h", "10",
-
-
- "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "GMT-08:00 (Stunde: 10)",
-
- "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMy", "Mittwoch, 10. Jan 2007",
-
-
- "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmv", "10:10 vorm. Vereinigte Staaten (Los Angeles)",
-
- "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 vorm. GMT-08:00",
-
-
- "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "Vereinigte Staaten (Los Angeles) (Stunde: 10)",
-
- "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hz", "GMT-08:00 (Stunde: 10)",
- };
- expect(DATA, ARRAY_SIZE(DATA));
-}
-
-
-void DateIntervalFormatTest::expect(const char** data, int32_t data_length) {
- int32_t i = 0;
- UErrorCode ec = U_ZERO_ERROR;
- UnicodeString str, str2;
- const char* pattern = data[0];
- i++;
-
-#ifdef DTIFMTTS_DEBUG
- char result[1000];
- char mesg[1000];
- sprintf(mesg, "locale: %s\n", locName);
- PRINTMESG(mesg);
-#endif
-
- while (i<data_length) {
- const char* locName = data[i++];
- Locale loc(locName);
- SimpleDateFormat ref(pattern, loc, ec);
- if (!assertSuccess("construct SimpleDateFormat in expect", ec)) return;
- // 'f'
- const char* datestr = data[i++];
- const char* datestr_2 = data[i++];
-#ifdef DTIFMTTS_DEBUG
- sprintf(mesg, "original date: %s - %s\n", datestr, datestr_2);
- PRINTMESG(mesg)
-#endif
- UDate date = ref.parse(ctou(datestr), ec);
- if (!assertSuccess("parse 1st data in expect", ec)) return;
- UDate date_2 = ref.parse(ctou(datestr_2), ec);
- if (!assertSuccess("parse 2nd data in expect", ec)) return;
- DateInterval dtitv(date, date_2);
-
- const UnicodeString& oneSkeleton = data[i++];
-
- DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
- if (!assertSuccess("createInstance(skeleton) in expect", ec)) return;
- FieldPosition pos=0;
- dtitvfmt->format(&dtitv, str.remove(), pos, ec);
- if (!assertSuccess("format in expect", ec)) return;
- assertEquals((UnicodeString)"\"" + locName + "\\" + oneSkeleton + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
-
-
-
-#ifdef DTIFMTTS_DEBUG
- str.extract(0, str.length(), result, "UTF-8");
- sprintf(mesg, "interval date: %s\n", result);
- std::cout << "//";
- PRINTMESG(mesg)
- std::cout << "\"" << locName << "\", "
- << "\"" << datestr << "\", "
- << "\"" << datestr_2 << "\", ";
- printUnicodeString(oneSkeleton);
- printUnicodeString(str);
- std::cout << "\n\n";
-#endif
- delete dtitvfmt;
- }
-}
-
-
-/*
- * Test format using user defined DateIntervalInfo
- */
-void DateIntervalFormatTest::testFormatUserDII() {
- // first item is date pattern
- const char* DATA[] = {
- "yyyy MM dd HH:mm:ss",
- "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Oct 10, 2007 --- Oct 10, 2008",
-
- "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 Oct 10 - Nov 2007",
-
- "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Nov 10, 2007 --- Nov 20, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Jan 10, 2007",
-
- "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "Jan 10, 2007",
-
- "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "Jan 10, 2007",
-
- "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "2007\\u5e7410\\u670810\\u65e5 --- 2008\\u5e7410\\u670810\\u65e5",
-
- "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 10\\u6708 10 - 11\\u6708 2007",
-
- "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "2007\\u5e7411\\u670810\\u65e5 --- 2007\\u5e7411\\u670820\\u65e5",
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
-
- "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
-
- "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
-
- "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10. Okt 2007 --- 10. Okt 2008",
-
-
- "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10. Nov 2007 --- 20. Nov 2007",
-
- "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10. Jan 2007",
-
- "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10. Jan 2007",
-
-
- "es", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10 de oct de 2007 --- 10 de oct de 2008",
-
- "es", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 oct 10 - nov 2007",
-
- "es", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10 de nov de 2007 --- 20 de nov de 2007",
-
- "es", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10 de ene de 2007",
-
- "es", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10 de ene de 2007",
-
- "es", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "10 de ene de 2007",
- };
- expectUserDII(DATA, ARRAY_SIZE(DATA));
-}
-
-
-void DateIntervalFormatTest::expectUserDII(const char** data,
- int32_t data_length) {
- int32_t i = 0;
- UnicodeString str;
- UErrorCode ec = U_ZERO_ERROR;
- const char* pattern = data[0];
- i++;
-
- while ( i < data_length ) {
- const char* locName = data[i++];
- Locale loc(locName);
- SimpleDateFormat ref(pattern, loc, ec);
- if (!assertSuccess("construct SimpleDateFormat in expectUserDII", ec)) return;
- const char* datestr = data[i++];
- const char* datestr_2 = data[i++];
- UDate date = ref.parse(ctou(datestr), ec);
- if (!assertSuccess("parse in expectUserDII", ec)) return;
- UDate date_2 = ref.parse(ctou(datestr_2), ec);
- if (!assertSuccess("parse in expectUserDII", ec)) return;
- DateInterval dtitv(date, date_2);
-
- ec = U_ZERO_ERROR;
- // test user created DateIntervalInfo
- DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
- dtitvinf->setFallbackIntervalPattern("{0} --- {1}", ec);
- dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_MONTH, "yyyy MMM d - MMM y",ec);
- if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
- dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_HOUR_OF_DAY, "yyyy MMM d HH:mm - HH:mm", ec);
- if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
- DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
- delete dtitvinf;
- if (!assertSuccess("createInstance(skeleton,dtitvinf) in expectUserDII", ec)) return;
- FieldPosition pos=0;
- dtitvfmt->format(&dtitv, str.remove(), pos, ec);
- if (!assertSuccess("format in expectUserDII", ec)) return;
- assertEquals((UnicodeString)"\"" + locName + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
-#ifdef DTIFMTTS_DEBUG
- char result[1000];
- char mesg[1000];
- PRINTMESG("interval format using user defined DateIntervalInfo\n");
- str.extract(0, str.length(), result, "UTF-8");
- sprintf(mesg, "interval date: %s\n", result);
- PRINTMESG(mesg);
-#endif
- delete dtitvfmt;
- }
-}
-
-
-void DateIntervalFormatTest::testStress() {
- if(quick){
- logln("Quick mode: Skipping test");
- return;
- }
- const char* DATA[] = {
- "yyyy MM dd HH:mm:ss",
- "2007 10 10 10:10:10", "2008 10 10 10:10:10",
- "2007 10 10 10:10:10", "2007 11 10 10:10:10",
- "2007 11 10 10:10:10", "2007 11 20 10:10:10",
- "2007 01 10 10:00:10", "2007 01 10 14:10:10",
- "2007 01 10 10:00:10", "2007 01 10 10:20:10",
- "2007 01 10 10:10:10", "2007 01 10 10:10:20",
- };
-
- const char* testLocale[][3] = {
- //{"th", "", ""},
- {"en", "", ""},
- {"zh", "", ""},
- {"de", "", ""},
- {"ar", "", ""},
- {"en", "GB", ""},
- {"fr", "", ""},
- {"it", "", ""},
- {"nl", "", ""},
- {"zh", "TW", ""},
- {"ja", "", ""},
- {"pt", "BR", ""},
- {"ru", "", ""},
- {"pl", "", ""},
- {"tr", "", ""},
- {"es", "", ""},
- {"ko", "", ""},
- {"sv", "", ""},
- {"fi", "", ""},
- {"da", "", ""},
- {"pt", "PT", ""},
- {"ro", "", ""},
- {"hu", "", ""},
- {"he", "", ""},
- {"in", "", ""},
- {"cs", "", ""},
- {"el", "", ""},
- {"no", "", ""},
- {"vi", "", ""},
- {"bg", "", ""},
- {"hr", "", ""},
- {"lt", "", ""},
- {"sk", "", ""},
- {"sl", "", ""},
- {"sr", "", ""},
- {"ca", "", ""},
- {"lv", "", ""},
- {"uk", "", ""},
- {"hi", "", ""},
- };
-
- uint32_t localeIndex;
- for ( localeIndex = 0; localeIndex < ARRAY_SIZE(testLocale); ++localeIndex ) {
- char locName[32];
- uprv_strcpy(locName, testLocale[localeIndex][0]);
- uprv_strcat(locName, testLocale[localeIndex][1]);
- stress(DATA, ARRAY_SIZE(DATA), Locale(testLocale[localeIndex][0], testLocale[localeIndex][1], testLocale[localeIndex][2]), locName);
- }
-}
-
-
-void DateIntervalFormatTest::stress(const char** data, int32_t data_length,
- const Locale& loc, const char* locName) {
- UnicodeString skeleton[] = {
- "EEEEdMMMMy",
- "dMMMMy",
- "dMMMM",
- "MMMMy",
- "EEEEdMMMM",
- "EdMMMy",
- "dMMMy",
- "dMMM",
- "MMMy",
- "EdMMM",
- "EdMy",
- "dMy",
- "dM",
- "My",
- "EdM",
- "d",
- "Ed",
- "y",
- "M",
- "MMM",
- "MMMM",
- "hm",
- "hmv",
- "hmz",
- "h",
- "hv",
- "hz",
- "EEddMMyyyy", // following could be normalized
- "EddMMy",
- "hhmm",
- "hhmmzz",
- "hms", // following could not be normalized
- "dMMMMMy",
- "EEEEEdM",
- };
-
- int32_t i = 0;
- UErrorCode ec = U_ZERO_ERROR;
- UnicodeString str, str2;
- SimpleDateFormat ref(data[i++], loc, ec);
- if (!assertSuccess("construct SimpleDateFormat", ec)) return;
-
-#ifdef DTIFMTTS_DEBUG
- char result[1000];
- char mesg[1000];
- sprintf(mesg, "locale: %s\n", locName);
- PRINTMESG(mesg);
-#endif
-
- while (i<data_length) {
-
- // 'f'
- const char* datestr = data[i++];
- const char* datestr_2 = data[i++];
-#ifdef DTIFMTTS_DEBUG
- sprintf(mesg, "original date: %s - %s\n", datestr, datestr_2);
- PRINTMESG(mesg)
-#endif
- UDate date = ref.parse(ctou(datestr), ec);
- if (!assertSuccess("parse", ec)) return;
- UDate date_2 = ref.parse(ctou(datestr_2), ec);
- if (!assertSuccess("parse", ec)) return;
- DateInterval dtitv(date, date_2);
-
- for ( uint32_t skeletonIndex = 0;
- skeletonIndex < ARRAY_SIZE(skeleton);
- ++skeletonIndex ) {
- const UnicodeString& oneSkeleton = skeleton[skeletonIndex];
- DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
- if (!assertSuccess("createInstance(skeleton)", ec)) return;
- /*
- // reset the calendar to be Gregorian calendar for "th"
- if ( uprv_strcmp(locName, "th") == 0 ) {
- GregorianCalendar* gregCal = new GregorianCalendar(loc, ec);
- if (!assertSuccess("GregorianCalendar()", ec)) return;
- const DateFormat* dformat = dtitvfmt->getDateFormat();
- DateFormat* newOne = (DateFormat*)dformat->clone();
- newOne->adoptCalendar(gregCal);
- //dtitvfmt->adoptDateFormat(newOne, ec);
- dtitvfmt->setDateFormat(*newOne, ec);
- delete newOne;
- if (!assertSuccess("adoptDateFormat()", ec)) return;
- }
- */
- FieldPosition pos=0;
- dtitvfmt->format(&dtitv, str.remove(), pos, ec);
- if (!assertSuccess("format", ec)) return;
-#ifdef DTIFMTTS_DEBUG
- oneSkeleton.extract(0, oneSkeleton.length(), result, "UTF-8");
- sprintf(mesg, "interval by skeleton: %s\n", result);
- PRINTMESG(mesg)
- str.extract(0, str.length(), result, "UTF-8");
- sprintf(mesg, "interval date: %s\n", result);
- PRINTMESG(mesg)
-#endif
- delete dtitvfmt;
- }
-
- // test user created DateIntervalInfo
- ec = U_ZERO_ERROR;
- DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
- dtitvinf->setFallbackIntervalPattern("{0} --- {1}", ec);
- dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_MONTH, "yyyy MMM d - MMM y",ec);
- if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
- dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_HOUR_OF_DAY, "yyyy MMM d HH:mm - HH:mm", ec);
- if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
- DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
- delete dtitvinf;
- if (!assertSuccess("createInstance(skeleton,dtitvinf)", ec)) return;
- FieldPosition pos=0;
- dtitvfmt->format(&dtitv, str.remove(), pos, ec);
- if ( uprv_strcmp(locName, "th") ) {
- if (!assertSuccess("format", ec)) return;
-#ifdef DTIFMTTS_DEBUG
- PRINTMESG("interval format using user defined DateIntervalInfo\n");
- str.extract(0, str.length(), result, "UTF-8");
- sprintf(mesg, "interval date: %s\n", result);
- PRINTMESG(mesg)
-#endif
- } else {
- // for "th", the default calendar is Budhist,
- // not Gregorian.
- assertTrue("Default calendar for \"th\" is Budhist", ec == U_ILLEGAL_ARGUMENT_ERROR);
- ec = U_ZERO_ERROR;
- }
- delete dtitvfmt;
- }
-}
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
+
+/********************************************************************
+ * COPYRIGHT:
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ ********************************************************************/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+
+//TODO: define it in compiler flag
+//#define DTIFMTTS_DEBUG 1
+
+
+#ifdef DTIFMTTS_DEBUG
+#include <iostream>
+#endif
+
+
+#include "cstring.h"
+#include "dtifmtts.h"
+#include "unicode/gregocal.h"
+#include "unicode/dtintrv.h"
+#include "unicode/dtitvinf.h"
+#include "unicode/dtitvfmt.h"
+
+
+
+#ifdef DTIFMTTS_DEBUG
+//#define PRINTMESG(msg) { std::cout << "(" << __FILE__ << ":" << __LINE__ << ") " << msg << "\n"; }
+#define PRINTMESG(msg) { std::cout << msg; }
+#endif
+
+#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+
+#include <stdio.h>
+
+
+void DateIntervalFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) {
+ if (exec) logln("TestSuite DateIntervalFormat");
+ switch (index) {
+ TESTCASE(0, testAPI);
+ TESTCASE(1, testFormat);
+ TESTCASE(2, testFormatUserDII);
+ TESTCASE(3, testStress);
+ default: name = ""; break;
+ }
+}
+
+/**
+ * Test various generic API methods of DateIntervalFormat for API coverage.
+ */
+void DateIntervalFormatTest::testAPI() {
+
+ /* ====== Test create interval instance with default locale and skeleton
+ */
+ UErrorCode status = U_ZERO_ERROR;
+ logln("Testing DateIntervalFormat create instance with default locale and skeleton");
+
+ DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, status);
+ if(U_FAILURE(status)) {
+ dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + default locale) - exitting");
+ return;
+ } else {
+ delete dtitvfmt;
+ }
+
+
+ /* ====== Test create interval instance with given locale and skeleton
+ */
+ status = U_ZERO_ERROR;
+ logln("Testing DateIntervalFormat create instance with given locale and skeleton");
+
+ dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, Locale::getJapanese(), status);
+ if(U_FAILURE(status)) {
+ dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + locale) - exitting");
+ return;
+ } else {
+ delete dtitvfmt;
+ }
+
+
+ /* ====== Test create interval instance with dateIntervalInfo and skeleton
+ */
+ status = U_ZERO_ERROR;
+ logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
+
+ DateIntervalInfo* dtitvinf = new DateIntervalInfo(Locale::getSimplifiedChinese(), status);
+
+ dtitvfmt = DateIntervalFormat::createInstance("EEEdMMMyhms", *dtitvinf, status);
+ delete dtitvinf;
+
+ if(U_FAILURE(status)) {
+ dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + default locale) - exitting");
+ return;
+ } else {
+ delete dtitvfmt;
+ }
+
+
+ /* ====== Test create interval instance with dateIntervalInfo and skeleton
+ */
+ status = U_ZERO_ERROR;
+ logln("Testing DateIntervalFormat create instance with dateIntervalInfo and skeleton");
+
+ dtitvinf = new DateIntervalInfo(Locale::getSimplifiedChinese(), status);
+
+ dtitvfmt = DateIntervalFormat::createInstance("EEEdMMMyhms", Locale::getSimplifiedChinese(), *dtitvinf, status);
+ delete dtitvinf;
+ if(U_FAILURE(status)) {
+ dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + locale) - exitting");
+ return;
+ }
+ // not deleted, test clone
+
+
+ // ====== Test clone()
+ status = U_ZERO_ERROR;
+ logln("Testing DateIntervalFormat clone");
+
+ DateIntervalFormat* another = (DateIntervalFormat*)dtitvfmt->clone();
+ if ( (*another) != (*dtitvfmt) ) {
+ dataerrln("ERROR: clone failed");
+ }
+
+
+ // ====== Test getDateIntervalInfo, setDateIntervalInfo, adoptDateIntervalInfo
+ status = U_ZERO_ERROR;
+ logln("Testing DateIntervalFormat getDateIntervalInfo");
+ const DateIntervalInfo* inf = another->getDateIntervalInfo();
+ dtitvfmt->setDateIntervalInfo(*inf, status);
+ const DateIntervalInfo* anotherInf = dtitvfmt->getDateIntervalInfo();
+ if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
+ dataerrln("ERROR: getDateIntervalInfo/setDateIntervalInfo failed");
+ }
+
+ /*
+ status = U_ZERO_ERROR;
+ DateIntervalInfo* nonConstInf = inf->clone();
+ dtitvfmt->adoptDateIntervalInfo(nonConstInf, status);
+ anotherInf = dtitvfmt->getDateIntervalInfo();
+ if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
+ dataerrln("ERROR: adoptDateIntervalInfo failed");
+ }
+ */
+
+ // ====== Test getDateFormat, setDateFormat, adoptDateFormat
+
+ status = U_ZERO_ERROR;
+ logln("Testing DateIntervalFormat getDateFormat");
+ /*
+ const DateFormat* fmt = another->getDateFormat();
+ dtitvfmt->setDateFormat(*fmt, status);
+ const DateFormat* anotherFmt = dtitvfmt->getDateFormat();
+ if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
+ dataerrln("ERROR: getDateFormat/setDateFormat failed");
+ }
+
+ status = U_ZERO_ERROR;
+ DateFormat* nonConstFmt = (DateFormat*)fmt->clone();
+ dtitvfmt->adoptDateFormat(nonConstFmt, status);
+ anotherFmt = dtitvfmt->getDateFormat();
+ if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
+ dataerrln("ERROR: adoptDateFormat failed");
+ }
+ delete fmt;
+ */
+
+
+ // ======= Test getStaticClassID()
+
+ logln("Testing getStaticClassID()");
+
+
+ if(dtitvfmt->getDynamicClassID() != DateIntervalFormat::getStaticClassID()) {
+ errln("ERROR: getDynamicClassID() didn't return the expected value");
+ }
+
+ delete another;
+
+ // ====== test constructor/copy constructor and assignment
+ /* they are protected, no test
+ logln("Testing DateIntervalFormat constructor and assigment operator");
+ status = U_ZERO_ERROR;
+
+ DateFormat* constFmt = (constFmt*)dtitvfmt->getDateFormat()->clone();
+ inf = dtitvfmt->getDateIntervalInfo()->clone();
+
+
+ DateIntervalFormat* dtifmt = new DateIntervalFormat(fmt, inf, status);
+ if(U_FAILURE(status)) {
+ dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
+ return;
+ }
+
+ DateIntervalFormat* dtifmt2 = new(dtifmt);
+ if ( (*dtifmt) != (*dtifmt2) ) {
+ dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
+ return;
+ }
+
+ DateIntervalFormat dtifmt3 = (*dtifmt);
+ if ( (*dtifmt) != dtifmt3 ) {
+ dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
+ return;
+ }
+
+ delete dtifmt2;
+ delete dtifmt3;
+ delete dtifmt;
+ */
+
+
+ //===== test format and parse ==================
+ Formattable formattable;
+ formattable.setInt64(10);
+ UnicodeString res;
+ FieldPosition pos = 0;
+ status = U_ZERO_ERROR;
+ dtitvfmt->format(formattable, res, pos, status);
+ if ( status != U_ILLEGAL_ARGUMENT_ERROR ) {
+ dataerrln("ERROR: format non-date-interval object should set U_ILLEGAL_ARGUMENT_ERROR - exitting");
+ return;
+ }
+
+ DateInterval* dtitv = new DateInterval(3600*24*365, 3600*24*366);
+ formattable.adoptObject(dtitv);
+ res.remove();
+ pos = 0;
+ status = U_ZERO_ERROR;
+ dtitvfmt->format(formattable, res, pos, status);
+ if ( U_FAILURE(status) ) {
+ dataerrln("ERROR: format date interval failed - exitting");
+ return;
+ }
+
+ const DateFormat* dfmt = dtitvfmt->getDateFormat();
+ Calendar* fromCal = dfmt->getCalendar()->clone();
+ Calendar* toCal = dfmt->getCalendar()->clone();
+ res.remove();
+ pos = 0;
+ status = U_ZERO_ERROR;
+ dtitvfmt->format(*fromCal, *toCal, res, pos, status);
+ if ( U_FAILURE(status) ) {
+ dataerrln("ERROR: format date interval failed - exitting");
+ return;
+ }
+ delete fromCal;
+ delete toCal;
+
+
+ Formattable fmttable;
+ status = U_ZERO_ERROR;
+ // TODO: why do I need cast?
+ ((Format*)dtitvfmt)->parseObject(res, fmttable, status);
+ if ( status != U_INVALID_FORMAT_ERROR ) {
+ dataerrln("ERROR: parse should set U_INVALID_FORMAT_ERROR - exitting");
+ return;
+ }
+
+ delete dtitvfmt;
+
+
+ //====== test format in testFormat()
+
+}
+
+
+/**
+ * Test format
+ */
+void DateIntervalFormatTest::testFormat() {
+ // first item is date pattern
+ // followed by a group of locale/from_data/to_data/skeleton/interval_data
+ const char* DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+ // test root
+ "root", "2007 11 10 10:10:10", "2007 12 10 10:10:10", "yM", "2007-11 \\u2013 12",
+
+ // test 'H' and 'h', using availableFormat in fallback
+ "en", "2007 11 10 10:10:10", "2007 11 10 15:10:10", "Hms", "10:10:10 \\u2013 15:10:10",
+ "en", "2007 11 10 10:10:10", "2007 11 10 15:10:10", "hms", "10:10:10 AM \\u2013 3:10:10 PM",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMM", "October 2007 \\u2013 October 2008",
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMM", "Oct 2007 \\u2013 Oct 2008",
+ // test skeleton with both date and time
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMyhm", "Nov 10, 2007 10:10 AM \\u2013 Nov 20, 2007 10:10 AM",
+
+ "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "dMMMyhm", "Nov 10, 2007 10:10\\u201311:10 AM",
+
+ "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "hms", "10:10:10 AM \\u2013 11:10:10 AM",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10, 2007 \\u2013 Friday, October 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMMy", "October 10, 2007 \\u2013 October 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMM", "October 10, 2007 \\u2013 October 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMMy", "October 2007 \\u2013 October 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10, 2007 \\u2013 Friday, October 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMMMy", "Wed, Oct 10, 2007 \\u2013 Fri, Oct 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMy", "Oct 10, 2007 \\u2013 Oct 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMM", "Oct 10, 2007 \\u2013 Oct 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMy", "Oct 2007 \\u2013 Oct 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMMM", "Wed, Oct 10, 2007 \\u2013 Fri, Oct 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMy", "10/10/07 \\u2013 10/10/08",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dM", "10/10/07 \\u2013 10/10/08",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "My", "10/07 \\u2013 10/08",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdM", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "d", "10/10/07 \\u2013 10/10/08",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Ed", "10 Wed \\u2013 10 Fri",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "y", "2007\\u20132008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "M", "10/07 \\u2013 10/08",
+
+
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hm", "10/10/2007 10:10 AM \\u2013 10/10/2008 10:10 AM",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hmv", "10/10/2007 10:10 AM PT \\u2013 10/10/2008 10:10 AM PT",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hmz", "10/10/2007 10:10 AM PDT \\u2013 10/10/2008 10:10 AM PDT",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "h", "10/10/2007 10 \\u2013 10/10/2008 10",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hv", "10/10/2007 PT (Hour: 10) \\u2013 10/10/2008 PT (Hour: 10)",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hz", "10/10/2007 PDT (Hour: 10) \\u2013 10/10/2008 PDT (Hour: 10)",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EddMMy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hhmm", "10/10/2007 10:10 AM \\u2013 10/10/2008 10:10 AM",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hhmmzz", "10/10/2007 10:10 AM PDT \\u2013 10/10/2008 10:10 AM PDT",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hms", "10/10/2007 10:10:10 AM \\u2013 10/10/2008 10:10:10 AM",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMMMy", "O 10, 2007 \\u2013 O 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEEdM", "W, 10/10/07 \\u2013 F, 10/10/08",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10 \\u2013 Saturday, November 10, 2007",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMy", "October 10 \\u2013 November 10, 2007",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMM", "October 10 \\u2013 November 10",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMMy", "October\\u2013November 2007",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10 \\u2013 Saturday, November 10",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMMMy", "Wed, Oct 10 \\u2013 Sat, Nov 10, 2007",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMy", "Oct 10 \\u2013 Nov 10, 2007",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMM", "Oct 10 \\u2013 Nov 10",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMy", "Oct\\u2013Nov 2007",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMMM", "Wed, Oct 10 \\u2013 Sat, Nov 10",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMy", "10/10/07 \\u2013 11/10/07",
+
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "My", "10/07 \\u2013 11/07",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdM", "Wed, 10/10 \\u2013 Sat, 11/10",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "d", "10/10 \\u2013 11/10",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "Ed", "10 Wed \\u2013 10 Sat",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "y", "2007",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "M", "10\\u201311",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Oct\\u2013Nov",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMM", "October-November",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hm", "10/10/2007 10:10 AM \\u2013 11/10/2007 10:10 AM",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "10/10/2007 10:10 AM PT \\u2013 11/10/2007 10:10 AM PT",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmz", "10/10/2007 10:10 AM PDT \\u2013 11/10/2007 10:10 AM PST",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "h", "10/10/2007 10 \\u2013 11/10/2007 10",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hv", "10/10/2007 PT (Hour: 10) \\u2013 11/10/2007 PT (Hour: 10)",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hz", "10/10/2007 PDT (Hour: 10) \\u2013 11/10/2007 PST (Hour: 10)",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EddMMy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
+
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hhmmzz", "10/10/2007 10:10 AM PDT \\u2013 11/10/2007 10:10 AM PST",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10/10/2007 10:10:10 AM \\u2013 11/10/2007 10:10:10 AM",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMMy", "O 10 \\u2013 N 10, 2007",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEEdM", "W, 10/10 \\u2013 S, 11/10",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "Saturday, November 10 \\u2013 Tuesday, November 20, 2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMMy", "November 10\\u201320, 2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMM", "November 10\\u201320",
+
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMM", "Saturday, November 10 \\u2013 Tuesday, November 20",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMMMy", "Sat, Nov 10 \\u2013 Tue, Nov 20, 2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMy", "Nov 10\\u201320, 2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMM", "Nov 10\\u201320",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMy", "Nov 2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMMM", "Sat, Nov 10 \\u2013 Tue, Nov 20",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMy", "11/10/07 \\u2013 11/20/07",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "11/10 \\u2013 11/20",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "11/2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdM", "Sat, 11/10 \\u2013 Tue, 11/20",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "d", "10\\u201320",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Ed", "10 Sat \\u2013 20 Tue",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "Nov",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMM", "November",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hm", "11/10/2007 10:10 AM \\u2013 11/20/2007 10:10 AM",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "11/10/2007 10:10 AM PT \\u2013 11/20/2007 10:10 AM PT",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "11/10/2007 10:10 AM PST \\u2013 11/20/2007 10:10 AM PST",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "11/10/2007 10 \\u2013 11/20/2007 10",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hv", "11/10/2007 PT (Hour: 10) \\u2013 11/20/2007 PT (Hour: 10)",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hz", "11/10/2007 PST (Hour: 10) \\u2013 11/20/2007 PST (Hour: 10)",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEddMMyyyy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EddMMy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hhmm", "11/10/2007 10:10 AM \\u2013 11/20/2007 10:10 AM",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hhmmzz", "11/10/2007 10:10 AM PST \\u2013 11/20/2007 10:10 AM PST",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hms", "11/10/2007 10:10:10 AM \\u2013 11/20/2007 10:10:10 AM",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMMMy", "N 10\\u201320, 2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEEdM", "S, 11/10 \\u2013 T, 11/20",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMMy", "Wednesday, January 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMMy", "January 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMM", "January 10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMMy", "January 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMM", "Wednesday, January 10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdMMMy", "Wed, Jan 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMy", "Jan 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMM", "Jan 10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMy", "Jan 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdMMM", "Wed, Jan 10",
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMy", "1/10/2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dM", "1/10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "My", "1/2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdM", "Wed, 1/10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "d", "10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Ed", "10 Wed",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "y", "2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "M", "1",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMM", "Jan",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMM", "January",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "10:00 AM \\u2013 2:10 PM",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmv", "10:00 AM \\u2013 2:10 PM PT",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "10:00 AM \\u2013 2:10 PM PST",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10 AM \\u2013 2 PM",
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hz", "10 AM \\u2013 2 PM PST",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEddMMyyyy", "Wed, 01/10/2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EddMMy", "Wed, 01/10/2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hhmm", "10:00 AM \\u2013 2:10 PM",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hhmmzz", "10:00 AM \\u2013 2:10 PM PST",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hms", "10:00:10 AM \\u2013 2:10:10 PM",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMMMy", "J 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEEdM", "W, 1/10",
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMMy", "January 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMM", "January 10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "MMMMy", "January 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EEEEdMMMM", "Wednesday, January 10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMMMy", "Wed, Jan 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMy", "Jan 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMM", "Jan 10",
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMMM", "Wed, Jan 10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMy", "Wed, 1/10/2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMy", "1/10/2007",
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "My", "1/2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdM", "Wed, 1/10",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "d", "10",
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "y", "2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "M", "1",
+
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "10:00\\u201310:20 AM",
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00\\u201310:20 AM PST",
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hv", "PT (Hour: 10)",
+
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EddMMy", "Wed, 01/10/2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hhmm", "10:00\\u201310:20 AM",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hhmmzz", "10:00\\u201310:20 AM PST",
+
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMMMy", "J 10, 2007",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMMy", "Wednesday, January 10, 2007",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMMy", "January 10, 2007",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "MMMMy", "January 2007",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMM", "Wednesday, January 10",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMy", "Jan 10, 2007",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMM", "Jan 10",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdMMM", "Wed, Jan 10",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdMy", "Wed, 1/10/2007",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMy", "1/10/2007",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "My", "1/2007",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdM", "Wed, 1/10",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "d", "10",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "y", "2007",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "M", "1",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "MMMM", "January",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hm", "10:10 AM",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 AM PST",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "10",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "PT (Hour: 10)",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEddMMyyyy", "Wed, 01/10/2007",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hhmm", "10:10 AM",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hhmmzz", "10:10 AM PST",
+
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMMMy", "J 10, 2007",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEEdM", "W, 1/10",
+
+ "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e09\\u81f32008\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e94",
+
+
+ "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u81f311\\u670810\\u65e5",
+
+
+ "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMMy", "2007\\u5e7410\\u6708\\u81f311\\u6708",
+
+
+ "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "2007\\u5e7410\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)\\u20132007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)",
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "2007\\u5e7411\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
+
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMM", "11\\u670810\\u65e5\\u81f320\\u65e5",
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMMy", "2007\\u5E7411\\u6708", // (fixed expected result per ticket:6626:)
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMM", "11\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
+
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "07-11-10\\u5468\\u516d\\u81f307-11-20\\u5468\\u4e8c",
+
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "11-10\\u81f311-20",
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "2007-11",
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdM", "11-10\\u5468\\u516d\\u81f311-20\\u5468\\u4e8c",
+
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007\\u5E74", // (fixed expected result per ticket:6626:)
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11",
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "11\\u6708", // (fixed expected result per ticket:6626:)
+
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "2007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800\\u20132007\\u5e7411\\u670820\\u65e5 \\u4e0a\\u534810:10 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800",
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "2007\\u5e7411\\u670810\\u65e5 10\\u65F6\\u20132007\\u5e7411\\u670820\\u65e5 10\\u65F6", // (fixed expected result per ticket:6626:)
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMMy", "2007\\u5e741\\u670810\\u65e5\\u661f\\u671f\\u4e09", // (fixed expected result per ticket:6626:)
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
+
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6",
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hv", "\\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6",
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "\\u4e0a\\u534810:00\\u81f310:20",
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "\\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)\\u4e0a\\u534810:00\\u81f310:20",
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800 (\\u5c0f\\u65f6: 10\\u65F6)", // (fixed expected result per ticket:6626:)
+
+ "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hm", "\\u4e0a\\u534810:10",
+
+ "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "10\\u65F6", // (fixed expected result per ticket:6626:)
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt 2007 - Freitag, 10. Okt 2008",
+
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMM", "10. Okt 2007 - 10. Okt 2008",
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMy", "Okt 2007 - Okt 2008",
+
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMy", "Mi., 10.10.07 - Fr., 10.10.08",
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMy", "10.10.07 - 10.10.08",
+
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "My", "10.07 - 10.08",
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdM", "Mi., 10.10.07 - Fr., 10.10.08",
+
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "y", "2007-2008",
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "M", "10.07 - 10.08",
+
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hm", "10.10.2007 10:10 vorm. - 10.10.2008 10:10 vorm.",
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt - Samstag, 10. Nov 2007",
+
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMM", "10. Okt - 10. Nov",
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMy", "Okt-Nov 2007",
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMM", "Mittwoch, 10. Okt - Samstag, 10. Nov",
+
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dM", "10.10. - 10.11.",
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "My", "10.07 - 11.07",
+
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "d", "10.10. - 10.11.",
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "y", "2007",
+
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Okt-Nov",
+
+
+ "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10.10.2007 10:10:10 vorm. - 10.11.2007 10:10:10 vorm.",
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMy", "Samstag, 10. - Dienstag, 20. Nov 2007",
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMy", "10.-20. Nov 2007",
+
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMy", "Nov 2007",
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMM", "Samstag, 10. - Dienstag, 20. Nov",
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "Sa., 10.11.07 - Di., 20.11.07",
+
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "10.11. - 20.11.",
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "2007-11",
+
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "d", "10.-20.",
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007",
+
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "10.11.2007 10:10 vorm. Vereinigte Staaten (Los Angeles) - 20.11.2007 10:10 vorm. Vereinigte Staaten (Los Angeles)",
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMy", "Mittwoch, 10. Jan 2007",
+
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMM", "10. Jan",
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMy", "Jan 2007",
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMM", "Mittwoch 10. Jan",
+
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10-14",
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EEEEdMMM", "Mittwoch 10. Jan",
+
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "10:00-10:20 Vereinigte Staaten (Los Angeles)",
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00-10:20 GMT-08:00",
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "h", "10",
+
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "GMT-08:00 (Stunde: 10)",
+
+ "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMy", "Mittwoch, 10. Jan 2007",
+
+
+ "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmv", "10:10 vorm. Vereinigte Staaten (Los Angeles)",
+
+ "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 vorm. GMT-08:00",
+
+
+ "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "Vereinigte Staaten (Los Angeles) (Stunde: 10)",
+
+ "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hz", "GMT-08:00 (Stunde: 10)",
+ };
+ expect(DATA, ARRAY_SIZE(DATA));
+}
+
+
+void DateIntervalFormatTest::expect(const char** data, int32_t data_length) {
+ int32_t i = 0;
+ UErrorCode ec = U_ZERO_ERROR;
+ UnicodeString str, str2;
+ const char* pattern = data[0];
+ i++;
+
+#ifdef DTIFMTTS_DEBUG
+ char result[1000];
+ char mesg[1000];
+ sprintf(mesg, "locale: %s\n", locName);
+ PRINTMESG(mesg);
+#endif
+
+ while (i<data_length) {
+ const char* locName = data[i++];
+ Locale loc(locName);
+ SimpleDateFormat ref(pattern, loc, ec);
+ if (!assertSuccess("construct SimpleDateFormat in expect", ec)) return;
+ // 'f'
+ const char* datestr = data[i++];
+ const char* datestr_2 = data[i++];
+#ifdef DTIFMTTS_DEBUG
+ sprintf(mesg, "original date: %s - %s\n", datestr, datestr_2);
+ PRINTMESG(mesg)
+#endif
+ UDate date = ref.parse(ctou(datestr), ec);
+ if (!assertSuccess("parse 1st data in expect", ec)) return;
+ UDate date_2 = ref.parse(ctou(datestr_2), ec);
+ if (!assertSuccess("parse 2nd data in expect", ec)) return;
+ DateInterval dtitv(date, date_2);
+
+ const UnicodeString& oneSkeleton = data[i++];
+
+ DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
+ if (!assertSuccess("createInstance(skeleton) in expect", ec)) return;
+ FieldPosition pos=0;
+ dtitvfmt->format(&dtitv, str.remove(), pos, ec);
+ if (!assertSuccess("format in expect", ec)) return;
+ assertEquals((UnicodeString)"\"" + locName + "\\" + oneSkeleton + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
+
+
+
+#ifdef DTIFMTTS_DEBUG
+ str.extract(0, str.length(), result, "UTF-8");
+ sprintf(mesg, "interval date: %s\n", result);
+ std::cout << "//";
+ PRINTMESG(mesg)
+ std::cout << "\"" << locName << "\", "
+ << "\"" << datestr << "\", "
+ << "\"" << datestr_2 << "\", ";
+ printUnicodeString(oneSkeleton);
+ printUnicodeString(str);
+ std::cout << "\n\n";
+#endif
+ delete dtitvfmt;
+ }
+}
+
+
+/*
+ * Test format using user defined DateIntervalInfo
+ */
+void DateIntervalFormatTest::testFormatUserDII() {
+ // first item is date pattern
+ const char* DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+ "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Oct 10, 2007 --- Oct 10, 2008",
+
+ "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 Oct 10 - Nov 2007",
+
+ "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Nov 10, 2007 --- Nov 20, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Jan 10, 2007",
+
+ "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "Jan 10, 2007",
+
+ "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "Jan 10, 2007",
+
+ "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "2007\\u5e7410\\u670810\\u65e5 --- 2008\\u5e7410\\u670810\\u65e5",
+
+ "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 10\\u6708 10 - 11\\u6708 2007",
+
+ "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "2007\\u5e7411\\u670810\\u65e5 --- 2007\\u5e7411\\u670820\\u65e5",
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
+
+ "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
+
+ "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
+
+ "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10. Okt 2007 --- 10. Okt 2008",
+
+
+ "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10. Nov 2007 --- 20. Nov 2007",
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10. Jan 2007",
+
+ "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10. Jan 2007",
+
+
+ "es", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10 de oct de 2007 --- 10 de oct de 2008",
+
+ "es", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 oct 10 - nov 2007",
+
+ "es", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10 de nov de 2007 --- 20 de nov de 2007",
+
+ "es", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10 de ene de 2007",
+
+ "es", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10 de ene de 2007",
+
+ "es", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "10 de ene de 2007",
+ };
+ expectUserDII(DATA, ARRAY_SIZE(DATA));
+}
+
+
+void DateIntervalFormatTest::expectUserDII(const char** data,
+ int32_t data_length) {
+ int32_t i = 0;
+ UnicodeString str;
+ UErrorCode ec = U_ZERO_ERROR;
+ const char* pattern = data[0];
+ i++;
+
+ while ( i < data_length ) {
+ const char* locName = data[i++];
+ Locale loc(locName);
+ SimpleDateFormat ref(pattern, loc, ec);
+ if (!assertSuccess("construct SimpleDateFormat in expectUserDII", ec)) return;
+ const char* datestr = data[i++];
+ const char* datestr_2 = data[i++];
+ UDate date = ref.parse(ctou(datestr), ec);
+ if (!assertSuccess("parse in expectUserDII", ec)) return;
+ UDate date_2 = ref.parse(ctou(datestr_2), ec);
+ if (!assertSuccess("parse in expectUserDII", ec)) return;
+ DateInterval dtitv(date, date_2);
+
+ ec = U_ZERO_ERROR;
+ // test user created DateIntervalInfo
+ DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
+ dtitvinf->setFallbackIntervalPattern("{0} --- {1}", ec);
+ dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_MONTH, "yyyy MMM d - MMM y",ec);
+ if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
+ dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_HOUR_OF_DAY, "yyyy MMM d HH:mm - HH:mm", ec);
+ if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
+ DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
+ delete dtitvinf;
+ if (!assertSuccess("createInstance(skeleton,dtitvinf) in expectUserDII", ec)) return;
+ FieldPosition pos=0;
+ dtitvfmt->format(&dtitv, str.remove(), pos, ec);
+ if (!assertSuccess("format in expectUserDII", ec)) return;
+ assertEquals((UnicodeString)"\"" + locName + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
+#ifdef DTIFMTTS_DEBUG
+ char result[1000];
+ char mesg[1000];
+ PRINTMESG("interval format using user defined DateIntervalInfo\n");
+ str.extract(0, str.length(), result, "UTF-8");
+ sprintf(mesg, "interval date: %s\n", result);
+ PRINTMESG(mesg);
+#endif
+ delete dtitvfmt;
+ }
+}
+
+
+void DateIntervalFormatTest::testStress() {
+ if(quick){
+ logln("Quick mode: Skipping test");
+ return;
+ }
+ const char* DATA[] = {
+ "yyyy MM dd HH:mm:ss",
+ "2007 10 10 10:10:10", "2008 10 10 10:10:10",
+ "2007 10 10 10:10:10", "2007 11 10 10:10:10",
+ "2007 11 10 10:10:10", "2007 11 20 10:10:10",
+ "2007 01 10 10:00:10", "2007 01 10 14:10:10",
+ "2007 01 10 10:00:10", "2007 01 10 10:20:10",
+ "2007 01 10 10:10:10", "2007 01 10 10:10:20",
+ };
+
+ const char* testLocale[][3] = {
+ //{"th", "", ""},
+ {"en", "", ""},
+ {"zh", "", ""},
+ {"de", "", ""},
+ {"ar", "", ""},
+ {"en", "GB", ""},
+ {"fr", "", ""},
+ {"it", "", ""},
+ {"nl", "", ""},
+ {"zh", "TW", ""},
+ {"ja", "", ""},
+ {"pt", "BR", ""},
+ {"ru", "", ""},
+ {"pl", "", ""},
+ {"tr", "", ""},
+ {"es", "", ""},
+ {"ko", "", ""},
+ {"sv", "", ""},
+ {"fi", "", ""},
+ {"da", "", ""},
+ {"pt", "PT", ""},
+ {"ro", "", ""},
+ {"hu", "", ""},
+ {"he", "", ""},
+ {"in", "", ""},
+ {"cs", "", ""},
+ {"el", "", ""},
+ {"no", "", ""},
+ {"vi", "", ""},
+ {"bg", "", ""},
+ {"hr", "", ""},
+ {"lt", "", ""},
+ {"sk", "", ""},
+ {"sl", "", ""},
+ {"sr", "", ""},
+ {"ca", "", ""},
+ {"lv", "", ""},
+ {"uk", "", ""},
+ {"hi", "", ""},
+ };
+
+ uint32_t localeIndex;
+ for ( localeIndex = 0; localeIndex < ARRAY_SIZE(testLocale); ++localeIndex ) {
+ char locName[32];
+ uprv_strcpy(locName, testLocale[localeIndex][0]);
+ uprv_strcat(locName, testLocale[localeIndex][1]);
+ stress(DATA, ARRAY_SIZE(DATA), Locale(testLocale[localeIndex][0], testLocale[localeIndex][1], testLocale[localeIndex][2]), locName);
+ }
+}
+
+
+void DateIntervalFormatTest::stress(const char** data, int32_t data_length,
+ const Locale& loc, const char* locName) {
+ UnicodeString skeleton[] = {
+ "EEEEdMMMMy",
+ "dMMMMy",
+ "dMMMM",
+ "MMMMy",
+ "EEEEdMMMM",
+ "EdMMMy",
+ "dMMMy",
+ "dMMM",
+ "MMMy",
+ "EdMMM",
+ "EdMy",
+ "dMy",
+ "dM",
+ "My",
+ "EdM",
+ "d",
+ "Ed",
+ "y",
+ "M",
+ "MMM",
+ "MMMM",
+ "hm",
+ "hmv",
+ "hmz",
+ "h",
+ "hv",
+ "hz",
+ "EEddMMyyyy", // following could be normalized
+ "EddMMy",
+ "hhmm",
+ "hhmmzz",
+ "hms", // following could not be normalized
+ "dMMMMMy",
+ "EEEEEdM",
+ };
+
+ int32_t i = 0;
+ UErrorCode ec = U_ZERO_ERROR;
+ UnicodeString str, str2;
+ SimpleDateFormat ref(data[i++], loc, ec);
+ if (!assertSuccess("construct SimpleDateFormat", ec)) return;
+
+#ifdef DTIFMTTS_DEBUG
+ char result[1000];
+ char mesg[1000];
+ sprintf(mesg, "locale: %s\n", locName);
+ PRINTMESG(mesg);
+#endif
+
+ while (i<data_length) {
+
+ // 'f'
+ const char* datestr = data[i++];
+ const char* datestr_2 = data[i++];
+#ifdef DTIFMTTS_DEBUG
+ sprintf(mesg, "original date: %s - %s\n", datestr, datestr_2);
+ PRINTMESG(mesg)
+#endif
+ UDate date = ref.parse(ctou(datestr), ec);
+ if (!assertSuccess("parse", ec)) return;
+ UDate date_2 = ref.parse(ctou(datestr_2), ec);
+ if (!assertSuccess("parse", ec)) return;
+ DateInterval dtitv(date, date_2);
+
+ for ( uint32_t skeletonIndex = 0;
+ skeletonIndex < ARRAY_SIZE(skeleton);
+ ++skeletonIndex ) {
+ const UnicodeString& oneSkeleton = skeleton[skeletonIndex];
+ DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
+ if (!assertSuccess("createInstance(skeleton)", ec)) return;
+ /*
+ // reset the calendar to be Gregorian calendar for "th"
+ if ( uprv_strcmp(locName, "th") == 0 ) {
+ GregorianCalendar* gregCal = new GregorianCalendar(loc, ec);
+ if (!assertSuccess("GregorianCalendar()", ec)) return;
+ const DateFormat* dformat = dtitvfmt->getDateFormat();
+ DateFormat* newOne = (DateFormat*)dformat->clone();
+ newOne->adoptCalendar(gregCal);
+ //dtitvfmt->adoptDateFormat(newOne, ec);
+ dtitvfmt->setDateFormat(*newOne, ec);
+ delete newOne;
+ if (!assertSuccess("adoptDateFormat()", ec)) return;
+ }
+ */
+ FieldPosition pos=0;
+ dtitvfmt->format(&dtitv, str.remove(), pos, ec);
+ if (!assertSuccess("format", ec)) return;
+#ifdef DTIFMTTS_DEBUG
+ oneSkeleton.extract(0, oneSkeleton.length(), result, "UTF-8");
+ sprintf(mesg, "interval by skeleton: %s\n", result);
+ PRINTMESG(mesg)
+ str.extract(0, str.length(), result, "UTF-8");
+ sprintf(mesg, "interval date: %s\n", result);
+ PRINTMESG(mesg)
+#endif
+ delete dtitvfmt;
+ }
+
+ // test user created DateIntervalInfo
+ ec = U_ZERO_ERROR;
+ DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
+ dtitvinf->setFallbackIntervalPattern("{0} --- {1}", ec);
+ dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_MONTH, "yyyy MMM d - MMM y",ec);
+ if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
+ dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_HOUR_OF_DAY, "yyyy MMM d HH:mm - HH:mm", ec);
+ if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
+ DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
+ delete dtitvinf;
+ if (!assertSuccess("createInstance(skeleton,dtitvinf)", ec)) return;
+ FieldPosition pos=0;
+ dtitvfmt->format(&dtitv, str.remove(), pos, ec);
+ if ( uprv_strcmp(locName, "th") ) {
+ if (!assertSuccess("format", ec)) return;
+#ifdef DTIFMTTS_DEBUG
+ PRINTMESG("interval format using user defined DateIntervalInfo\n");
+ str.extract(0, str.length(), result, "UTF-8");
+ sprintf(mesg, "interval date: %s\n", result);
+ PRINTMESG(mesg)
+#endif
+ } else {
+ // for "th", the default calendar is Budhist,
+ // not Gregorian.
+ assertTrue("Default calendar for \"th\" is Budhist", ec == U_ILLEGAL_ARGUMENT_ERROR);
+ ec = U_ZERO_ERROR;
+ }
+ delete dtitvfmt;
+ }
+}
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
Modified: trunk/source/test/intltest/dtifmtts.h
===================================================================
--- trunk/source/test/intltest/dtifmtts.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/dtifmtts.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,65 +1,65 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 2008, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
-#ifndef _INTLTESTDATEINTERVALFORMAT
-#define _INTLTESTDATEINTERVALFORMAT
-
-#include "unicode/utypes.h"
-#include "unicode/locid.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "intltest.h"
-
-/**
- * Test basic functionality of various API functions
- **/
-class DateIntervalFormatTest: public IntlTest {
- void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
-
-public:
- /**
- * Performs tests on many API functions, see detailed comments in source code
- **/
- void testAPI();
-
- /**
- * Test formatting
- */
- void testFormat();
-
- /**
- * Test formatting using user defined DateIntervalInfo
- */
- void testFormatUserDII();
-
- /**
- * Stress test -- stress test formatting on 40 locales
- */
- void testStress();
-
-private:
- /**
- * Test formatting against expected result
- */
- void expect(const char** data, int32_t data_length);
-
- /**
- * Test formatting against expected result using user defined
- * DateIntervalInfo
- */
- void expectUserDII(const char** data, int32_t data_length);
-
- /**
- * Stress test formatting
- */
- void stress(const char** data, int32_t data_length, const Locale& loc,
- const char* locName);
-};
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-#endif
+/********************************************************************
+ * COPYRIGHT:
+ * Copyright (c) 2008, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ ********************************************************************/
+
+#ifndef _INTLTESTDATEINTERVALFORMAT
+#define _INTLTESTDATEINTERVALFORMAT
+
+#include "unicode/utypes.h"
+#include "unicode/locid.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "intltest.h"
+
+/**
+ * Test basic functionality of various API functions
+ **/
+class DateIntervalFormatTest: public IntlTest {
+ void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
+
+public:
+ /**
+ * Performs tests on many API functions, see detailed comments in source code
+ **/
+ void testAPI();
+
+ /**
+ * Test formatting
+ */
+ void testFormat();
+
+ /**
+ * Test formatting using user defined DateIntervalInfo
+ */
+ void testFormatUserDII();
+
+ /**
+ * Stress test -- stress test formatting on 40 locales
+ */
+ void testStress();
+
+private:
+ /**
+ * Test formatting against expected result
+ */
+ void expect(const char** data, int32_t data_length);
+
+ /**
+ * Test formatting against expected result using user defined
+ * DateIntervalInfo
+ */
+ void expectUserDII(const char** data, int32_t data_length);
+
+ /**
+ * Stress test formatting
+ */
+ void stress(const char** data, int32_t data_length, const Locale& loc,
+ const char* locName);
+};
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
Modified: trunk/source/test/intltest/encoll.cpp
===================================================================
--- trunk/source/test/intltest/encoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/encoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -326,7 +326,7 @@
default: name = ""; break;
}
} else {
- errln("Collator couldn't be instantiated!");
+ dataerrln("Collator couldn't be instantiated!");
name = "";
}
}
Modified: trunk/source/test/intltest/escoll.cpp
===================================================================
--- trunk/source/test/intltest/escoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/escoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,7 +1,7 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2006, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -102,7 +102,7 @@
if (exec) logln("TestSuite CollationSpanishTest: ");
if((!myCollation) && exec) {
- errln(__FILE__ " cannot test - failed to create collator.");
+ dataerrln(__FILE__ " cannot test - failed to create collator.");
name = "some test";
return;
}
Modified: trunk/source/test/intltest/ficoll.cpp
===================================================================
--- trunk/source/test/intltest/ficoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/ficoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/********************************************************************
- * Copyright (c) 1997-2007, International Business Machines
+ * Copyright (c) 1997-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
@@ -88,7 +88,7 @@
if (exec) logln("TestSuite CollationFinnishTest: ");
if((!myCollation) && exec) {
- errln(__FILE__ " cannot test - failed to create collator.");
+ dataerrln(__FILE__ " cannot test - failed to create collator.");
name = "some test";
return;
}
Modified: trunk/source/test/intltest/frcoll.cpp
===================================================================
--- trunk/source/test/intltest/frcoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/frcoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -29,7 +29,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = Collator::createInstance(Locale::getFrance(), status);
if(!myCollation || U_FAILURE(status)) {
- errln(__FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
+ errcheckln(status, __FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
/* if it wasn't already: */
delete myCollation;
myCollation = NULL;
@@ -201,7 +201,7 @@
if (exec) logln("TestSuite CollationFrenchTest: ");
if((!myCollation) && exec) {
- errln(__FILE__ " cannot test - failed to create collator.");
+ dataerrln(__FILE__ " cannot test - failed to create collator.");
name = "some test";
return;
}
Modified: trunk/source/test/intltest/g7coll.cpp
===================================================================
--- trunk/source/test/intltest/g7coll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/g7coll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -102,7 +102,7 @@
myCollation = Collator::createInstance(locales[i], status);
if(U_FAILURE(status)) {
delete myCollation;
- errln("Couldn't instantiate collator. Error: %s", u_errorName(status));
+ errcheckln(status, "Couldn't instantiate collator. Error: %s", u_errorName(status));
return;
}
myCollation->setStrength(Collator::QUATERNARY);
@@ -162,7 +162,7 @@
Collator *col = Collator::createInstance("en_US", status);
if(U_FAILURE(status)) {
delete col;
- errln("Couldn't instantiate collator. Error: %s", u_errorName(status));
+ errcheckln(status, "Couldn't instantiate collator. Error: %s", u_errorName(status));
return;
}
const UnicodeString baseRules = ((RuleBasedCollator*)col)->getRules();
@@ -196,7 +196,7 @@
Collator *col = Collator::createInstance("en_US", status);
if(U_FAILURE(status)) {
delete col;
- errln("Couldn't instantiate collator. Error: %s", u_errorName(status));
+ errcheckln(status, "Couldn't instantiate collator. Error: %s", u_errorName(status));
return;
}
const UnicodeString baseRules = ((RuleBasedCollator*)col)->getRules();
@@ -229,7 +229,7 @@
UErrorCode status = U_ZERO_ERROR;
Collator *col = Collator::createInstance("en_US", status);
if(U_FAILURE(status)) {
- errln("Couldn't instantiate collator. Error: %s", u_errorName(status));
+ errcheckln(status, "Couldn't instantiate collator. Error: %s", u_errorName(status));
delete col;
return;
}
@@ -264,7 +264,7 @@
Collator *col = Collator::createInstance("en_US", status);
if(U_FAILURE(status)) {
delete col;
- errln("Couldn't instantiate collator. Error: %s", u_errorName(status));
+ errcheckln(status, "Couldn't instantiate collator. Error: %s", u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/icusvtst.cpp
===================================================================
--- trunk/source/test/intltest/icusvtst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/icusvtst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/**
*******************************************************************************
- * Copyright (C) 2001-2008, International Business Machines Corporation and *
+ * Copyright (C) 2001-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@@ -278,7 +278,7 @@
if (equ) {
logln(temp);
} else {
- errln(temp);
+ dataerrln(temp);
}
}
Modified: trunk/source/test/intltest/idnaconf.cpp
===================================================================
--- trunk/source/test/intltest/idnaconf.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/idnaconf.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
- * Copyright (C) 2005-2008, International Business Machines
+ * Copyright (C) 2005-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -80,7 +80,7 @@
delete [] absolute_name;
if (f == NULL){
- dataerrln("[DATA] fopen error on %s", name);
+ dataerrln("fopen error on %s", name);
return FALSE;
}
@@ -241,8 +241,9 @@
}
if (passfail == 0){
if (U_FAILURE(status)){
- id.append(" should pass, but failed.");
- errln(id);
+ id.append(" should pass, but failed. - ");
+ id.append(u_errorName(status));
+ errcheckln(status, id);
} else{
if (namezone.compare(result, -1) == 0){
// expected
Modified: trunk/source/test/intltest/incaltst.cpp
===================================================================
--- trunk/source/test/intltest/incaltst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/incaltst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -18,7 +18,7 @@
#define CHECK(status, msg) \
if (U_FAILURE(status)) { \
- errln((UnicodeString(u_errorName(status)) + UnicodeString(" : " ) )+ msg); \
+ errcheckln(status, (UnicodeString(u_errorName(status)) + UnicodeString(" : " ) )+ msg); \
return; \
}
@@ -131,7 +131,7 @@
if(U_SUCCESS(status)) {
logln(UnicodeString(" type is ") + c->getType());
if(strcmp(c->getType(), types[j])) {
- errln(UnicodeString(locs[j]) + UnicodeString("Calendar type ") + c->getType() + " instead of " + types[j]);
+ dataerrln(UnicodeString(locs[j]) + UnicodeString("Calendar type ") + c->getType() + " instead of " + types[j]);
}
}
delete c;
Modified: trunk/source/test/intltest/intltest.cpp
===================================================================
--- trunk/source/test/intltest/intltest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/intltest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -785,14 +785,25 @@
void IntlTest::dataerrln( const UnicodeString &message )
{
IncDataErrorCount();
-
+ UnicodeString msg;
if (!warn_on_missing_data) {
IncErrorCount();
+ msg = message;
+ } else {
+ msg = UnicodeString("[DATA] " + message);
}
- if (!no_err_msg) LL_message( message, TRUE );
+ if (!no_err_msg) LL_message( msg + " - (Are you missing data?)", TRUE );
}
+void IntlTest::errcheckln(UErrorCode status, const UnicodeString &message ) {
+ if (status == U_FILE_ACCESS_ERROR || status == U_MISSING_RESOURCE_ERROR) {
+ dataerrln(message);
+ } else {
+ errln(message);
+ }
+}
+
/* convenience functions that include sprintf formatting */
void IntlTest::log(const char *fmt, ...)
{
@@ -880,6 +891,22 @@
dataerrln(UnicodeString(buffer, ""));
}
+void IntlTest::errcheckln(UErrorCode status, const char *fmt, ...)
+{
+ char buffer[4000];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(buffer, fmt, ap);
+ va_end(ap);
+
+ if (status == U_FILE_ACCESS_ERROR || status == U_MISSING_RESOURCE_ERROR) {
+ dataerrln(UnicodeString(buffer, ""));
+ } else {
+ errln(UnicodeString(buffer, ""));
+ }
+}
+
void IntlTest::printErrors()
{
IntlTest::LL_message(errorList, TRUE);
@@ -1303,7 +1330,7 @@
if(U_FAILURE(err)){
err = U_FILE_ACCESS_ERROR;
- it_dataerrln((UnicodeString)"[DATA] Could not load testtypes.res in testdata bundle with path " + tdpath + (UnicodeString)" - " + u_errorName(err));
+ it_dataerrln((UnicodeString)"Could not load testtypes.res in testdata bundle with path " + tdpath + (UnicodeString)" - " + u_errorName(err));
return "";
}
ures_close(test);
@@ -1487,9 +1514,13 @@
#define VERBOSE_ASSERTIONS
-UBool IntlTest::assertTrue(const char* message, UBool condition, UBool quiet) {
+UBool IntlTest::assertTrue(const char* message, UBool condition, UBool quiet, UBool possibleDataError) {
if (!condition) {
- errln("FAIL: assertTrue() failed: %s", message);
+ if (possibleDataError) {
+ dataerrln("FAIL: assertTrue() failed: %s", message);
+ } else {
+ errln("FAIL: assertTrue() failed: %s", message);
+ }
} else if (!quiet) {
logln("Ok: %s", message);
}
@@ -1505,13 +1536,14 @@
return !condition;
}
-UBool IntlTest::assertSuccess(const char* message, UErrorCode ec) {
+UBool IntlTest::assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError) {
if (U_FAILURE(ec)) {
- if (ec == U_FILE_ACCESS_ERROR) {
- dataerrln("[DATA] Fail: %s.", message);
+ if (possibleDataError) {
+ dataerrln("FAIL: %s (%s)", message, u_errorName(ec));
} else {
- errln("FAIL: %s (%s)", message, u_errorName(ec));
+ errcheckln(ec, "FAIL: %s (%s)", message, u_errorName(ec));
}
+
return FALSE;
}
return TRUE;
@@ -1519,11 +1551,18 @@
UBool IntlTest::assertEquals(const char* message,
const UnicodeString& expected,
- const UnicodeString& actual) {
+ const UnicodeString& actual,
+ UBool possibleDataError) {
if (expected != actual) {
- errln((UnicodeString)"FAIL: " + message + "; got " +
- prettify(actual) +
- "; expected " + prettify(expected));
+ if (possibleDataError) {
+ dataerrln((UnicodeString)"FAIL: " + message + "; got " +
+ prettify(actual) +
+ "; expected " + prettify(expected));
+ } else {
+ errln((UnicodeString)"FAIL: " + message + "; got " +
+ prettify(actual) +
+ "; expected " + prettify(expected));
+ }
return FALSE;
}
#ifdef VERBOSE_ASSERTIONS
Modified: trunk/source/test/intltest/intltest.h
===================================================================
--- trunk/source/test/intltest/intltest.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/intltest.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -107,6 +107,8 @@
virtual void dataerr( const UnicodeString &message );
virtual void dataerrln( const UnicodeString &message );
+
+ void errcheckln(UErrorCode status, const UnicodeString &message );
// convenience functions: sprintf() + errln() etc.
void log(const char *fmt, ...);
@@ -117,6 +119,7 @@
void errln(const char *fmt, ...);
void dataerr(const char *fmt, ...);
void dataerrln(const char *fmt, ...);
+ void errcheckln(UErrorCode status, const char *fmt, ...);
// Print ALL named errors encountered so far
void printErrors();
@@ -152,11 +155,11 @@
protected:
/* JUnit-like assertions. Each returns TRUE if it succeeds. */
- UBool assertTrue(const char* message, UBool condition, UBool quiet=FALSE);
+ UBool assertTrue(const char* message, UBool condition, UBool quiet=FALSE, UBool possibleDataError=FALSE);
UBool assertFalse(const char* message, UBool condition, UBool quiet=FALSE);
- UBool assertSuccess(const char* message, UErrorCode ec);
+ UBool assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError=FALSE);
UBool assertEquals(const char* message, const UnicodeString& expected,
- const UnicodeString& actual);
+ const UnicodeString& actual, UBool possibleDataError=FALSE);
UBool assertEquals(const char* message, const char* expected,
const char* actual);
#if !UCONFIG_NO_FORMATTING
Modified: trunk/source/test/intltest/itercoll.cpp
===================================================================
--- trunk/source/test/intltest/itercoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/itercoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -30,7 +30,7 @@
if(U_FAILURE(status)) {
delete en_us;
en_us = 0;
- errln("Collator creation failed with %s", u_errorName(status));
+ errcheckln(status, "Collator creation failed with %s", u_errorName(status));
return;
}
@@ -639,7 +639,7 @@
default: name = ""; break;
}
} else {
- errln("Class iterator not instantiated");
+ dataerrln("Class iterator not instantiated");
name = "";
}
}
Modified: trunk/source/test/intltest/itrbnf.cpp
===================================================================
--- trunk/source/test/intltest/itrbnf.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/itrbnf.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -100,6 +100,11 @@
};
UErrorCode status = U_ZERO_ERROR;
RuleBasedNumberFormat* formatter = new RuleBasedNumberFormat(URBNF_SPELLOUT, "he_IL", status);
+ if (status == U_MISSING_RESOURCE_ERROR || status == U_FILE_ACCESS_ERROR) {
+ errcheckln(status, "Failed in constructing RuleBasedNumberFormat - %s", u_errorName(status));
+ delete formatter;
+ return;
+ }
UnicodeString result;
Formattable parseResult;
ParsePosition pp(0);
@@ -140,6 +145,11 @@
UErrorCode status = U_ZERO_ERROR;
RuleBasedNumberFormat* formatter
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getUS(), status);
+ if (status == U_MISSING_RESOURCE_ERROR || status == U_FILE_ACCESS_ERROR) {
+ dataerrln("Unable to create formatter. - %s", u_errorName(status));
+ delete formatter;
+ return;
+ }
logln("RBNF API test starting");
// test clone
@@ -391,7 +401,7 @@
UParseError perror;
RuleBasedNumberFormat formatter(fracRules, Locale::getEnglish(), perror, status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "0", "0" },
@@ -1058,9 +1068,8 @@
UErrorCode status = U_ZERO_ERROR;
RuleBasedNumberFormat* formatter
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getUS(), status);
-
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "1", "one" },
@@ -1113,7 +1122,7 @@
= new RuleBasedNumberFormat(URBNF_ORDINAL, Locale::getUS(), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "1", "1\\u02e2\\u1d57" },
@@ -1149,7 +1158,7 @@
= new RuleBasedNumberFormat(URBNF_DURATION, Locale::getUS(), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "3,600", "1:00:00" }, //move me and I fail
@@ -1188,7 +1197,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("es", "ES", ""), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "1", "uno" },
@@ -1228,7 +1237,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getFrance(), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "1", "un" },
@@ -1313,7 +1322,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("fr", "CH", ""), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, swissFrenchTestData, TRUE);
}
@@ -1362,8 +1371,8 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("fr", "BE", ""), status);
if (U_FAILURE(status)) {
- errln("rbnf status: 0x%x (%s)\n", status, u_errorName(status));
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "rbnf status: 0x%x (%s)\n", status, u_errorName(status));
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
// Belgian french should match Swiss french.
doTest(formatter, belgianFrenchTestData, TRUE);
@@ -1379,7 +1388,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getItalian(), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "1", "uno" },
@@ -1420,7 +1429,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("pt","BR",""), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "1", "um" },
@@ -1458,7 +1467,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getGermany(), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "1", "eins" },
@@ -1503,7 +1512,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("th"), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testData[][2] = {
{ "0", "\\u0e28\\u0e39\\u0e19\\u0e22\\u0e4c" },
@@ -1529,7 +1538,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("sv"), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* testDataDefault[][2] = {
{ "101", "ett\\u00adhundra\\u00adett" },
@@ -1606,7 +1615,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("en_US"), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
static const char* const testDataDefault[][2] = {
{ "0.001", "zero point zero zero one" },
@@ -1660,7 +1669,7 @@
UParseError perror;
RuleBasedNumberFormat formatter(rules, perror, status);
if (U_FAILURE(status)) {
- errln("FAIL: could not construct formatter");
+ errcheckln(status, "FAIL: could not construct formatter - %s", u_errorName(status));
} else {
{
static const char* const testData[][2] = {
@@ -1907,7 +1916,7 @@
// NumberFormat* decFmt = NumberFormat::createInstance(Locale::getUS(), status);
DecimalFormat decFmt("#,###.################", dfs, status);
if (U_FAILURE(status)) {
- errln("FAIL: could not create NumberFormat");
+ errcheckln(status, "FAIL: could not create NumberFormat - %s", u_errorName(status));
} else {
for (int i = 0; testData[i][0]; ++i) {
const char* numString = testData[i][0];
@@ -1977,7 +1986,7 @@
UErrorCode status = U_ZERO_ERROR;
NumberFormat* decFmt = NumberFormat::createInstance(Locale::getUS(), status);
if (U_FAILURE(status)) {
- errln("FAIL: could not create NumberFormat");
+ errcheckln(status, "FAIL: could not create NumberFormat - %s", u_errorName(status));
} else {
for (int i = 0; testData[i][0]; ++i) {
const char* spelledNumber = testData[i][0]; // spelled-out number
Modified: trunk/source/test/intltest/itrbnfrt.cpp
===================================================================
--- trunk/source/test/intltest/itrbnfrt.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/itrbnfrt.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/*
*******************************************************************************
- * Copyright (C) 1996-2006, International Business Machines Corporation and *
+ * Copyright (C) 1996-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -65,7 +65,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getUS(), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, -12345678, 12345678);
}
@@ -83,7 +83,7 @@
= new RuleBasedNumberFormat(URBNF_DURATION, Locale::getUS(), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, 0, 12345678);
}
@@ -101,7 +101,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("es", "es"), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, -12345678, 12345678);
}
@@ -119,7 +119,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getFrance(), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, -12345678, 12345678);
}
@@ -137,7 +137,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("fr", "CH"), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, -12345678, 12345678);
}
@@ -155,7 +155,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getItalian(), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, -999999, 999999);
}
@@ -173,7 +173,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getGermany(), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, 0, 12345678);
}
@@ -191,7 +191,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("sv", "SE"), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, 0, 12345678);
}
@@ -209,7 +209,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("nl", "NL"), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, -12345678, 12345678);
}
@@ -227,7 +227,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getJapan(), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, 0, 12345678);
}
@@ -245,7 +245,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("ru", "RU"), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, 0, 12345678);
}
@@ -263,7 +263,7 @@
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("pt", "BR"), status);
if (U_FAILURE(status)) {
- errln("failed to construct formatter");
+ errcheckln(status, "failed to construct formatter - %s", u_errorName(status));
} else {
doTest(formatter, -12345678, 12345678);
}
Modified: trunk/source/test/intltest/itspoof.cpp
===================================================================
--- trunk/source/test/intltest/itspoof.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/itspoof.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -16,7 +16,7 @@
#include "unicode/uspoof.h"
#define TEST_ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \
- errln("Failure at file %s, line %d, error = %s\n", __FILE__, __LINE__, u_errorName(status));}}
+ errcheckln(status, "Failure at file %s, line %d, error = %s", __FILE__, __LINE__, u_errorName(status));}}
#define TEST_ASSERT(expr) {if ((expr)==FALSE) { \
errln("Test Failure at file %s, line %d: \"%s\" is false.\n", __FILE__, __LINE__, #expr);};}
Modified: trunk/source/test/intltest/jacoll.cpp
===================================================================
--- trunk/source/test/intltest/jacoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/jacoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -22,7 +22,7 @@
UErrorCode status = U_ZERO_ERROR;
myCollation = Collator::createInstance(Locale::getJapan(), status);
if(!myCollation || U_FAILURE(status)) {
- errln(__FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
+ errcheckln(status, __FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
/* if it wasn't already: */
delete myCollation;
myCollation = NULL;
@@ -191,7 +191,7 @@
default: name = ""; break;
}
} else {
- errln("Collator couldn't be instantiated!");
+ dataerrln("Collator couldn't be instantiated!");
name = "";
}
}
Modified: trunk/source/test/intltest/jamotest.cpp
===================================================================
--- trunk/source/test/intltest/jamotest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/jamotest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************
************************************************************************
@@ -67,7 +67,7 @@
Transliterator* latinJamo = Transliterator::createInstance("Latin-Jamo", UTRANS_FORWARD, parseError, status);
if (latinJamo == 0 || U_FAILURE(status)) {
- errln("FAIL: createInstance() returned 0");
+ dataerrln("FAIL: createInstance() returned 0 - %s", u_errorName(status));
return;
}
@@ -177,7 +177,7 @@
t = Transliterator::createInstance("Latin-Jamo", UTRANS_FORWARD, status);
if (U_FAILURE(status) || t == 0) {
- errln("FAIL: createInstance failed");
+ dataerrln("FAIL: createInstance failed - %s", u_errorName(status));
return;
}
expect(*t, latin, jamo);
@@ -376,7 +376,7 @@
if (latinJamo == 0 || jamoHangul == 0 || U_FAILURE(status)) {
delete latinJamo;
delete jamoHangul;
- errln("FAIL: createInstance returned NULL");
+ dataerrln("FAIL: createInstance returned NULL - %s", u_errorName(status));
return;
}
Transliterator* jamoLatin = latinJamo->createInverse(status);
Modified: trunk/source/test/intltest/lcukocol.cpp
===================================================================
--- trunk/source/test/intltest/lcukocol.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/lcukocol.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -36,7 +36,7 @@
if(U_SUCCESS(status)) {
myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
} else {
- errln("Couldn't instantiate the collator with %s", u_errorName(status));
+ errcheckln(status, "Couldn't instantiate the collator with %s", u_errorName(status));
delete myCollation;
myCollation = 0;
}
@@ -80,7 +80,7 @@
default: name = ""; break;
}
} else {
- errln("Class collator not instantiated");
+ dataerrln("Class collator not instantiated");
name = "";
}
}
Modified: trunk/source/test/intltest/loctest.cpp
===================================================================
--- trunk/source/test/intltest/loctest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/loctest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -481,7 +481,7 @@
Locale().getDisplayLanguage(Locale(), s);
if(s.length()<=3 && s.charAt(0)<=0x7f) {
/* check <=3 to reject getting the language code as a display name */
- errln("unable to get a display string for the language of the default locale\n");
+ dataerrln("unable to get a display string for the language of the default locale.\n");
}
/*
@@ -492,7 +492,7 @@
s.remove();
Locale().getDisplayLanguage(s);
if(s.length()<=3 && s.charAt(0)<=0x7f) {
- errln("unable to get a display string for the language of the default locale [2]\n");
+ dataerrln("unable to get a display string for the language of the default locale [2].\n");
}
}
else {
@@ -673,7 +673,7 @@
const Locale* locList = Locale::getAvailableLocales(locCount);
if (locCount == 0)
- errln("getAvailableLocales() returned an empty list!");
+ dataerrln("getAvailableLocales() returned an empty list!");
else {
logln(UnicodeString("Number of locales returned = ") + locCount);
UnicodeString temp;
@@ -776,15 +776,15 @@
expectedName = dataTable[DNAME_EN][i];
if (testLang != expectedLang)
- errln("Display language (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testLang + " expected " + expectedLang);
+ dataerrln("Display language (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testLang + " expected " + expectedLang);
if (testScript != expectedScript)
- errln("Display script (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testScript + " expected " + expectedScript);
+ dataerrln("Display script (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testScript + " expected " + expectedScript);
if (testCtry != expectedCtry)
- errln("Display country (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testCtry + " expected " + expectedCtry);
+ dataerrln("Display country (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testCtry + " expected " + expectedCtry);
if (testVar != expectedVar)
- errln("Display variant (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testVar + " expected " + expectedVar);
+ dataerrln("Display variant (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testVar + " expected " + expectedVar);
if (testName != expectedName)
- errln("Display name (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testName + " expected " + expectedName);
+ dataerrln("Display name (" + UnicodeString(displayLocale.getName()) + ") of (" + UnicodeString(testLocale.getName()) + ") got " + testName + " expected " + expectedName);
}
}
@@ -860,8 +860,8 @@
;
/* TODO: Change this test to be more like the cloctst version? */
- if (testCount != 490)
- errln("Expected getISOLanguages() to return 490 languages; it returned %d", testCount);
+ if (testCount != 491)
+ errln("Expected getISOLanguages() to return 491 languages; it returned %d", testCount);
else {
for (i = 0; i < 15; i++) {
int32_t j;
@@ -939,7 +939,7 @@
Locale l(languageCodes[i], "", "");
l.getDisplayLanguage(Locale::getUS(), test);
if (test != languageNames[i])
- errln("Got wrong display name for " + UnicodeString(languageCodes[i]) + ": Expected \"" +
+ dataerrln("Got wrong display name for " + UnicodeString(languageCodes[i]) + ": Expected \"" +
languageNames[i] + "\", got \"" + test + "\".");
}
}
@@ -1054,7 +1054,7 @@
logln(name);
if (name != englishDisplayNames[i])
{
- errln("Lookup in English failed: expected \"" + englishDisplayNames[i]
+ dataerrln("Lookup in English failed: expected \"" + englishDisplayNames[i]
+ "\", got \"" + name + "\"");
logln("Locale name was-> " + (name=localesToTest[i].getName()));
}
@@ -1065,7 +1065,7 @@
localesToTest[i].getDisplayName(Locale("es", "ES"), name);
logln(name);
if (name != spanishDisplayNames[i])
- errln("Lookup in Spanish failed: expected \"" + spanishDisplayNames[i]
+ dataerrln("Lookup in Spanish failed: expected \"" + spanishDisplayNames[i]
+ "\", got \"" + name + "\"");
}
@@ -1074,7 +1074,7 @@
localesToTest[i].getDisplayName(Locale::getFrance(), name);
logln(name);
if (name != frenchDisplayNames[i])
- errln("Lookup in French failed: expected \"" + frenchDisplayNames[i]
+ dataerrln("Lookup in French failed: expected \"" + frenchDisplayNames[i]
+ "\", got \"" + name + "\"");
}
@@ -1083,12 +1083,12 @@
localesToTest[i].getDisplayName(Locale("inv", "IN"), name);
logln(name + " Locale fallback to be, and data fallback to root");
if (name != invDisplayNames[i])
- errln("Lookup in INV failed: expected \"" + prettify(invDisplayNames[i])
+ dataerrln("Lookup in INV failed: expected \"" + prettify(invDisplayNames[i])
+ "\", got \"" + prettify(name) + "\"");
localesToTest[i].getDisplayName(Locale("inv", "BD"), name);
logln(name + " Data fallback to root");
if (name != invDisplayNames[i])
- errln("Lookup in INV failed: expected \"" + prettify(invDisplayNames[i])
+ dataerrln("Lookup in INV failed: expected \"" + prettify(invDisplayNames[i])
+ "\", got \"" + prettify(name )+ "\"");
}
Locale::setDefault(saveLocale, status);
@@ -1112,7 +1112,7 @@
if(U_FAILURE(status) || !thaiCurrency)
{
- errln("Couldn't get th_TH currency -> " + UnicodeString(u_errorName(status)));
+ dataerrln("Couldn't get th_TH currency -> " + UnicodeString(u_errorName(status)));
return;
}
if (thaiCurrency->getPositivePrefix(temp) != UnicodeString(&posPrefix, 1, 1))
@@ -1207,27 +1207,27 @@
ucurr_forLocale("en_US", tmp, 4, &status);
resultStr.setTo(tmp);
if (dollarStr != resultStr) {
- errln("Fail: en_US didn't return USD");
+ errcheckln(status, "Fail: en_US didn't return USD - %s", u_errorName(status));
}
ucurr_forLocale("en_US_EURO", tmp, 4, &status);
resultStr.setTo(tmp);
if (euroStr != resultStr) {
- errln("Fail: en_US_EURO didn't return EUR");
+ errcheckln(status, "Fail: en_US_EURO didn't return EUR - %s", u_errorName(status));
}
ucurr_forLocale("en_GB_EURO", tmp, 4, &status);
resultStr.setTo(tmp);
if (euroStr != resultStr) {
- errln("Fail: en_GB_EURO didn't return EUR");
+ errcheckln(status, "Fail: en_GB_EURO didn't return EUR - %s", u_errorName(status));
}
ucurr_forLocale("en_US_PREEURO", tmp, 4, &status);
resultStr.setTo(tmp);
if (dollarStr != resultStr) {
- errln("Fail: en_US_PREEURO didn't fallback to en_US");
+ errcheckln(status, "Fail: en_US_PREEURO didn't fallback to en_US - %s", u_errorName(status));
}
ucurr_forLocale("en_US_Q", tmp, 4, &status);
resultStr.setTo(tmp);
if (dollarStr != resultStr) {
- errln("Fail: en_US_Q didn't fallback to en_US");
+ errcheckln(status, "Fail: en_US_Q didn't fallback to en_US - %s", u_errorName(status));
}
int32_t invalidLen = ucurr_forLocale("en_QQ", tmp, 4, &status);
if (invalidLen || U_SUCCESS(status)) {
@@ -1302,7 +1302,7 @@
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat df_full("EEEE", mylocale, status);
if(U_FAILURE(status)){
- errln(UnicodeString("Could not create SimpleDateFormat object for locale hu. Error: " )+ UnicodeString(u_errorName(status)));
+ errcheckln(status, UnicodeString("Could not create SimpleDateFormat object for locale hu. Error: " )+ UnicodeString(u_errorName(status)));
return;
}
UnicodeString str;
@@ -1347,7 +1347,7 @@
Calendar *cal = Calendar::createInstance(Locale("ru", "", ""), status);
if(U_SUCCESS(status)) {
if (cal->getFirstDayOfWeek(status) != UCAL_MONDAY) {
- errln("Fail: First day of week in Russia should be Monday");
+ dataerrln("Fail: First day of week in Russia should be Monday");
}
}
delete cal;
@@ -1432,10 +1432,10 @@
Locale loc = locales[i];
UnicodeString temp;
if (loc.getDisplayName(temp) != englishDisplayNames[i])
- errln("English display-name mismatch: expected " +
+ dataerrln("English display-name mismatch: expected " +
englishDisplayNames[i] + ", got " + loc.getDisplayName(temp));
if (loc.getDisplayName(loc, temp) != norwegianDisplayNames[i])
- errln("Norwegian display-name mismatch: expected " +
+ dataerrln("Norwegian display-name mismatch: expected " +
norwegianDisplayNames[i] + ", got " +
loc.getDisplayName(loc, temp));
}
@@ -1461,9 +1461,9 @@
en_US_custom.getDisplayName(Locale::getUS(), got);
if(got != dispName) {
- errln("FAIL: getDisplayName()");
- errln("Wanted: " + dispName);
- errln("Got : " + got);
+ dataerrln("FAIL: getDisplayName()");
+ dataerrln("Wanted: " + dispName);
+ dataerrln("Got : " + got);
}
Locale shortVariant("fr", "FR", "foo");
@@ -1519,7 +1519,7 @@
for (int32_t i = 0; i < 4; ++i) {
NumberFormat *fmt = NumberFormat::createPercentInstance(LOC[i], status);
if(U_FAILURE(status)) {
- errln("Couldn't create NumberFormat");
+ dataerrln("Couldn't create NumberFormat - %s", u_errorName(status));
return;
}
UnicodeString result;
@@ -1758,7 +1758,7 @@
logln("%s; req=%s, valid=%s, actual=%s",
label, req, valid, actual);
} else {
- errln("FAIL: %s; req=%s, valid=%s, actual=%s. Require (R %s V) and (V %s A)",
+ dataerrln("FAIL: %s; req=%s, valid=%s, actual=%s. Require (R %s V) and (V %s A)",
label, req, valid, actual,
expReqValid, expValidActual);
}
@@ -1775,7 +1775,7 @@
req = "en_US_BROOKLYN";
Calendar* cal = Calendar::createInstance(Locale::createFromName(req), ec);
if (U_FAILURE(ec)) {
- errln("FAIL: Calendar::createInstance failed");
+ errln("FAIL: Calendar::createInstance failed - %s", u_errorName(ec));
} else {
valid = cal->getLocale(ULOC_VALID_LOCALE, ec);
actual = cal->getLocale(ULOC_ACTUAL_LOCALE, ec);
@@ -1800,7 +1800,7 @@
DecimalFormat* dec = (DecimalFormat*)
NumberFormat::createInstance(Locale::createFromName(req), ec);
if (U_FAILURE(ec)) {
- errln("FAIL: NumberFormat::createInstance failed");
+ dataerrln("FAIL: NumberFormat::createInstance failed - %s", u_errorName(ec));
} else {
if (dec->getDynamicClassID() != DecimalFormat::getStaticClassID()) {
errln("FAIL: NumberFormat::createInstance does not return a DecimalFormat");
@@ -1873,7 +1873,7 @@
reqLoc = Locale::createFromName(req);
BreakIterator* brk = BreakIterator::createWordInstance(reqLoc, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: BreakIterator::createWordInstance failed");
+ dataerrln("FAIL: BreakIterator::createWordInstance failed - %s", u_errorName(ec));
} else {
valid = brk->getLocale(ULOC_VALID_LOCALE, ec);
actual = brk->getLocale(ULOC_ACTUAL_LOCALE, ec);
@@ -1935,7 +1935,7 @@
reqLoc = Locale::createFromName(req);
Collator* coll = Collator::createInstance(reqLoc, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: Collator::createInstance failed");
+ dataerrln("FAIL: Collator::createInstance failed - %s", u_errorName(ec));
} else {
valid = coll->getLocale(ULOC_VALID_LOCALE, ec);
actual = coll->getLocale(ULOC_ACTUAL_LOCALE, ec);
@@ -2150,54 +2150,54 @@
// Cycle through historical currencies
date = (UDate)-630720000000.0; // pre 1961 - no currency defined
- index = ucurr_countCurrencies("eo_AM", date, &status);
+ index = ucurr_countCurrencies("eo_AM", date, &status);
if (index != 0)
{
- errln("FAIL: didn't return 0 for eo_AM");
+ errcheckln(status, "FAIL: didn't return 0 for eo_AM - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AM", date, index, TMP, 4, &status);
if (resLen != 0) {
- errln("FAIL: eo_AM didn't return NULL");
+ errcheckln(status, "FAIL: eo_AM didn't return NULL - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
date = (UDate)0.0; // 1970 - one currency defined
- index = ucurr_countCurrencies("eo_AM", date, &status);
+ index = ucurr_countCurrencies("eo_AM", date, &status);
if (index != 1)
{
- errln("FAIL: didn't return 1 for eo_AM");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AM - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AM", date, index, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("SUR");
if (resultStr != tempStr) {
- errln("FAIL: didn't return SUR for eo_AM");
+ errcheckln(status, "FAIL: didn't return SUR for eo_AM - %s", u_errorName(status));
}
date = (UDate)693792000000.0; // 1992 - one currency defined
index = ucurr_countCurrencies("eo_AM", date, &status);
if (index != 1)
{
- errln("FAIL: didn't return 1 for eo_AM");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AM - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AM", date, index, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("RUR");
if (resultStr != tempStr) {
- errln("FAIL: didn't return RUR for eo_AM");
+ errcheckln(status, "FAIL: didn't return RUR for eo_AM - %s", u_errorName(status));
}
date = (UDate)977616000000.0; // post 1993 - one currency defined
index = ucurr_countCurrencies("eo_AM", date, &status);
if (index != 1)
{
- errln("FAIL: didn't return 1 for eo_AM");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AM - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AM", date, index, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("AMD");
if (resultStr != tempStr) {
- errln("FAIL: didn't return AMD for eo_AM");
+ errcheckln(status, "FAIL: didn't return AMD for eo_AM - %s", u_errorName(status));
}
// Locale AD has multiple currencies at once
@@ -2205,88 +2205,88 @@
index = ucurr_countCurrencies("eo_AD", date, &status);
if (index != 4)
{
- errln("FAIL: didn't return 4 for eo_AD");
+ errcheckln(status, "FAIL: didn't return 4 for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("EUR");
if (resultStr != tempStr) {
- errln("FAIL: didn't return EUR for eo_AD");
+ errcheckln(status, "FAIL: didn't return EUR for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 2, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("ESP");
if (resultStr != tempStr) {
- errln("FAIL: didn't return ESP for eo_AD");
+ errcheckln(status, "FAIL: didn't return ESP for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 3, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("FRF");
if (resultStr != tempStr) {
- errln("FAIL: didn't return FRF for eo_AD");
+ errcheckln(status, "FAIL: didn't return FRF for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 4, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("ADP");
if (resultStr != tempStr) {
- errln("FAIL: didn't return ADP for eo_AD");
+ errcheckln(status, "FAIL: didn't return ADP for eo_AD - %s", u_errorName(status));
}
date = (UDate)0.0; // year 1970
index = ucurr_countCurrencies("eo_AD", date, &status);
if (index != 3)
{
- errln("FAIL: didn't return 3 for eo_AD");
+ errcheckln(status, "FAIL: didn't return 3 for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("ESP");
if (resultStr != tempStr) {
- errln("FAIL: didn't return ESP for eo_AD");
+ errcheckln(status, "FAIL: didn't return ESP for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 2, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("FRF");
if (resultStr != tempStr) {
- errln("FAIL: didn't return FRF for eo_AD");
+ errcheckln(status, "FAIL: didn't return FRF for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 3, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("ADP");
if (resultStr != tempStr) {
- errln("FAIL: didn't return ADP for eo_AD");
+ errcheckln(status, "FAIL: didn't return ADP for eo_AD - %s", u_errorName(status));
}
date = (UDate)-630720000000.0; // year 1950
index = ucurr_countCurrencies("eo_AD", date, &status);
if (index != 2)
{
- errln("FAIL: didn't return 2 for eo_AD");
+ errcheckln(status, "FAIL: didn't return 2 for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("ESP");
if (resultStr != tempStr) {
- errln("FAIL: didn't return ESP for eo_AD");
+ errcheckln(status, "FAIL: didn't return ESP for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 2, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("ADP");
if (resultStr != tempStr) {
- errln("FAIL: didn't return ADP for eo_AD");
+ errcheckln(status, "FAIL: didn't return ADP for eo_AD - %s", u_errorName(status));
}
date = (UDate)-2207520000000.0; // year 1900
index = ucurr_countCurrencies("eo_AD", date, &status);
if (index != 1)
{
- errln("FAIL: didn't return 1 for eo_AD");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AD - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AD", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("ESP");
if (resultStr != tempStr) {
- errln("FAIL: didn't return ESP for eo_AD");
+ errcheckln(status, "FAIL: didn't return ESP for eo_AD - %s", u_errorName(status));
}
// Locale UA has gap between years 1994 - 1996
@@ -2294,24 +2294,24 @@
index = ucurr_countCurrencies("eo_UA", date, &status);
if (index != 0)
{
- errln("FAIL: didn't return 0 for eo_UA");
+ errcheckln(status, "FAIL: didn't return 0 for eo_UA - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_UA", date, index, TMP, 4, &status);
if (resLen != 0) {
- errln("FAIL: eo_UA didn't return NULL");
+ errcheckln(status, "FAIL: eo_UA didn't return NULL - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
// Test index bounds
resLen = ucurr_forLocaleAndDate("eo_UA", date, 100, TMP, 4, &status);
if (resLen != 0) {
- errln("FAIL: eo_UA didn't return NULL");
+ errcheckln(status, "FAIL: eo_UA didn't return NULL - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
resLen = ucurr_forLocaleAndDate("eo_UA", date, 0, TMP, 4, &status);
if (resLen != 0) {
- errln("FAIL: eo_UA didn't return NULL");
+ errcheckln(status, "FAIL: eo_UA didn't return NULL - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -2319,17 +2319,17 @@
index = ucurr_countCurrencies("eo_QQ", date, &status);
if (index != 0)
{
- errln("FAIL: didn't return 0 for eo_QQ");
+ errcheckln(status, "FAIL: didn't return 0 for eo_QQ - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
resLen = ucurr_forLocaleAndDate("eo_QQ", date, 1, TMP, 4, &status);
if (resLen != 0) {
- errln("FAIL: eo_QQ didn't return NULL");
+ errcheckln(status, "FAIL: eo_QQ didn't return NULL - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
resLen = ucurr_forLocaleAndDate("eo_QQ", date, 0, TMP, 4, &status);
if (resLen != 0) {
- errln("FAIL: eo_QQ didn't return NULL");
+ errcheckln(status, "FAIL: eo_QQ didn't return NULL - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -2338,75 +2338,75 @@
index = ucurr_countCurrencies("eo_AO", date, &status);
if (index != 1)
{
- errln("FAIL: didn't return 1 for eo_AO");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AO - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AO", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("AOA");
if (resultStr != tempStr) {
- errln("FAIL: didn't return AOA for eo_AO");
+ errcheckln(status, "FAIL: didn't return AOA for eo_AO - %s", u_errorName(status));
}
date = (UDate)819936000000.0; // 1996 - 2 currencies
index = ucurr_countCurrencies("eo_AO", date, &status);
if (index != 2)
{
- errln("FAIL: didn't return 1 for eo_AO");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AO - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AO", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("AOR");
if (resultStr != tempStr) {
- errln("FAIL: didn't return AOR for eo_AO");
+ errcheckln(status, "FAIL: didn't return AOR for eo_AO - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AO", date, 2, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("AON");
if (resultStr != tempStr) {
- errln("FAIL: didn't return AON for eo_AO");
+ errcheckln(status, "FAIL: didn't return AON for eo_AO - %s", u_errorName(status));
}
date = (UDate)662256000000.0; // 1991 - 2 currencies
index = ucurr_countCurrencies("eo_AO", date, &status);
if (index != 2)
{
- errln("FAIL: didn't return 1 for eo_AO");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AO - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AO", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("AON");
if (resultStr != tempStr) {
- errln("FAIL: didn't return AON for eo_AO");
+ errcheckln(status, "FAIL: didn't return AON for eo_AO - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AO", date, 2, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("AOK");
if (resultStr != tempStr) {
- errln("FAIL: didn't return AOK for eo_AO");
+ errcheckln(status, "FAIL: didn't return AOK for eo_AO - %s", u_errorName(status));
}
date = (UDate)315360000000.0; // 1980 - one currency
index = ucurr_countCurrencies("eo_AO", date, &status);
if (index != 1)
{
- errln("FAIL: didn't return 1 for eo_AO");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AO - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AO", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("AOK");
if (resultStr != tempStr) {
- errln("FAIL: didn't return AOK for eo_AO");
+ errcheckln(status, "FAIL: didn't return AOK for eo_AO - %s", u_errorName(status));
}
date = (UDate)0.0; // 1970 - no currencies
index = ucurr_countCurrencies("eo_AO", date, &status);
if (index != 0)
{
- errln("FAIL: didn't return 1 for eo_AO");
+ errcheckln(status, "FAIL: didn't return 1 for eo_AO - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_AO", date, 1, TMP, 4, &status);
if (resLen != 0) {
- errln("FAIL: eo_AO didn't return NULL");
+ errcheckln(status, "FAIL: eo_AO didn't return NULL - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -2415,19 +2415,19 @@
index = ucurr_countCurrencies("eo_DE at currency=DEM", date, &status);
if (index != 2)
{
- errln("FAIL: didn't return 2 for eo_DE at currency=DEM");
+ errcheckln(status, "FAIL: didn't return 2 for eo_DE at currency=DEM - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_DE at currency=DEM", date, 1, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("EUR");
if (resultStr != tempStr) {
- errln("FAIL: didn't return EUR for eo_DE at currency=DEM");
+ errcheckln(status, "FAIL: didn't return EUR for eo_DE at currency=DEM - %s", u_errorName(status));
}
resLen = ucurr_forLocaleAndDate("eo_DE at currency=DEM", date, 2, TMP, 4, &status);
tempStr.setTo(TMP);
resultStr.setTo("DEM");
if (resultStr != tempStr) {
- errln("FAIL: didn't return DEM for eo_DE at currency=DEM");
+ errcheckln(status, "FAIL: didn't return DEM for eo_DE at currency=DEM - %s", u_errorName(status));
}
// Test Euro Support
@@ -2442,15 +2442,15 @@
ucurr_forLocaleAndDate("en_US", date, 1, TMP, 4, &status);
if (u_strcmp(USD, TMP) != 0) {
- errln("Fail: en_US didn't return USD");
+ errcheckln(status, "Fail: en_US didn't return USD - %s", u_errorName(status));
}
ucurr_forLocaleAndDate("en_US_PREEURO", date, 1, TMP, 4, &status);
if (u_strcmp(USD, TMP) != 0) {
- errln("Fail: en_US_PREEURO didn't fallback to en_US");
+ errcheckln(status, "Fail: en_US_PREEURO didn't fallback to en_US - %s", u_errorName(status));
}
ucurr_forLocaleAndDate("en_US_Q", date, 1, TMP, 4, &status);
if (u_strcmp(USD, TMP) != 0) {
- errln("Fail: en_US_Q didn't fallback to en_US");
+ errcheckln(status, "Fail: en_US_Q didn't fallback to en_US - %s", u_errorName(status));
}
status = U_ZERO_ERROR; // reset
#endif
Modified: trunk/source/test/intltest/miscdtfm.cpp
===================================================================
--- trunk/source/test/intltest/miscdtfm.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/miscdtfm.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/***********************************************************************
- * Copyright (c) 1997-2007, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -43,7 +43,7 @@
DateFormatMiscTests::failure(UErrorCode status, const char* msg)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ errcheckln(status, UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
return TRUE;
}
@@ -321,7 +321,7 @@
UErrorCode status = U_ZERO_ERROR;
DateFormatSymbols *symbols = new DateFormatSymbols(Locale::getJapan(), status);
if(U_FAILURE(status)) {
- errln("Failure creating DateFormatSymbols, %s", u_errorName(status));
+ errcheckln(status, "Failure creating DateFormatSymbols, %s", u_errorName(status));
delete symbols;
return;
}
Modified: trunk/source/test/intltest/mnkytst.cpp
===================================================================
--- trunk/source/test/intltest/mnkytst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/mnkytst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -261,7 +261,7 @@
default: name = ""; break;
}
} else {
- errln("Class collator not instantiated");
+ dataerrln("Class collator not instantiated");
name = "";
}
}
Modified: trunk/source/test/intltest/msfmrgts.cpp
===================================================================
--- trunk/source/test/intltest/msfmrgts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/msfmrgts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/***********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -57,10 +57,14 @@
}
UBool
-MessageFormatRegressionTest::failure(UErrorCode status, const char* msg)
+MessageFormatRegressionTest::failure(UErrorCode status, const char* msg, UBool possibleDataError)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ if (possibleDataError) {
+ dataerrln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ } else {
+ errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ }
return TRUE;
}
@@ -174,6 +178,8 @@
MessageFormat *messageFormatter = new MessageFormat("", status);
failure(status, "new MessageFormat");
+
+ const UBool possibleDataError = TRUE;
//try {
logln("Apply with pattern : " + pattern1);
@@ -187,7 +193,7 @@
FieldPosition pos(FieldPosition::DONT_CARE);
tempBuffer = messageFormatter->format(params, 1, tempBuffer, pos, status);
if(tempBuffer != "Impossible {1} has occurred -- status code is 7 and message is {2}." || failure(status, "MessageFormat::format"))
- errln("Tests arguments < substitution failed");
+ dataerrln("Tests arguments < substitution failed");
logln("Formatted with 7 : " + tempBuffer);
ParsePosition pp(0);
int32_t count = 0;
@@ -248,11 +254,11 @@
logln("Formatted with null : " + tempBuffer);*/
logln("Apply with pattern : " + pattern2);
messageFormatter->applyPattern(pattern2, status);
- failure(status, "messageFormatter->applyPattern");
+ failure(status, "messageFormatter->applyPattern", possibleDataError);
tempBuffer.remove();
tempBuffer = messageFormatter->format(params, 1, tempBuffer, pos, status);
if (tempBuffer != "Double ' Quotes 7 test and quoted {1} test plus other {2} stuff.")
- errln("quote format test (w/ params) failed.");
+ dataerrln("quote format test (w/ params) failed. - %s", u_errorName(status));
logln("Formatted with params : " + tempBuffer);
/*tempBuffer = messageFormatter->format(null);
@@ -475,7 +481,7 @@
for (int i = 0; i < 3; i++) {
UnicodeString pattern = patterns[i];
mf->applyPattern(pattern, status);
- failure(status, "mf->applyPattern");
+ failure(status, "mf->applyPattern", TRUE);
//try {
int32_t count = 0;
@@ -725,6 +731,7 @@
void MessageFormatRegressionTest::Test4118594()
{
UErrorCode status = U_ZERO_ERROR;
+ const UBool possibleDataError = TRUE;
MessageFormat *mf = new MessageFormat("{0}, {0}, {0}", status);
failure(status, "new MessageFormat");
UnicodeString forParsing("x, y, z");
@@ -739,19 +746,19 @@
if (objs[0].getString(str) != "z")
errln("argument0: \"" + objs[0].getString(str) + "\"");
mf->applyPattern("{0,number,#.##}, {0,number,#.#}", status);
- failure(status, "mf->applyPattern");
+ failure(status, "mf->applyPattern", possibleDataError);
//Object[] oldobjs = {new Double(3.1415)};
Formattable oldobjs [] = {Formattable(3.1415)};
UnicodeString result;
FieldPosition pos(FieldPosition::DONT_CARE);
result = mf->format( oldobjs, 1, result, pos, status );
- failure(status, "mf->format");
+ failure(status, "mf->format", possibleDataError);
pat.remove();
logln("pattern: \"" + mf->toPattern(pat) + "\"");
logln("text for parsing: \"" + result + "\"");
// result now equals "3.14, 3.1"
if (result != "3.14, 3.1")
- errln("result = " + result);
+ dataerrln("result = " + result + " - " + u_errorName(status));
//Object[] newobjs = mf.parse(result, new ParsePosition(0));
int32_t count1 = 0;
pp.setIndex(0);
@@ -776,6 +783,7 @@
UnicodeString patternText1("The disk \"{1}\" contains {0}.");
UnicodeString patternText2("There are {0} on the disk \"{1}\"");
UErrorCode status = U_ZERO_ERROR;
+ const UBool possibleDataError = TRUE;
MessageFormat *form1 = new MessageFormat(patternText1, status);
failure(status, "new MessageFormat");
MessageFormat *form2 = new MessageFormat(patternText2, status);
@@ -799,10 +807,10 @@
UnicodeString result;
logln(form1->format(testArgs, 2, result, bogus, status));
- failure(status, "form1->format");
+ failure(status, "form1->format", possibleDataError);
result.remove();
logln(form2->format(testArgs, 2, result, bogus, status));
- failure(status, "form1->format");
+ failure(status, "form1->format", possibleDataError);
delete form1;
delete form2;
@@ -875,17 +883,18 @@
};
FieldPosition pos(FieldPosition::DONT_CARE);
out = mf->format(objs, 1, out, pos, status);
- failure(status, "mf->format");
- if (SUFFIX[i] == "") {
- if (out != PREFIX[i])
- errln((UnicodeString)"" + i + ": Got \"" + out + "\"; Want \"" + PREFIX[i] + "\"");
+ if (!failure(status, "mf->format", TRUE)) {
+ if (SUFFIX[i] == "") {
+ if (out != PREFIX[i])
+ errln((UnicodeString)"" + i + ": Got \"" + out + "\"; Want \"" + PREFIX[i] + "\"");
+ }
+ else {
+ if (!out.startsWith(PREFIX[i]) ||
+ !out.endsWith(SUFFIX[i]))
+ errln((UnicodeString)"" + i + ": Got \"" + out + "\"; Want \"" + PREFIX[i] + "\"...\"" +
+ SUFFIX[i] + "\"");
+ }
}
- else {
- if (!out.startsWith(PREFIX[i]) ||
- !out.endsWith(SUFFIX[i]))
- errln((UnicodeString)"" + i + ": Got \"" + out + "\"; Want \"" + PREFIX[i] + "\"...\"" +
- SUFFIX[i] + "\"");
- }
}
delete mf;
Modified: trunk/source/test/intltest/msfmrgts.h
===================================================================
--- trunk/source/test/intltest/msfmrgts.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/msfmrgts.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -45,7 +45,7 @@
void Test4112104(void);
protected:
- UBool failure(UErrorCode status, const char* msg);
+ UBool failure(UErrorCode status, const char* msg, UBool possibleDataError=FALSE);
};
Modified: trunk/source/test/intltest/nmfmapts.cpp
===================================================================
--- trunk/source/test/intltest/nmfmapts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/nmfmapts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/***********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2005, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -68,35 +68,35 @@
NumberFormat *def = NumberFormat::createInstance(status);
if(U_FAILURE(status)) {
- errln("ERROR: Could not create NumberFormat (default)");
+ dataerrln("ERROR: Could not create NumberFormat (default) - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
NumberFormat *fr = NumberFormat::createInstance(Locale::getFrench(), status);
if(U_FAILURE(status)) {
- errln("ERROR: Could not create NumberFormat (French)");
+ dataerrln("ERROR: Could not create NumberFormat (French) - %s", u_errorName(status));
}
NumberFormat *cur = NumberFormat::createCurrencyInstance(status);
if(U_FAILURE(status)) {
- errln("ERROR: Could not create NumberFormat (currency, default)");
+ dataerrln("ERROR: Could not create NumberFormat (currency, default) - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
NumberFormat *cur_fr = NumberFormat::createCurrencyInstance(Locale::getFrench(), status);
if(U_FAILURE(status)) {
- errln("ERROR: Could not create NumberFormat (currency, French)");
+ dataerrln("ERROR: Could not create NumberFormat (currency, French) - %s", u_errorName(status));
}
NumberFormat *per = NumberFormat::createPercentInstance(status);
if(U_FAILURE(status)) {
- errln("ERROR: Could not create NumberFormat (percent, default)");
+ dataerrln("ERROR: Could not create NumberFormat (percent, default) - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
NumberFormat *per_fr = NumberFormat::createPercentInstance(Locale::getFrench(), status);
if(U_FAILURE(status)) {
- errln("ERROR: Could not create NumberFormat (percent, French)");
+ dataerrln("ERROR: Could not create NumberFormat (percent, French) - %s", u_errorName(status));
}
// ======= Test equality
@@ -232,7 +232,7 @@
status = U_ZERO_ERROR;
NumberFormat *test = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("ERROR: Couldn't create a NumberFormat");
+ errcheckln(status, "ERROR: Couldn't create a NumberFormat - %s", u_errorName(status));
}
if(test->getDynamicClassID() != DecimalFormat::getStaticClassID()) {
Modified: trunk/source/test/intltest/nmfmtrt.cpp
===================================================================
--- trunk/source/test/intltest/nmfmtrt.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/nmfmtrt.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/***********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2007, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -43,10 +43,14 @@
}
UBool
-NumberFormatRoundTripTest::failure(UErrorCode status, const char* msg)
+NumberFormatRoundTripTest::failure(UErrorCode status, const char* msg, UBool possibleDataError)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ if (possibleDataError) {
+ dataerrln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ } else {
+ errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ }
return TRUE;
}
@@ -90,19 +94,19 @@
logln("Default Locale");
fmt = NumberFormat::createInstance(status);
- if (!failure(status, "NumberFormat::createInstance")){
+ if (!failure(status, "NumberFormat::createInstance", TRUE)){
test(fmt);
}
delete fmt;
fmt = NumberFormat::createCurrencyInstance(status);
- if (!failure(status, "NumberFormat::createCurrencyInstance")){
+ if (!failure(status, "NumberFormat::createCurrencyInstance", TRUE)){
test(fmt);
}
delete fmt;
fmt = NumberFormat::createPercentInstance(status);
- if (!failure(status, "NumberFormat::createPercentInstance")){
+ if (!failure(status, "NumberFormat::createPercentInstance", TRUE)){
test(fmt);
}
delete fmt;
Modified: trunk/source/test/intltest/nmfmtrt.h
===================================================================
--- trunk/source/test/intltest/nmfmtrt.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/nmfmtrt.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -67,7 +67,7 @@
}
protected:
- UBool failure(UErrorCode status, const char* msg);
+ UBool failure(UErrorCode status, const char* msg, UBool possibleDataError=FALSE);
};
Modified: trunk/source/test/intltest/normconf.cpp
===================================================================
--- trunk/source/test/intltest/normconf.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/normconf.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/*
************************************************************************
-* Copyright (c) 1997-2008, International Business Machines
+* Copyright (c) 1997-2009, International Business Machines
* Corporation and others. All Rights Reserved.
************************************************************************
*/
@@ -141,7 +141,7 @@
}
#endif
- dataerrln("[DATA] Failed to open %s", filename);
+ dataerrln("Failed to open %s", filename);
return NULL;
}
Modified: trunk/source/test/intltest/numfmtst.cpp
===================================================================
--- trunk/source/test/intltest/numfmtst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/numfmtst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -50,7 +50,7 @@
#define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
-#define CHECK(status,str) if (U_FAILURE(status)) { errln(UnicodeString("FAIL: ") + str); return; }
+#define CHECK(status,str) if (U_FAILURE(status)) { errcheckln(status, UnicodeString("FAIL: ") + str + " - " + u_errorName(status)); return; }
void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
@@ -122,7 +122,7 @@
UErrorCode status = U_ZERO_ERROR;
NumberFormat *test = NumberFormat::createInstance("root", status);
if(U_FAILURE(status)) {
- errln("unable to create format object");
+ dataerrln("unable to create format object - %s", u_errorName(status));
}
if(test != NULL) {
test->setMinimumIntegerDigits(10);
@@ -197,7 +197,7 @@
{
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols sym(Locale::getUS(), status);
- if (U_FAILURE(status)) { errln("FAIL: Could not construct DecimalFormatSymbols"); return; }
+ if (U_FAILURE(status)) { errcheckln(status, "FAIL: Could not construct DecimalFormatSymbols - %s", u_errorName(status)); return; }
const char* pat[] = { "#.#", "#.", ".#", "#" };
int32_t pat_length = (int32_t)(sizeof(pat) / sizeof(pat[0]));
@@ -255,7 +255,7 @@
{
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols sym(Locale::getUS(), status);
- if (U_FAILURE(status)) { errln("FAIL: Bad status returned by DecimalFormatSymbols ct"); return; }
+ if (U_FAILURE(status)) { errcheckln(status, "FAIL: Bad status returned by DecimalFormatSymbols ct - %s", u_errorName(status)); return; }
const char* pat[] = { "0.####E0", "00.000E00", "##0.######E000", "0.###E0;[0.###E0]" };
int32_t pat_length = (int32_t)(sizeof(pat) / sizeof(pat[0]));
@@ -569,6 +569,11 @@
UErrorCode status = U_ZERO_ERROR;
UnicodeString *pat;
DecimalFormatSymbols *sym = new DecimalFormatSymbols(Locale::getUS(), status);
+ if (U_FAILURE(status)) {
+ errcheckln(status, "Fail to create DecimalFormatSymbols - %s", u_errorName(status));
+ delete sym;
+ return;
+ }
pat = new UnicodeString("a'fo''o'b#");
DecimalFormat *fmt = new DecimalFormat(*pat, *sym, status);
UnicodeString s;
@@ -604,6 +609,11 @@
DecimalFormatSymbols* sym = new DecimalFormatSymbols(Locale::getUS(), status);
UnicodeString pat;
UChar currency = 0x00A4;
+ if (U_FAILURE(status)) {
+ errcheckln(status, "Fail to create DecimalFormatSymbols - %s", u_errorName(status));
+ delete sym;
+ return;
+ }
// "\xA4#,##0.00;-\xA4#,##0.00"
pat.append(currency).append("#,##0.00;-").
append(currency).append("#,##0.00");
@@ -636,7 +646,7 @@
if (s != "USD -1,234.56") errln((UnicodeString)"FAIL: Expected USD -1,234.56");
delete fmt;
delete sym;
- if (U_FAILURE(status)) errln((UnicodeString)"FAIL: Status " + (int32_t)status);
+ if (U_FAILURE(status)) errln((UnicodeString)"FAIL: Status " + u_errorName(status));
}
// -------------------------------------
@@ -673,7 +683,7 @@
{"es_ES_PREEURO", "\\u20A7\\u00A01.150" },
{"eu_ES_PREEURO", "1.150\\u00A0\\u20A7" },
{"gl_ES_PREEURO", "1.150\\u00A0\\u20A7" },
- {"it_IT_PREEURO", "\\u20A4\\u00A01.150" },
+ {"it_IT_PREEURO", "IT\\u20A4\\u00A01.150" },
{"pt_PT_PREEURO", "1,150$50\\u00A0Esc."},
{"en_US at currency=JPY", "\\u00A51,150"}
};
@@ -752,7 +762,7 @@
NumberFormat::createCurrencyInstance(Locale::getUS(), ec);
if (U_FAILURE(ec)) {
- errln("FAIL: getCurrencyInstance(US)");
+ dataerrln("FAIL: getCurrencyInstance(US) - %s", u_errorName(ec));
delete fmt;
return;
}
@@ -816,7 +826,7 @@
if (n.getType() != Formattable::kLong ||
n.getLong() != 0) errln((UnicodeString)"FAIL: Expected 0");
delete format;
- if (U_FAILURE(status)) errln((UnicodeString)"FAIL: Status " + (int32_t)status);
+ if (U_FAILURE(status)) errcheckln(status, (UnicodeString)"FAIL: Status " + u_errorName(status));
//}
//catch(Exception e) {
// errln((UnicodeString)"Exception caught: " + e);
@@ -916,7 +926,7 @@
DecimalFormatSymbols US(Locale::getUS(), ec);
DecimalFormat fmt("a b#0c ", US, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: Constructor");
+ errcheckln(ec, "FAIL: Constructor - %s", u_errorName(ec));
return;
}
int32_t n = 1234;
@@ -1450,7 +1460,7 @@
UChar TMP[4];
static const UChar QQQ[] = {0x51, 0x51, 0x51, 0};
if(U_FAILURE(status)) {
- errln("Unable to get currency for locale, error %s", u_errorName(status));
+ errcheckln(status, "Unable to get currency for locale, error %s", u_errorName(status));
return;
}
@@ -1516,43 +1526,51 @@
static const UChar ITL[] = {0x49, 0x54, 0x4C, 0}; /*ITL*/
UBool isChoiceFormat;
int32_t len;
+ const UBool possibleDataError = TRUE;
// Warning: HARD-CODED LOCALE DATA in this test. If it fails, CHECK
- // THE LOCALE DATA before diving into the code.
+ // THE LOCALE DATA before diving into the code.
assertEquals("USD.getName(SYMBOL_NAME)",
UnicodeString("$"),
UnicodeString(ucurr_getName(USD, "en",
UCURR_SYMBOL_NAME,
- &isChoiceFormat, &len, &ec)));
+ &isChoiceFormat, &len, &ec)),
+ possibleDataError);
assertEquals("USD.getName(LONG_NAME)",
UnicodeString("US Dollar"),
UnicodeString(ucurr_getName(USD, "en",
UCURR_LONG_NAME,
- &isChoiceFormat, &len, &ec)));
+ &isChoiceFormat, &len, &ec)),
+ possibleDataError);
assertEquals("CAD.getName(SYMBOL_NAME)",
UnicodeString("CA$"),
UnicodeString(ucurr_getName(CAD, "en",
UCURR_SYMBOL_NAME,
- &isChoiceFormat, &len, &ec)));
+ &isChoiceFormat, &len, &ec)),
+ possibleDataError);
assertEquals("CAD.getName(SYMBOL_NAME)",
UnicodeString("$"),
UnicodeString(ucurr_getName(CAD, "en_CA",
UCURR_SYMBOL_NAME,
- &isChoiceFormat, &len, &ec)));
+ &isChoiceFormat, &len, &ec)),
+ possibleDataError);
assertEquals("USD.getName(SYMBOL_NAME)",
UnicodeString("US$"),
UnicodeString(ucurr_getName(USD, "en_AU",
UCURR_SYMBOL_NAME,
- &isChoiceFormat, &len, &ec)));
+ &isChoiceFormat, &len, &ec)),
+ possibleDataError);
assertEquals("CAD.getName(SYMBOL_NAME)",
UnicodeString("CA$"),
UnicodeString(ucurr_getName(CAD, "en_AU",
UCURR_SYMBOL_NAME,
- &isChoiceFormat, &len, &ec)));
+ &isChoiceFormat, &len, &ec)),
+ possibleDataError);
assertEquals("USX.getName(LONG_NAME)",
UnicodeString("USX"),
UnicodeString(ucurr_getName(USX, "en_US",
UCURR_LONG_NAME,
- &isChoiceFormat, &len, &ec)));
+ &isChoiceFormat, &len, &ec)),
+ possibleDataError);
assertSuccess("ucurr_getName", ec);
ec = U_ZERO_ERROR;
@@ -1561,12 +1579,12 @@
ucurr_getName(CAD, "es_ES", UCURR_LONG_NAME, &isChoiceFormat,
&len, &ec);
assertTrue("ucurr_getName (fallback)",
- U_USING_FALLBACK_WARNING == ec, TRUE);
+ U_USING_FALLBACK_WARNING == ec, TRUE, possibleDataError);
ucurr_getName(CAD, "zh_TW", UCURR_LONG_NAME, &isChoiceFormat,
&len, &ec);
assertTrue("ucurr_getName (fallback)",
- U_USING_FALLBACK_WARNING == ec, TRUE);
+ U_USING_FALLBACK_WARNING == ec, TRUE, possibleDataError);
ucurr_getName(CAD, "en_US", UCURR_LONG_NAME, &isChoiceFormat,
&len, &ec);
@@ -1675,7 +1693,7 @@
UErrorCode ec = U_ZERO_ERROR;
DecimalFormatSymbols *sym = new DecimalFormatSymbols(Locale::getUS(), ec);
if (U_FAILURE(ec)) {
- errln("Fail: DecimalFormatSymbols constructor");
+ errcheckln(ec, "Fail: DecimalFormatSymbols constructor - %s", u_errorName(ec));
delete sym;
return;
}
@@ -1782,7 +1800,7 @@
logln("Ok: pattern \"%s\": %s",
pat, u_errorName(ec));
} else {
- errln("FAIL: pattern \"%s\" should have %s; got %s",
+ errcheckln(ec, "FAIL: pattern \"%s\" should have %s; got %s",
pat, (valid?"succeeded":"failed"),
u_errorName(ec));
}
@@ -1841,7 +1859,7 @@
UErrorCode ec = U_ZERO_ERROR;
TextFile reader("NumberFormatTestCases.txt", "UTF8", ec);
if (U_FAILURE(ec)) {
- dataerrln("[DATA] Couldn't open NumberFormatTestCases.txt");
+ dataerrln("Couldn't open NumberFormatTestCases.txt");
return;
}
TokenIterator tokens(&reader);
@@ -2033,7 +2051,7 @@
if (U_SUCCESS(ec)) {
errln("FAIL: Unexpected EOF");
} else {
- errln("FAIL: " + where + "Unexpected " + u_errorName(ec));
+ errcheckln(ec, "FAIL: " + where + "Unexpected " + u_errorName(ec));
}
done:
@@ -2314,7 +2332,7 @@
UnicodeString s;
NumberFormat* currencyFmt = NumberFormat::createCurrencyInstance(loc, status);
if(U_FAILURE(status)){
- errln("Could not create currency formatter for locale %s", localeID);
+ dataerrln("Could not create currency formatter for locale %s - %s", localeID, u_errorName(status));
return;
}
currencyFmt->format(1150.50, s);
@@ -2340,7 +2358,7 @@
Locale loc("en_US at compat=host");
NumberFormat *full = NumberFormat::createInstance(loc, status);
if (full == NULL || U_FAILURE(status)) {
- errln("FAIL: Can't create number instance for host");
+ dataerrln("FAIL: Can't create number instance for host - %s", u_errorName(status));
return;
}
UnicodeString result1;
@@ -2372,7 +2390,7 @@
UDate now = Calendar::getNow();
NumberFormat *full = NumberFormat::createInstance(loc, status);
if (full == NULL || U_FAILURE(status)) {
- errln("FAIL: Can't create Relative date instance");
+ dataerrln("FAIL: Can't create Relative date instance - %s", u_errorName(status));
return;
}
UnicodeString result1;
@@ -2411,7 +2429,7 @@
MeasureFormat *measureObj = MeasureFormat::createCurrencyFormat(status);
Locale::setDefault( saveDefaultLocale, status );
if (U_FAILURE(status)){
- errln("FAIL: Status %s", u_errorName(status));
+ dataerrln("FAIL: Status %s", u_errorName(status));
return;
}
cloneObj = (MeasureFormat *)measureObj->clone();
@@ -2456,7 +2474,7 @@
DecimalFormat *df = (DecimalFormat*)NumberFormat::createCurrencyInstance(Locale::getEnglish(), status);
if (U_FAILURE(status)) {
- errln("Unable to create decimal formatter.");
+ dataerrln("Unable to create decimal formatter. - %s", u_errorName(status));
return;
}
@@ -2641,21 +2659,23 @@
NumberFormat* fmt1= NumberFormat::createInstance(loc1, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: getInstance(en_US at numbers=thai)");
+ dataerrln("FAIL: getInstance(en_US at numbers=thai) - %s", u_errorName(ec));
}
NumberFormat* fmt2= NumberFormat::createInstance(loc2, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: getInstance(en_US at numbers=hebr)");
+ dataerrln("FAIL: getInstance(en_US at numbers=hebr) - %s", u_errorName(ec));
}
NumberFormat* fmt3= NumberFormat::createInstance(loc3, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: getInstance(en_US at numbers=arabext)");
+ dataerrln("FAIL: getInstance(en_US at numbers=arabext) - %s", u_errorName(ec));
}
+
+ if (U_SUCCESS(ec) && fmt1 != NULL && fmt2 != NULL && fmt3 != NULL) {
+ expect2(*fmt1, 1234.567, CharsToUnicodeString("\\u0E51,\\u0E52\\u0E53\\u0E54.\\u0E55\\u0E56\\u0E57"));
+ expect3(*fmt2, 5678.0, CharsToUnicodeString("\\u05D4\\u05F3\\u05EA\\u05E8\\u05E2\\u05F4\\u05D7"));
+ expect2(*fmt3, 1234.567, CharsToUnicodeString("\\u06F1,\\u06F2\\u06F3\\u06F4.\\u06F5\\u06F6\\u06F7"));
+ }
- expect2(*fmt1, 1234.567, CharsToUnicodeString("\\u0E51,\\u0E52\\u0E53\\u0E54.\\u0E55\\u0E56\\u0E57"));
- expect3(*fmt2, 5678.0, CharsToUnicodeString("\\u05D4\\u05F3\\u05EA\\u05E8\\u05E2\\u05F4\\u05D7"));
- expect2(*fmt3, 1234.567, CharsToUnicodeString("\\u06F1,\\u06F2\\u06F3\\u06F4.\\u06F5\\u06F6\\u06F7"));
-
// Test bogus keyword value
NumberFormat* fmt4= NumberFormat::createInstance(loc4, ec);
if ( ec != U_UNSUPPORTED_ERROR ) {
@@ -2871,7 +2891,7 @@
// test locale without currency information
{"ti_ET", "-1.23", "USD", "-US$1.23", "-USD1.23", "-1.23 USD"},
// test choice format
- {"es_AR", "1", "INR", "\\u20a8\\u00A01,00", "INR\\u00A01,00", "1,00 rupia india"},
+ {"es_AR", "1", "INR", "Rs\\u00A01,00", "INR\\u00A01,00", "1,00 rupia india"},
};
for (uint32_t i=0; i<sizeof(DATA)/sizeof(DATA[0]); ++i) {
@@ -2892,7 +2912,7 @@
NumberFormat* numFmt = NumberFormat::createInstance(locale, k, status);
if (U_FAILURE(status)) {
delete numFmt;
- errln((UnicodeString)"can not create instance, locale:" + localeString + ", style: " + k);
+ dataerrln((UnicodeString)"can not create instance, locale:" + localeString + ", style: " + k + " - " + u_errorName(status));
continue;
}
// TODO: need to be UChar*
@@ -3000,7 +3020,7 @@
NumberFormat* numFmt = NumberFormat::createInstance(locale, k, status);
if (U_FAILURE(status)) {
delete numFmt;
- errln((UnicodeString)"can not create instance, locale:" + localeString + ", style: " + k);
+ dataerrln((UnicodeString)"can not create instance, locale:" + localeString + ", style: " + k + " - " + u_errorName(status));
continue;
}
// TODO: need to be UChar*
@@ -3288,7 +3308,7 @@
"Brunei Dollar1.00",
"Brunei dollar1.00",
"Brunei dollars1.00",
- "Bs.1.00",
+ "Bs1.00",
"Bs.F.1.00",
"Bulgarian Hard Lev1.00",
"Bulgarian Lev1.00",
@@ -4376,7 +4396,7 @@
"Pts1.00",
"\\u20aa1.00",
"\\u20ac1.00",
- "\\u20a81.00",
+ "Rs1.00",
"\\u20a61.00",
"\\u20ae1.00",
"IT\\u20a41.00",
@@ -5699,12 +5719,18 @@
UErrorCode status = U_ZERO_ERROR;
NumberFormat* numFmt = NumberFormat::createInstance(locale, NumberFormat::kCurrencyStyle, status);
Formattable parseResult;
- numFmt->parse(formatted, parseResult, status);
- if (U_FAILURE(status) ||
- (parseResult.getType() == Formattable::kDouble &&
- parseResult.getDouble() != 1.0)) {
- errln("wrong parsing, " + formatted);
- errln("data: " + formatted);
+ if (numFmt != NULL && U_SUCCESS(status)) {
+ numFmt->parse(formatted, parseResult, status);
+ if (U_FAILURE(status) ||
+ (parseResult.getType() == Formattable::kDouble &&
+ parseResult.getDouble() != 1.0)) {
+ errln("wrong parsing, " + formatted);
+ errln("data: " + formatted);
+ }
+ } else {
+ dataerrln("Unable to create NumberFormat. - %s", u_errorName(status));
+ delete numFmt;
+ break;
}
delete numFmt;
}
@@ -5714,12 +5740,18 @@
UErrorCode status = U_ZERO_ERROR;
NumberFormat* numFmt = NumberFormat::createInstance(locale, NumberFormat::kCurrencyStyle, status);
Formattable parseResult;
- numFmt->parse(formatted, parseResult, status);
- if (!U_FAILURE(status) ||
- (parseResult.getType() == Formattable::kDouble &&
- parseResult.getDouble() == 1.0)) {
- errln("parsed but should not be: " + formatted);
- errln("data: " + formatted);
+ if (numFmt != NULL && U_SUCCESS(status)) {
+ numFmt->parse(formatted, parseResult, status);
+ if (!U_FAILURE(status) ||
+ (parseResult.getType() == Formattable::kDouble &&
+ parseResult.getDouble() == 1.0)) {
+ errln("parsed but should not be: " + formatted);
+ errln("data: " + formatted);
+ }
+ } else {
+ dataerrln("Unable to create NumberFormat. - %s", u_errorName(status));
+ delete numFmt;
+ break;
}
delete numFmt;
}
Modified: trunk/source/test/intltest/numrgts.cpp
===================================================================
--- trunk/source/test/intltest/numrgts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/numrgts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/***********************************************************************
- * Copyright (c) 1997-2008, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -174,11 +174,16 @@
}
UBool
-NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg, const Locale& l)
+NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg, const Locale& l, UBool possibleDataError)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ", "") + msg
- + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l.getName(),""));
+ if (possibleDataError) {
+ dataerrln(UnicodeString("FAIL: ", "") + msg
+ + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l.getName(),""));
+ } else {
+ errcheckln(status, UnicodeString("FAIL: ", "") + msg
+ + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l.getName(),""));
+ }
return TRUE;
}
@@ -186,11 +191,16 @@
}
UBool
-NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg, const char *l)
+NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg, const char *l, UBool possibleDataError)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ", "") + msg
- + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l, ""));
+ if (possibleDataError) {
+ dataerrln(UnicodeString("FAIL: ", "") + msg
+ + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l, ""));
+ } else {
+ errcheckln(status, UnicodeString("FAIL: ", "") + msg
+ + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l, ""));
+ }
return TRUE;
}
@@ -198,11 +208,16 @@
}
UBool
-NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg)
+NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg, UBool possibleDataError)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ", "") + msg
- + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), ""));
+ if (possibleDataError) {
+ dataerrln(UnicodeString("FAIL: ", "") + msg
+ + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), ""));
+ } else {
+ errcheckln(status, UnicodeString("FAIL: ", "") + msg
+ + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), ""));
+ }
return TRUE;
}
@@ -265,23 +280,24 @@
{
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
- failure(status, "new DecimalFormat", "");
- double d = 100;
- df->setMinimumFractionDigits(0);
- df->setMaximumFractionDigits(16);
- UnicodeString sBuf1;
- FieldPosition fp1(0);
- logln(UnicodeString("d = ") + d);
- logln("maxFractionDigits = " + df->getMaximumFractionDigits());
-
- logln(" format(d) = '" + df->format(d, sBuf1, fp1) + "'");
- df->setMaximumFractionDigits(17);
- UnicodeString sBuf2;
- FieldPosition fp2(0);
- logln("maxFractionDigits = " + df->getMaximumFractionDigits());
- sBuf2 = df->format(d, sBuf2, fp2);
- if(sBuf2 != "100")
- errln(" format(d) = '" + sBuf2 + "'");
+ if (!failure(status, "new DecimalFormat", "")) {
+ double d = 100;
+ df->setMinimumFractionDigits(0);
+ df->setMaximumFractionDigits(16);
+ UnicodeString sBuf1;
+ FieldPosition fp1(0);
+ logln(UnicodeString("d = ") + d);
+ logln("maxFractionDigits = " + df->getMaximumFractionDigits());
+
+ logln(" format(d) = '" + df->format(d, sBuf1, fp1) + "'");
+ df->setMaximumFractionDigits(17);
+ UnicodeString sBuf2;
+ FieldPosition fp2(0);
+ logln("maxFractionDigits = " + df->getMaximumFractionDigits());
+ sBuf2 = df->format(d, sBuf2, fp2);
+ if(sBuf2 != "100")
+ errln(" format(d) = '" + sBuf2 + "'");
+ }
delete df;
}
@@ -380,7 +396,7 @@
logln(UnicodeString(" VALUE ") + returnfloat);
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nfcommon = NumberFormat::createCurrencyInstance(Locale::getUS(), status);
- if (failure(status, "NumberFormat::createCurrencyInstance", Locale::getUS())){
+ if (failure(status, "NumberFormat::createCurrencyInstance", Locale::getUS(), TRUE)){
delete nfcommon;
return returnfloat;
}
@@ -454,7 +470,7 @@
double x = 0.00159999;
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nf = NumberFormat::createInstance(status);
- if (failure(status, "NumberFormat::createInstance", Locale::getUS())) {
+ if (failure(status, "NumberFormat::createInstance", Locale::getUS(), TRUE)) {
delete nf;
return;
}
@@ -482,7 +498,7 @@
// TODO: There is not a good way to find out that the creation of this number format has
// failed. Major rewiring of format construction proposed.
if(U_FAILURE(status)) {
- errln("Something is wrong with French number format - it should not fallback. Exitting");
+ dataerrln("Something is wrong with French number format - it should not fallback. Exitting - %s", u_errorName(status));
delete nf1;
return;
}
@@ -562,7 +578,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -618,7 +634,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -684,7 +700,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -713,7 +729,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -740,7 +756,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -766,7 +782,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *dfFoo = new DecimalFormat(UnicodeString("000"), status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete dfFoo;
return;
}
@@ -822,7 +838,7 @@
Locale *de = new Locale(loc);
NumberFormat *nf = NumberFormat::createCurrencyInstance(*de, status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ dataerrln("Error creating DecimalFormat: %s", u_errorName(status));
delete nf;
return;
}
@@ -889,7 +905,7 @@
int len = uloc_canonicalize("fr_FR_PREEURO", loc, 256, &status);
formatter = NumberFormat::createInstance(Locale(loc), status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ dataerrln("Error creating DecimalFormat: %s", u_errorName(status));
delete formatter;
return;
}
@@ -962,7 +978,7 @@
UErrorCode status = U_ZERO_ERROR;
formatter = NumberFormat::createInstance(Locale::getCanadaFrench(), status);
- if (failure(status, "NumberFormat::createNumberInstance", Locale::getCanadaFrench())){
+ if (failure(status, "NumberFormat::createNumberInstance", Locale::getCanadaFrench(), TRUE)){
delete formatter;
return;
};
@@ -1030,7 +1046,7 @@
char loc[256]={0};
uloc_canonicalize("de_DE_PREEURO", loc, 256, &status);
formatter = NumberFormat::createInstance(Locale(loc), status);
- if (failure(status, "NumberFormat::createNumberInstance", loc)){
+ if (failure(status, "NumberFormat::createNumberInstance", loc, TRUE)){
delete formatter;
return;
}
@@ -1088,7 +1104,7 @@
String expectedPercent = "-578.998%";
*/
UnicodeString expectedDefault("-5.789,988");
- UnicodeString expectedCurrency("-\\u20A4\\u00A05.790", -1, US_INV);
+ UnicodeString expectedCurrency("-IT\\u20A4\\u00A05.790", -1, US_INV);
UnicodeString expectedPercent("-578.999%");
expectedCurrency = expectedCurrency.unescape();
@@ -1096,7 +1112,7 @@
char loc[256]={0};
uloc_canonicalize("it_IT_PREEURO", loc, 256, &status);
formatter = NumberFormat::createInstance(Locale(loc), status);
- if (failure(status, "NumberFormat::createNumberInstance")){
+ if (failure(status, "NumberFormat::createNumberInstance", TRUE)){
delete formatter;
return;
};
@@ -1147,26 +1163,27 @@
{
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat("#0.#", status);
- failure(status, "new DecimalFormat");
- UnicodeString s("12.4");
- roundingTest(df, 12.35, s);
- roundingTest(df, 12.45, s);
- s = "12.5";
- roundingTest(df, 12.452,s);
- s = "12.6";
- roundingTest(df, 12.55, s);
- roundingTest(df, 12.65, s);
- s = "12.7";
- roundingTest(df, 12.652,s);
- s = "12.8";
- roundingTest(df, 12.75, s);
- roundingTest(df, 12.752,s);
- roundingTest(df, 12.85, s);
- s = "12.9";
- roundingTest(df, 12.852,s);
- s = "13";
- roundingTest(df, 12.95, s);
- roundingTest(df, 12.952,s);
+ if (!failure(status, "new DecimalFormat")) {
+ UnicodeString s("12.4");
+ roundingTest(df, 12.35, s);
+ roundingTest(df, 12.45, s);
+ s = "12.5";
+ roundingTest(df, 12.452,s);
+ s = "12.6";
+ roundingTest(df, 12.55, s);
+ roundingTest(df, 12.65, s);
+ s = "12.7";
+ roundingTest(df, 12.652,s);
+ s = "12.8";
+ roundingTest(df, 12.75, s);
+ roundingTest(df, 12.752,s);
+ roundingTest(df, 12.85, s);
+ s = "12.9";
+ roundingTest(df, 12.852,s);
+ s = "13";
+ roundingTest(df, 12.95, s);
+ roundingTest(df, 12.952,s);
+ }
delete df;
}
@@ -1213,7 +1230,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *fmt = new DecimalFormat("#,#00.00;-#.#", status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete fmt;
return;
}
@@ -1282,7 +1299,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *sdf = new DecimalFormat(UnicodeString("#,##0"), status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete sdf;
return;
}
@@ -1300,7 +1317,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *fmt = new DecimalFormat(UnicodeString("#,#00.00"), status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete fmt;
return;
}
@@ -1384,7 +1401,7 @@
failure(status, "new DecimalFormatSymbols");
DecimalFormat *df = new DecimalFormat("#,##0.###", syms, status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -1423,7 +1440,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status); // Corrected; see 4147706
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -1459,7 +1476,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -1493,7 +1510,7 @@
UErrorCode status = U_ZERO_ERROR;
NumberFormat *format = NumberFormat::createInstance(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ dataerrln("Error creating DecimalFormat: %s", u_errorName(status));
delete format;
return;
}
@@ -1518,7 +1535,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -1552,7 +1569,7 @@
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete df;
return;
}
@@ -1592,7 +1609,7 @@
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nf = NumberFormat::createInstance(status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ dataerrln("Error creating DecimalFormat: %s", u_errorName(status));
delete nf;
return;
}
@@ -1727,7 +1744,7 @@
double rate = 12.34;
DecimalFormat *formatDec = new DecimalFormat ("000.00", status);
if(U_FAILURE(status)) {
- errln("Error creating DecimalFormat: %s", u_errorName(status));
+ errcheckln(status, "Error creating DecimalFormat: %s", u_errorName(status));
delete formatDec;
return;
}
@@ -1760,22 +1777,22 @@
{
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *nf = new DecimalFormat("##,###,###.00", status);
- failure(status, "new DecimalFormat");
-
- UnicodeString f;
- FieldPosition pos(FieldPosition::DONT_CARE);
- f = nf->format(9.02, f, pos);
- if (f == UnicodeString("9.02"))
- logln(f + " ok");
- else
- errln("9.02 -> " + f + "; want 9.02");
+ if (!failure(status, "new DecimalFormat")) {
+ UnicodeString f;
+ FieldPosition pos(FieldPosition::DONT_CARE);
+ f = nf->format(9.02, f, pos);
+ if (f == UnicodeString("9.02"))
+ logln(f + " ok");
+ else
+ errln("9.02 -> " + f + "; want 9.02");
- f.remove();
- f = nf->format((int32_t)0, f, pos);
- if (f == UnicodeString(".00"))
- logln(f + " ok");
- else
- errln("0 -> " + f + "; want .00");
+ f.remove();
+ f = nf->format((int32_t)0, f, pos);
+ if (f == UnicodeString(".00"))
+ logln(f + " ok");
+ else
+ errln("0 -> " + f + "; want .00");
+ }
delete nf;
}
@@ -1819,16 +1836,17 @@
UnicodeString result;
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *df = new DecimalFormat(DATA[i], status);
- failure(status, "new DecimalFormat");
- FieldPosition pos(FieldPosition::DONT_CARE);
- result = df->format(1.2, result, pos);
- if (result != DATA[i+1]) {
- errln("Fail: 1.2 x " + DATA[i] + " = " + result +
- "; want " + DATA[i+1]);
+ if (!failure(status, "new DecimalFormat")) {
+ FieldPosition pos(FieldPosition::DONT_CARE);
+ result = df->format(1.2, result, pos);
+ if (result != DATA[i+1]) {
+ errln("Fail: 1.2 x " + DATA[i] + " = " + result +
+ "; want " + DATA[i+1]);
+ }
+ else {
+ logln("Ok: 1.2 x " + DATA[i] + " = " + result);
+ }
}
- else {
- logln("Ok: 1.2 x " + DATA[i] + " = " + result);
- }
delete df;
}
@@ -1844,16 +1862,17 @@
DecimalFormatSymbols *syms = new DecimalFormatSymbols(Locale::getEnglish(), status);
failure(status, "new DecimalFormatSymbols");
DecimalFormat *f = new DecimalFormat(UnicodeString(""), syms, status);
- failure(status, "new DecimalFormat");
- UnicodeString s;
- FieldPosition pos(FieldPosition::DONT_CARE);
- s = f->format(123.456, s, pos);
- if (s != UnicodeString("123.456"))
- errln("Fail: Format empty pattern x 123.456 => " + s);
- s.remove();
- s = f->format(-123.456, s, pos);
- if (s != UnicodeString("-123.456"))
- errln("Fail: Format empty pattern x -123.456 => " + s);
+ if (!failure(status, "new DecimalFormat")) {
+ UnicodeString s;
+ FieldPosition pos(FieldPosition::DONT_CARE);
+ s = f->format(123.456, s, pos);
+ if (s != UnicodeString("123.456"))
+ errln("Fail: Format empty pattern x 123.456 => " + s);
+ s.remove();
+ s = f->format(-123.456, s, pos);
+ if (s != UnicodeString("-123.456"))
+ errln("Fail: Format empty pattern x -123.456 => " + s);
+ }
delete f;
}
@@ -1884,7 +1903,7 @@
//try {
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nff = NumberFormat::createInstance(status);
- if (failure(status, "NumberFormat::createInstance")){
+ if (failure(status, "NumberFormat::createInstance", TRUE)){
delete nff;
return;
};
@@ -1964,16 +1983,17 @@
UnicodeString pattern("#,###");
logln("Applying pattern \"" + pattern + "\"");
sdf->applyPattern(pattern, status);
- failure(status, "sdf->applyPattern");
- int minIntDig = sdf->getMinimumIntegerDigits();
- if (minIntDig != 0) {
- errln("Test failed");
- errln(" Minimum integer digits : " + minIntDig);
- UnicodeString temp;
- errln(" new pattern: " + sdf->toPattern(temp));
- } else {
- logln("Test passed");
- logln(" Minimum integer digits : " + minIntDig);
+ if (!failure(status, "sdf->applyPattern")) {
+ int minIntDig = sdf->getMinimumIntegerDigits();
+ if (minIntDig != 0) {
+ errln("Test failed");
+ errln(" Minimum integer digits : " + minIntDig);
+ UnicodeString temp;
+ errln(" new pattern: " + sdf->toPattern(temp));
+ } else {
+ logln("Test passed");
+ logln(" Minimum integer digits : " + minIntDig);
+ }
}
delete sdf;
}
@@ -1989,28 +2009,29 @@
DecimalFormat *df = new DecimalFormat("#,##0.0##", status);
failure(status, "new DecimalFormat");
DecimalFormatSymbols *syms = new DecimalFormatSymbols(Locale::getEnglish(), status);
- failure(status, "new DecimalFormatSymbols");
- UnicodeString f1;
- UnicodeString f2, temp;
- FieldPosition pos(FieldPosition::DONT_CARE);
- volatile double d1 = 0.0; // volatile to prevent code optimization
- double d2 = -0.0001;
+ if (!failure(status, "new DecimalFormatSymbols")) {
+ UnicodeString f1;
+ UnicodeString f2, temp;
+ FieldPosition pos(FieldPosition::DONT_CARE);
+ volatile double d1 = 0.0; // volatile to prevent code optimization
+ double d2 = -0.0001;
#if defined(U_HPUX)
- d1 = 0.0 * -1.0; // old HPUX compiler ignores volatile keyword
+ d1 = 0.0 * -1.0; // old HPUX compiler ignores volatile keyword
#else
- d1 *= -1.0; // Some compilers have a problem with defining -0.0
+ d1 *= -1.0; // Some compilers have a problem with defining -0.0
#endif
- df->adoptDecimalFormatSymbols(syms);
- f1 = df->format(d1, f1, pos);
- f2 = df->format(d2, f2, pos);
- if (f1 != UnicodeString("-0.0")) {
- errln(UnicodeString("") + d1 + UnicodeString(" x \"") + df->toPattern(temp) + "\" is formatted as \"" + f1 + '"');
+ df->adoptDecimalFormatSymbols(syms);
+ f1 = df->format(d1, f1, pos);
+ f2 = df->format(d2, f2, pos);
+ if (f1 != UnicodeString("-0.0")) {
+ errln(UnicodeString("") + d1 + UnicodeString(" x \"") + df->toPattern(temp) + "\" is formatted as \"" + f1 + '"');
+ }
+ if (f2 != UnicodeString("-0.0")) {
+ errln(UnicodeString("") + d2 + UnicodeString(" x \"") + df->toPattern(temp) + "\" is formatted as \"" + f2 + '"');
+ }
}
- if (f2 != UnicodeString("-0.0")) {
- errln(UnicodeString("") + d2 + UnicodeString(" x \"") + df->toPattern(temp) + "\" is formatted as \"" + f2 + '"');
- }
-
+
delete df;
}
@@ -2042,7 +2063,7 @@
UErrorCode status = U_ZERO_ERROR;
NumberFormat *f = NumberFormat::createInstance(status);
if(U_FAILURE(status)) {
- errln("Couldn't create number format");
+ dataerrln("Couldn't create number format - %s", u_errorName(status));
return;
}
f->setMaximumFractionDigits(INT32_MAX);
@@ -2086,7 +2107,7 @@
NumberFormat *f = (i == 0) ? NumberFormat::createInstance(status)
: NumberFormat::createPercentInstance(status);
if(U_FAILURE(status)) {
- errln("Couldn't create number format");
+ dataerrln("Couldn't create number format - %s", u_errorName(status));
return;
}
double d = 0.0;
@@ -2122,7 +2143,7 @@
void NumberFormatRegressionTest::Test4167494(void) {
UErrorCode status = U_ZERO_ERROR;
NumberFormat *fmt = NumberFormat::createInstance(Locale::getUS(), status);
- if (failure(status, "NumberFormat::createInstance")){
+ if (failure(status, "NumberFormat::createInstance", TRUE)){
delete fmt;
return;
};
@@ -2158,7 +2179,7 @@
void NumberFormatRegressionTest::Test4170798(void) {
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nf = NumberFormat::createInstance(Locale::getUS(), status);
- if (failure(status, "NumberFormat::createInstance")){
+ if (failure(status, "NumberFormat::createInstance", TRUE)){
delete nf;
return;
};
@@ -2199,12 +2220,13 @@
UnicodeString s;
for (int i=0; i<DATA_length; i+=2) {
DecimalFormat df(DATA[i], status);
- failure(status, "DecimalFormat constructor");
- df.toPattern(s);
- UnicodeString exp(DATA[i+1]);
- if (s != exp) {
- errln(UnicodeString("FAIL: ") + DATA[i] + " -> " +
- s + ", want " + exp);
+ if (!failure(status, "DecimalFormat constructor")) {
+ df.toPattern(s);
+ UnicodeString exp(DATA[i+1]);
+ if (s != exp) {
+ errln(UnicodeString("FAIL: ") + DATA[i] + " -> " +
+ s + ", want " + exp);
+ }
}
}
}
@@ -2231,21 +2253,22 @@
DecimalFormatSymbols sym(Locale::getUS(), status);
failure(status, "Construct DecimalFormatSymbols");
DecimalFormat fmt("#", sym, status);
- failure(status, "Construct DecimalFormat");
- for (int i=0; i<DATA_length; i+=3) {
- double in = DOUBLE[i/3];
- UnicodeString pat(DATA[i+1]);
- UnicodeString exp(DATA[i+2]);
- fmt.applyPattern(pat, status);
- failure(status, "applyPattern");
- UnicodeString out;
- FieldPosition pos;
- fmt.format(in, out, pos);
- if (out == exp) {
- logln(UnicodeString("Ok: ") + in + " x " + pat + " = " + out);
- } else {
- errln(UnicodeString("FAIL: ") + in + " x " + pat + " = " + out +
- ", expected " + exp);
+ if (!failure(status, "Construct DecimalFormat")) {
+ for (int i=0; i<DATA_length; i+=3) {
+ double in = DOUBLE[i/3];
+ UnicodeString pat(DATA[i+1]);
+ UnicodeString exp(DATA[i+2]);
+ fmt.applyPattern(pat, status);
+ failure(status, "applyPattern");
+ UnicodeString out;
+ FieldPosition pos;
+ fmt.format(in, out, pos);
+ if (out == exp) {
+ logln(UnicodeString("Ok: ") + in + " x " + pat + " = " + out);
+ } else {
+ errln(UnicodeString("FAIL: ") + in + " x " + pat + " = " + out +
+ ", expected " + exp);
+ }
}
}
}
@@ -2263,7 +2286,9 @@
failure(status, "DecimalFormatSymbols ct", Locale::getUS());
DecimalFormat fmt(UnicodeString("#"), sym, status);
- failure(status, "DecimalFormat ct", Locale::getUS());
+ if(failure(status, "DecimalFormat ct", Locale::getUS())) {
+ return;
+ }
UnicodeString s;
FieldPosition pos;
@@ -2436,7 +2461,7 @@
void NumberFormatRegressionTest::Test4216742(void) {
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *fmt = (DecimalFormat*) NumberFormat::createInstance(Locale::getUS(), status);
- if (failure(status, "createInstance", Locale::getUS())){
+ if (failure(status, "createInstance", Locale::getUS(), TRUE)){
delete fmt;
return;
};
@@ -2478,7 +2503,7 @@
int D_length = (int)(sizeof(D) / sizeof(D[0]));
UErrorCode status = U_ZERO_ERROR;
NumberFormat *fmt = NumberFormat::createInstance(Locale::getUS(), status);
- if (failure(status, "createInstance", Locale::getUS())){
+ if (failure(status, "createInstance", Locale::getUS(), TRUE)){
delete fmt;
return;
};
@@ -2499,7 +2524,7 @@
void NumberFormatRegressionTest::Test4161100(void) {
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nf = NumberFormat::createInstance(Locale::getUS(), status);
- if (failure(status, "createInstance", Locale::getUS())){
+ if (failure(status, "createInstance", Locale::getUS(), TRUE)){
delete nf;
return;
};
@@ -2526,22 +2551,23 @@
DecimalFormatSymbols sym(Locale::getUS(), status);
failure(status, "DecimalFormatSymbols ct", Locale::getUS());
DecimalFormat fmt(UnicodeString("0."), sym, status);
- failure(status, "DecimalFormat ct", Locale::getUS());
+
+ if (!failure(status, "DecimalFormat ct", Locale::getUS())) {
+ const double NUM[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5 };
+ const char* STR[] = { "-2.", "-2.", "-0.", "0.", "2.", "2.", "4.", "4." };
+ int32_t N = (int32_t)(sizeof(NUM) / sizeof(NUM[0]));
- const double NUM[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5 };
- const char* STR[] = { "-2.", "-2.", "-0.", "0.", "2.", "2.", "4.", "4." };
- int32_t N = (int32_t)(sizeof(NUM) / sizeof(NUM[0]));
-
- for (int32_t i=0; i<N; ++i) {
- UnicodeString str;
- UnicodeString exp(STR[i]);
- FieldPosition pos;
- fmt.format(NUM[i], str, pos);
- if (str == exp) {
- logln(UnicodeString("Ok ") + NUM[i] + " x 0. = " + str);
- } else {
- errln(UnicodeString("FAIL ") + NUM[i] + " x 0. = " + str +
- ", want " + exp);
+ for (int32_t i=0; i<N; ++i) {
+ UnicodeString str;
+ UnicodeString exp(STR[i]);
+ FieldPosition pos;
+ fmt.format(NUM[i], str, pos);
+ if (str == exp) {
+ logln(UnicodeString("Ok ") + NUM[i] + " x 0. = " + str);
+ } else {
+ errln(UnicodeString("FAIL ") + NUM[i] + " x 0. = " + str +
+ ", want " + exp);
+ }
}
}
}
@@ -2556,7 +2582,9 @@
DecimalFormatSymbols sym(Locale::getUS(), status);
failure(status, "DecimalFormatSymbols ct", Locale::getUS());
DecimalFormat fmt(UnicodeString("#.#"), sym, status);
- failure(status, "DecimalFormat ct", Locale::getUS());
+ if (failure(status, "DecimalFormat ct", Locale::getUS())) {
+ return;
+ }
UnicodeString str;
FieldPosition pos;
@@ -2615,7 +2643,7 @@
// create a NumberFormat for this locale
NumberFormat *nf = NumberFormat::createInstance(loc, status);
if (U_FAILURE(status)) {
- errln("FAIL: NumberFormat::createInstance() returned " + (UnicodeString)u_errorName(status));
+ dataerrln("FAIL: NumberFormat::createInstance() returned " + (UnicodeString)u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/numrgts.h
===================================================================
--- trunk/source/test/intltest/numrgts.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/numrgts.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/***********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2004, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -92,9 +92,9 @@
void TestJ691(void);
protected:
- UBool failure(UErrorCode status, const UnicodeString& msg);
- UBool failure(UErrorCode status, const UnicodeString& msg, const char *l);
- UBool failure(UErrorCode status, const UnicodeString& msg, const Locale& l);
+ UBool failure(UErrorCode status, const UnicodeString& msg, UBool possibleDataError=FALSE);
+ UBool failure(UErrorCode status, const UnicodeString& msg, const char *l, UBool possibleDataError=FALSE);
+ UBool failure(UErrorCode status, const UnicodeString& msg, const Locale& l, UBool possibleDataError=FALSE);
};
#endif /* #if !UCONFIG_NO_FORMATTING */
Modified: trunk/source/test/intltest/plurfmts.cpp
===================================================================
--- trunk/source/test/intltest/plurfmts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/plurfmts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2007-2008, International Business Machines Corporation and
+ * Copyright (c) 2007-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -97,7 +97,7 @@
}
}
else {
- errln("ERROR: PluralFormat constructor failed!");
+ dataerrln("ERROR: PluralFormat constructor failed! - [0]%s [1]%s", u_errorName(status[0]), u_errorName(status[1]));
}
plFmt[2]= new PluralFormat(locale, status[1]);
if ( U_SUCCESS(status[1]) ) {
@@ -110,7 +110,7 @@
delete plFmt[1];
}
else {
- errln("ERROR: PluralFormat constructor failed!");
+ dataerrln("ERROR: PluralFormat constructor failed! - %s", u_errorName(status[1]));
}
delete plFmt[0];
delete plFmt[2];
@@ -444,7 +444,7 @@
UErrorCode status = U_ZERO_ERROR;
PluralFormat plFmt(ulocale, testPattern, status);
if (U_FAILURE(status)) {
- errln("Failed to apply pattern to fr locale");
+ dataerrln("Failed to apply pattern to fr locale - %s", u_errorName(status));
}
else {
status = U_ZERO_ERROR;
@@ -531,7 +531,7 @@
status = U_ZERO_ERROR;
PluralFormat plFmt(ulocale, testPattern, status);
if (U_FAILURE(status)) {
- errln("Failed to apply pattern to locale:"+UnicodeString(localeArray[i]));
+ dataerrln("Failed to apply pattern to locale:"+UnicodeString(localeArray[i]) + " - " + u_errorName(status));
continue;
}
for (int32_t n=0; n<PLURAL_TEST_ARRAY_SIZE; ++n) {
Modified: trunk/source/test/intltest/pptest.cpp
===================================================================
--- trunk/source/test/intltest/pptest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/pptest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -33,10 +33,14 @@
}
UBool
-ParsePositionTest::failure(UErrorCode status, const char* msg)
+ParsePositionTest::failure(UErrorCode status, const char* msg, UBool possibleDataError)
{
if(U_FAILURE(status)) {
- errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ if (possibleDataError) {
+ dataerrln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ } else {
+ errln(UnicodeString("FAIL: ") + msg + " failed, error " + u_errorName(status));
+ }
return TRUE;
}
@@ -173,7 +177,7 @@
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nf = NumberFormat::createInstance(status);
- if (failure(status, "NumberFormat::createInstance")){
+ if (failure(status, "NumberFormat::createInstance", TRUE)){
delete nf;
return;
};
Modified: trunk/source/test/intltest/pptest.h
===================================================================
--- trunk/source/test/intltest/pptest.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/pptest.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -28,7 +28,7 @@
void Test4109023(void);
protected:
- UBool failure(UErrorCode status, const char* msg);
+ UBool failure(UErrorCode status, const char* msg, UBool possibleDataError=FALSE);
};
#endif /* #if !UCONFIG_NO_FORMATTING */
Modified: trunk/source/test/intltest/rbbiapts.cpp
===================================================================
--- trunk/source/test/intltest/rbbiapts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/rbbiapts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/********************************************************************
- * Copyright (c) 1999-2008, International Business Machines
+ * Copyright (c) 1999-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************
* Date Name Description
@@ -43,7 +43,7 @@
RuleBasedBreakIterator* bi3 = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createCharacterInstance(Locale::getDefault(), status);
RuleBasedBreakIterator* bi2 = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createWordInstance(Locale::getDefault(), status);
if(U_FAILURE(status)){
- errln((UnicodeString)"FAIL : in construction");
+ errcheckln(status, "Fail : in construction - %s", u_errorName(status));
return;
}
@@ -78,7 +78,7 @@
logln("Testing assignment");
RuleBasedBreakIterator *bix = (RuleBasedBreakIterator *)BreakIterator::createLineInstance(Locale::getDefault(), status);
if(U_FAILURE(status)){
- errln((UnicodeString)"FAIL : in construction");
+ errcheckln(status, "Fail : in construction - %s", u_errorName(status));
return;
}
@@ -150,7 +150,7 @@
BreakIterator* a = BreakIterator::createWordInstance(Locale("hi"), status);
BreakIterator* b = BreakIterator::createWordInstance(Locale("hi_IN"),status);
if (U_FAILURE(status)) {
- errln("Creation of break iterator failed %s", u_errorName(status));
+ errcheckln(status, "Creation of break iterator failed %s", u_errorName(status));
return;
}
if(*a!=*b){
@@ -176,7 +176,7 @@
RuleBasedBreakIterator* bi1=(RuleBasedBreakIterator*)RuleBasedBreakIterator::createCharacterInstance(Locale::getDefault(), status);
RuleBasedBreakIterator* bi2=(RuleBasedBreakIterator*)RuleBasedBreakIterator::createWordInstance(Locale::getDefault(), status);
if(U_FAILURE(status)){
- errln((UnicodeString)"FAIL: in construction");
+ errcheckln(status, "FAIL: in construction - %s", u_errorName(status));
delete bi1;
delete bi2;
return;
@@ -207,7 +207,7 @@
RuleBasedBreakIterator* bi3 = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createCharacterInstance(Locale::getDefault(), status);
RuleBasedBreakIterator* bi2 = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createWordInstance(Locale::getDefault(), status);
if(U_FAILURE(status)){
- errln((UnicodeString)"FAIL : in construction");
+ errcheckln(status, "Fail : in construction - %s", u_errorName(status));
delete bi1;
delete bi2;
delete bi3;
@@ -248,7 +248,7 @@
RuleBasedBreakIterator* charIter1 = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createCharacterInstance(Locale::getDefault(), status);
RuleBasedBreakIterator* wordIter1 = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createWordInstance(Locale::getDefault(), status);
if(U_FAILURE(status)){
- errln((UnicodeString)"FAIL : in construction");
+ errcheckln(status, "Fail : in construction - %s", u_errorName(status));
return;
}
@@ -378,42 +378,42 @@
UErrorCode status=U_ZERO_ERROR;
RuleBasedBreakIterator* bi = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createCharacterInstance(Locale::getDefault(), status);
if (U_FAILURE(status) || bi == NULL) {
- errln("Failure creating character break iterator. Status = %s", u_errorName(status));
+ errcheckln(status, "Failure creating character break iterator. Status = %s", u_errorName(status));
}
delete bi;
status=U_ZERO_ERROR;
bi = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createWordInstance(Locale::getDefault(), status);
if (U_FAILURE(status) || bi == NULL) {
- errln("Failure creating Word break iterator. Status = %s", u_errorName(status));
+ errcheckln(status, "Failure creating Word break iterator. Status = %s", u_errorName(status));
}
delete bi;
status=U_ZERO_ERROR;
bi = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createLineInstance(Locale::getDefault(), status);
if (U_FAILURE(status) || bi == NULL) {
- errln("Failure creating Line break iterator. Status = %s", u_errorName(status));
+ errcheckln(status, "Failure creating Line break iterator. Status = %s", u_errorName(status));
}
delete bi;
status=U_ZERO_ERROR;
bi = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createSentenceInstance(Locale::getDefault(), status);
if (U_FAILURE(status) || bi == NULL) {
- errln("Failure creating Sentence break iterator. Status = %s", u_errorName(status));
+ errcheckln(status, "Failure creating Sentence break iterator. Status = %s", u_errorName(status));
}
delete bi;
status=U_ZERO_ERROR;
bi = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createTitleInstance(Locale::getDefault(), status);
if (U_FAILURE(status) || bi == NULL) {
- errln("Failure creating Title break iterator. Status = %s", u_errorName(status));
+ errcheckln(status, "Failure creating Title break iterator. Status = %s", u_errorName(status));
}
delete bi;
status=U_ZERO_ERROR;
bi = (RuleBasedBreakIterator*)RuleBasedBreakIterator::createCharacterInstance(Locale::getDefault(), status);
if (U_FAILURE(status) || bi == NULL) {
- errln("Failure creating character break iterator. Status = %s", u_errorName(status));
+ errcheckln(status, "Failure creating character break iterator. Status = %s", u_errorName(status));
return; // Skip the rest of these tests.
}
@@ -602,7 +602,7 @@
RuleBasedBreakIterator *bi = new RuleBasedBreakIterator(rulesString1, parseError, status);
if(U_FAILURE(status)) {
- errln("FAIL : in construction");
+ dataerrln("Fail : in construction - %s", u_errorName(status));
} else {
bi->setText(testString1);
doBoundaryTest(*bi, testString1, bounds1);
@@ -629,7 +629,7 @@
RuleBasedBreakIterator *bi = new RuleBasedBreakIterator(rulesString1, parseError, status);
if(U_FAILURE(status)) {
- errln("FAIL : in construction");
+ dataerrln("Fail : in construction - %s", u_errorName(status));
} else {
bi->setText(testString1);
doBoundaryTest(*bi, testString1, bounds1);
@@ -663,7 +663,7 @@
RuleBasedBreakIterator *bi = (RuleBasedBreakIterator *)BreakIterator::createWordInstance(Locale::getEnglish(), status);
if(U_FAILURE(status)) {
- errln("FAIL : in construction");
+ errcheckln(status, "Fail : in construction - %s", u_errorName(status));
} else {
bi->setText(testString1);
// First test that the breaks are in the right spots.
@@ -701,7 +701,7 @@
bi = (RuleBasedBreakIterator *)
BreakIterator::createLineInstance(Locale::getEnglish(), status);
if(U_FAILURE(status)) {
- errln("failed to create word break iterator.");
+ errcheckln(status, "failed to create word break iterator. - %s", u_errorName(status));
} else {
int32_t i = 0;
int32_t pos, tag;
@@ -760,8 +760,9 @@
UParseError parseError;
RuleBasedBreakIterator *bi = new RuleBasedBreakIterator(rulesString, parseError, status);
- TEST_ASSERT_SUCCESS(status);
- if (U_SUCCESS(status)) {
+ if (U_FAILURE(status)) {
+ dataerrln("Failure at file %s, line %d, error = %s", __FILE__, __LINE__, u_errorName(status));
+ } else {
bi->setText(testString1);
// A
@@ -864,7 +865,7 @@
RuleBasedBreakIterator *bi = new RuleBasedBreakIterator(rulesString1, parseError, status);
if(U_FAILURE(status)) {
- errln("FAIL : in construction");
+ dataerrln("Fail : in construction - %s", u_errorName(status));
} else {
bi->setText(testString1);
doBoundaryTest(*bi, testString1, bounds1);
@@ -882,6 +883,16 @@
BreakIterator* ja_char = BreakIterator::createCharacterInstance("ja_JP", status);
BreakIterator* root_word = BreakIterator::createWordInstance("", status);
BreakIterator* root_char = BreakIterator::createCharacterInstance("", status);
+
+ if (status == U_MISSING_RESOURCE_ERROR || status == U_FILE_ACCESS_ERROR) {
+ dataerrln("Error creating instances of break interactors - %s", u_errorName(status));
+ delete ja_word;
+ delete ja_char;
+ delete root_word;
+ delete root_char;
+
+ return;
+ }
URegistryKey key = BreakIterator::registerInstance(ja_word, "xx", UBRK_WORD, status);
{
@@ -1014,7 +1025,7 @@
const uint8_t *builtRules;
if (U_FAILURE(status)) {
- errln("Can't open \"%s\"", dataFile);
+ errcheckln(status, "Can't open \"%s\" - %s", dataFile, u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/rbbitst.cpp
===================================================================
--- trunk/source/test/intltest/rbbitst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/rbbitst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -38,7 +38,7 @@
errln("Failure in file %s, line %d", __FILE__, __LINE__);}}
#define TEST_ASSERT_SUCCESS(errcode) { if (U_FAILURE(errcode)) { \
- errln("Failure in file %s, line %d, status = \"%s\"", __FILE__, __LINE__, u_errorName(errcode));}}
+ errcheckln(errcode, "Failure in file %s, line %d, status = \"%s\"", __FILE__, __LINE__, u_errorName(errcode));}}
//---------------------------------------------
@@ -349,7 +349,7 @@
RuleBasedBreakIterator *bi = new RuleBasedBreakIterator(rulesString1, parseError, status);
if(U_FAILURE(status)) {
- errln("FAIL : in construction");
+ dataerrln("FAIL : in construction - %s", u_errorName(status));
} else {
int32_t pos;
int32_t i = 0;
@@ -453,7 +453,7 @@
Locale("th"), status);
if (U_FAILURE(status))
{
- errln("Failed to create the BreakIterator for Thai locale in TestThaiLineBreak.\n");
+ errcheckln(status, "Failed to create the BreakIterator for Thai locale in TestThaiLineBreak. - %s", u_errorName(status));
return;
}
@@ -497,7 +497,7 @@
RuleBasedBreakIterator* e = (RuleBasedBreakIterator *)BreakIterator::createLineInstance(Locale("th"), status);
if (U_FAILURE(status))
{
- errln("Failed to create the BreakIterator for Thai locale in TestMixedThaiLineBreak.\n");
+ errcheckln(status, "Failed to create the BreakIterator for Thai locale in TestMixedThaiLineBreak. - %s", u_errorName(status));
return;
}
@@ -530,7 +530,7 @@
if (U_FAILURE(status))
{
- errln("Failed to create the BreakIterator for Thai locale in TestMaiyamok.\n");
+ errcheckln(status, "Failed to create the BreakIterator for Thai locale in TestMaiyamok. - %s", u_errorName(status));
return;
}
generalIteratorTest(*e, thaiLineSelection);
@@ -550,7 +550,7 @@
RuleBasedBreakIterator* bi =
(RuleBasedBreakIterator *)BreakIterator::createWordInstance(Locale("th"), status);
if (U_FAILURE(status) || bi == NULL) {
- errln("Fail at file %s, line %d, status = %s", __FILE__, __LINE__, u_errorName(status));
+ errcheckln(status, "Fail at file %s, line %d, status = %s", __FILE__, __LINE__, u_errorName(status));
return;
}
bi->setText(thaiStr);
@@ -585,7 +585,7 @@
Locale("ja"), status);
if (U_FAILURE(status))
{
- errln("Failed to create the BreakIterator for Japanese locale in TestJapaneseWordBreak.\n");
+ errcheckln(status, "Failed to create the BreakIterator for Japanese locale in TestJapaneseWordBreak.\n");
return;
}
@@ -1078,7 +1078,7 @@
RuleBasedBreakIterator* bi = (RuleBasedBreakIterator *)BreakIterator::createLineInstance(Locale::getDefault(), status);
if (U_FAILURE(status))
{
- errln("Failed to create the BreakIterator for default locale in TestEmptyString.\n");
+ errcheckln(status, "Failed to create the BreakIterator for default locale in TestEmptyString. - %s", u_errorName(status));
return;
}
generalIteratorTest(*bi, x);
@@ -1091,7 +1091,7 @@
const Locale* locList = BreakIterator::getAvailableLocales(locCount);
if (locCount == 0)
- errln("getAvailableLocales() returned an empty list!");
+ dataerrln("getAvailableLocales() returned an empty list!");
// Just make sure that it's returning good memory.
int32_t i;
for (i = 0; i < locCount; ++i) {
@@ -1106,12 +1106,12 @@
BreakIterator::getDisplayName(Locale::getUS(), result);
if (Locale::getDefault() == Locale::getUS() && result != "English (United States)")
- errln("BreakIterator::getDisplayName() failed: expected \"English (United States)\", got \""
+ dataerrln("BreakIterator::getDisplayName() failed: expected \"English (United States)\", got \""
+ result);
BreakIterator::getDisplayName(Locale::getFrance(), Locale::getUS(), result);
if (result != "French (France)")
- errln("BreakIterator::getDisplayName() failed: expected \"French (France)\", got \""
+ dataerrln("BreakIterator::getDisplayName() failed: expected \"French (France)\", got \""
+ result);
}
/**
@@ -1125,7 +1125,7 @@
BreakIterator *wb = BreakIterator::createWordInstance(Locale::getDefault(), status);
if (U_FAILURE(status))
{
- errln("Failed to create the BreakIterator for default locale in TestEndBehaviour.\n");
+ errcheckln(status, "Failed to create the BreakIterator for default locale in TestEndBehaviour. - %s", u_errorName(status));
return;
}
wb->setText(testString);
@@ -1146,7 +1146,7 @@
BreakIterator *iter = BreakIterator::createWordInstance(Locale::getDefault(), status);
if (U_FAILURE(status))
{
- errln("Failed to create the BreakIterator for default locale in TestBug4153072\n");
+ errcheckln(status, "Failed to create the BreakIterator for default locale in TestBug4153072 - %s", u_errorName(status));
return;
}
UnicodeString str("...Hello, World!...");
@@ -1184,13 +1184,15 @@
UErrorCode status = U_ZERO_ERROR;
BreakIterator *bi = BreakIterator::createSentenceInstance(Locale::getEnglish(), status);
TEST_ASSERT_SUCCESS(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+// Check for status first for better handling of no data errors.
TEST_ASSERT(bi != NULL);
-
- if (U_FAILURE(status) || bi == NULL) {
- // TEST_ASSERT already printed error message.
+ if (bi == NULL) {
return;
}
-
+
UnicodeString s("One.\\u00ad Two.", -1, US_INV);
// 01234 56789
s = s.unescape();
@@ -1425,7 +1427,9 @@
tp.srcCol = new UVector32(status);
RegexMatcher localeMatcher(UNICODE_STRING_SIMPLE("<locale *([\\p{L}\\p{Nd}_]*) *>"), 0, status);
- TEST_ASSERT_SUCCESS(status);
+ if (U_FAILURE(status)) {
+ dataerrln("Failure in file %s, line %d, status = \"%s\"", __FILE__, __LINE__, u_errorName(status));
+ }
//
@@ -1790,7 +1794,7 @@
b = BreakIterator::createWordInstance(locale, status);
if (U_FAILURE(status)) {
- errln("Unable to create thai word break iterator.\n");
+ errcheckln(status, "Unable to create thai word break iterator. - %s", u_errorName(status));
return;
}
b->setText(text);
@@ -1943,7 +1947,7 @@
break;
}
if (U_FAILURE(status)) {
- errln("BreakIterator create failed for type %d, locales root or %s", (int)(tbItemPtr->type), tbItemPtr->locale);
+ errcheckln(status, "BreakIterator create failed for type %d, locales root or %s - Error: %s", (int)(tbItemPtr->type), tbItemPtr->locale, u_errorName(status));
continue;
}
TBTest(tailoredBrkiter, (int)(tbItemPtr->type), tbItemPtr->locale, tbItemPtr->escapedText, tbItemPtr->tailoredOffsets, tbItemPtr->tailoredOffsetsCount);
@@ -1993,7 +1997,7 @@
//
f = fopen(fileName, "rb");
if (f == 0) {
- dataerrln("[DATA] Error opening test data file %s\n", fileName);
+ dataerrln("Error opening test data file %s\n", fileName);
status = U_FILE_ACCESS_ERROR;
return NULL;
}
@@ -2129,7 +2133,7 @@
const char *testDataDirectory = IntlTest::getSourceTestData(status);
char testFileName[1000];
if (testDataDirectory == NULL || strlen(testDataDirectory) >= sizeof(testFileName)) {
- dataerrln("[DATA] Can't open test data. Path too long.");
+ dataerrln("Can't open test data. Path too long.");
return;
}
strcpy(testFileName, testDataDirectory);
@@ -3944,7 +3948,7 @@
};
int loop;
if (U_FAILURE(status)) {
- errln("Creation of break iterator failed %s", u_errorName(status));
+ errcheckln(status, "Creation of break iterator failed %s", u_errorName(status));
return;
}
for (loop = 0; loop < (int)(sizeof(strlist) / sizeof(char *)); loop ++) {
@@ -4010,7 +4014,7 @@
};
int loop;
if (U_FAILURE(status)) {
- errln("Creation of break iterator failed %s", u_errorName(status));
+ errcheckln(status, "Creation of break iterator failed %s", u_errorName(status));
return;
}
for (loop = 0; loop < (int)(sizeof(strlist) / sizeof(char *)); loop ++) {
@@ -4178,7 +4182,7 @@
};
int loop;
if (U_FAILURE(status)) {
- errln("Creation of break iterator failed %s", u_errorName(status));
+ errcheckln(status, "Creation of break iterator failed %s", u_errorName(status));
return;
}
for (loop = 0; loop < (int)(sizeof(strlist) / sizeof(char *)); loop ++) {
@@ -4268,7 +4272,7 @@
}
}
else {
- errln("Creation of character break iterator failed %s", u_errorName(status));
+ errcheckln(status, "Creation of character break iterator failed %s", u_errorName(status));
}
delete bi;
}
@@ -4281,7 +4285,7 @@
RunMonkey(bi, m, "word", seed, loopCount, useUText);
}
else {
- errln("Creation of word break iterator failed %s", u_errorName(status));
+ errcheckln(status, "Creation of word break iterator failed %s", u_errorName(status));
}
delete bi;
}
@@ -4297,7 +4301,7 @@
RunMonkey(bi, m, "line", seed, loopCount, useUText);
}
else {
- errln("Creation of line break iterator failed %s", u_errorName(status));
+ errcheckln(status, "Creation of line break iterator failed %s", u_errorName(status));
}
delete bi;
}
@@ -4313,7 +4317,7 @@
RunMonkey(bi, m, "sentence", seed, loopCount, useUText);
}
else {
- errln("Creation of line break iterator failed %s", u_errorName(status));
+ errcheckln(status, "Creation of line break iterator failed %s", u_errorName(status));
}
delete bi;
}
Modified: trunk/source/test/intltest/regcoll.cpp
===================================================================
--- trunk/source/test/intltest/regcoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/regcoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -25,7 +25,7 @@
if(U_FAILURE(status)) {
delete en_us;
en_us = 0;
- errln("Collator creation failed with %s", u_errorName(status));
+ errcheckln(status, "Collator creation failed with %s", u_errorName(status));
return;
}
}
@@ -1209,7 +1209,7 @@
default: name = ""; break;
}
} else {
- errln("Class collator not instantiated");
+ dataerrln("Class collator not instantiated");
name = "";
}
}
Modified: trunk/source/test/intltest/regextst.cpp
===================================================================
--- trunk/source/test/intltest/regextst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/regextst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2002-2008, International Business Machines Corporation and
+ * Copyright (c) 2002-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -84,13 +84,13 @@
// Error Checking / Reporting macros used in all of the tests.
//
//---------------------------------------------------------------------------
-#define REGEX_CHECK_STATUS {if (U_FAILURE(status)) {errln("RegexTest failure at line %d. status=%s\n", \
+#define REGEX_CHECK_STATUS {if (U_FAILURE(status)) {dataerrln("RegexTest failure at line %d. status=%s", \
__LINE__, u_errorName(status)); return;}}
#define REGEX_ASSERT(expr) {if ((expr)==FALSE) {errln("RegexTest failure at line %d.\n", __LINE__);};}
#define REGEX_ASSERT_FAIL(expr, errcode) {UErrorCode status=U_ZERO_ERROR; (expr);\
-if (status!=errcode) {errln("RegexTest failure at line %d. Expected status=%s, got %s\n", \
+if (status!=errcode) {dataerrln("RegexTest failure at line %d. Expected status=%s, got %s", \
__LINE__, u_errorName(errcode), u_errorName(status));};}
#define REGEX_CHECK_STATUS_L(line) {if (U_FAILURE(status)) {errln( \
@@ -129,7 +129,7 @@
UnicodeString patString(pat, -1, US_INV);
REPattern = RegexPattern::compile(patString, 0, pe, status);
if (U_FAILURE(status)) {
- errln("RegexTest failure in RegexPattern::compile() at line %d. Status = %s\n",
+ dataerrln("RegexTest failure in RegexPattern::compile() at line %d. Status = %s",
line, u_errorName(status));
return FALSE;
}
@@ -206,7 +206,7 @@
UnicodeString patString(pat);
callerPattern = RegexPattern::compile(patString, 0, pe, status);
if (status != expectedStatus) {
- errln("Line %d: unexpected error %s compiling pattern.", line, u_errorName(status));
+ dataerrln("Line %d: unexpected error %s compiling pattern.", line, u_errorName(status));
} else {
if (status != U_ZERO_ERROR) {
if (pe.line != errLine || pe.offset != errCol) {
@@ -1924,7 +1924,7 @@
//
f = fopen(fileName, "rb");
if (f == 0) {
- dataerrln("[DATA] Error opening test data file %s\n", fileName);
+ dataerrln("Error opening test data file %s\n", fileName);
status = U_FILE_ACCESS_ERROR;
return NULL;
}
Modified: trunk/source/test/intltest/restest.cpp
===================================================================
--- trunk/source/test/intltest/restest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/restest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -202,7 +202,7 @@
loadTestData(status);
if(U_FAILURE(status))
{
- dataerrln("[DATA] Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
+ dataerrln("Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
return;
}
@@ -235,7 +235,7 @@
const char* testdatapath=loadTestData(err);
if(U_FAILURE(err))
{
- dataerrln("[DATA] Could not load testdata.dat " + UnicodeString(testdatapath) + ", " + UnicodeString(u_errorName(err)));
+ dataerrln("Could not load testdata.dat " + UnicodeString(testdatapath) + ", " + UnicodeString(u_errorName(err)));
return;
}
@@ -319,7 +319,7 @@
testdatapath=loadTestData(status);
if(U_FAILURE(status))
{
- dataerrln("[DATA] Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
+ dataerrln("Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
return FALSE;
}
@@ -534,7 +534,7 @@
if(U_FAILURE(status))
{
- dataerrln("[DATA] Could not load testdata.dat %s\n", u_errorName(status));
+ dataerrln("Could not load testdata.dat %s\n", u_errorName(status));
return;
}
@@ -588,7 +588,7 @@
if(U_FAILURE(status))
{
- dataerrln("[DATA] Could not load testdata.dat %s\n", u_errorName(status));
+ dataerrln("Could not load testdata.dat %s\n", u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/restsnew.cpp
===================================================================
--- trunk/source/test/intltest/restsnew.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/restsnew.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/********************************************************************
- * Copyright (c) 1997-2008, International Business Machines
+ * Copyright (c) 1997-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
@@ -200,7 +200,7 @@
loadTestData(status);
if(U_FAILURE(status))
{
- dataerrln("[DATA] Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
+ dataerrln("Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
return;
}
@@ -234,7 +234,7 @@
testdatapath=loadTestData(err);
if(U_FAILURE(err))
{
- dataerrln("[DATA] Could not load testdata.dat %s " + UnicodeString(u_errorName(err)));
+ dataerrln("Could not load testdata.dat %s " + UnicodeString(u_errorName(err)));
return;
}
@@ -309,7 +309,7 @@
testdatapath=loadTestData(err);
if(U_FAILURE(err))
{
- dataerrln("[DATA] Could not load testdata.dat %s " + UnicodeString(u_errorName(err)));
+ dataerrln("Could not load testdata.dat %s " + UnicodeString(u_errorName(err)));
return;
}
@@ -428,7 +428,7 @@
if(U_FAILURE(err))
{
- dataerrln("[DATA] Could not load testdata.dat %s " + UnicodeString(u_errorName(err)));
+ dataerrln("Could not load testdata.dat %s " + UnicodeString(u_errorName(err)));
return;
}
@@ -463,7 +463,7 @@
ResourceBundle defaultresource(err);
ResourceBundle explicitdefaultresource(NULL, Locale::getDefault(), err);
if(U_FAILURE(err)){
- errln("Construction of default resourcebundle failed");
+ errcheckln(err, "Construction of default resourcebundle failed - %s", u_errorName(err));
return;
}
// You can't compare the default locale to the resolved locale in the
@@ -636,7 +636,7 @@
testdatapath=loadTestData(status);
if(U_FAILURE(status))
{
- dataerrln("[DATA] Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
+ dataerrln("Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
return FALSE;
}
@@ -1017,7 +1017,7 @@
if(U_FAILURE(status))
{
- dataerrln("[DATA] Could not load testdata.dat %s \n",u_errorName(status));
+ dataerrln("Could not load testdata.dat %s \n",u_errorName(status));
return;
}
@@ -1164,7 +1164,7 @@
heRes.getWithFallback("calendar", status).getWithFallback("islamic-civil", status).getWithFallback("eras", status);
if(U_FAILURE(status)) {
- errln("Didn't get Islamic Eras. I know they are there!\n");
+ dataerrln("Didn't get Islamic Eras. I know they are there! - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
Modified: trunk/source/test/intltest/srchtest.cpp
===================================================================
--- trunk/source/test/intltest/srchtest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/srchtest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/*
*****************************************************************************
-* Copyright (C) 2001-2008, International Business Machines orporation
+* Copyright (C) 2001-2009, International Business Machines orporation
* and others. All Rights Reserved.
****************************************************************************/
@@ -25,7 +25,7 @@
logln(#test "---"); \
logln((UnicodeString)""); \
if(areBroken) { \
- errln(__FILE__ " cannot test - failed to create collator."); \
+ dataerrln(__FILE__ " cannot test - failed to create collator."); \
} else { \
test(); \
} \
Modified: trunk/source/test/intltest/ssearch.cpp
===================================================================
--- trunk/source/test/intltest/ssearch.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/ssearch.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -52,7 +52,7 @@
errln("Failure in file %s, line %d. \"%s\"", __FILE__, __LINE__, m);return;}}
#define TEST_ASSERT_SUCCESS(errcode) {if (U_FAILURE(errcode)) { \
- errln("Failure in file %s, line %d, test ID \"%s\", status = \"%s\"", \
+ dataerrln("Failure in file %s, line %d, test ID \"%s\", status = \"%s\"", \
__FILE__, __LINE__, testId, u_errorName(errcode));}}
#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
@@ -973,7 +973,7 @@
UErrorCode status = U_ZERO_ERROR;
RuleBasedCollator *col = (RuleBasedCollator *) Collator::createInstance(Locale::getEnglish(), status);
if (U_FAILURE(status)) {
- errln("Failed to create collator in offsetTest!");
+ errcheckln(status, "Failed to create collator in offsetTest! - %s", u_errorName(status));
return;
}
char buffer[4096]; // A bit of a hack... just happens to be long enough for all the test cases...
@@ -1235,7 +1235,7 @@
coll = ucol_openFromShortString("S1", FALSE, NULL, &status);
if (U_FAILURE(status)) {
- errln("Could not open collator.");
+ errcheckln(status, "Could not open collator. - %s", u_errorName(status));
return;
}
@@ -1298,7 +1298,7 @@
coll = ucol_openFromShortString("S1", FALSE, NULL, &status);
if (U_FAILURE(status)) {
- errln("Could not open collator.");
+ errcheckln(status, "Could not open collator. - %s", u_errorName(status));
return;
}
@@ -1354,7 +1354,7 @@
coll = ucol_open(NULL, &status);
if (U_FAILURE(status)) {
- errln("Couldn't open collator.");
+ errcheckln(status, "Couldn't open collator. - %s", u_errorName(status));
return;
}
@@ -1499,7 +1499,10 @@
UCollator *collator = ucol_open("en", &status);
CollData *data = CollData::open(collator, status);
- TEST_ASSERT_SUCCESS(status);
+ if (U_FAILURE(status) || collator == NULL || data == NULL) {
+ errcheckln(status, "Unable to open UCollator or CollData. - %s", u_errorName(status));
+ return;
+ }
//ucol_setStrength(collator, collatorStrength);
//ucol_setAttribute(collator, UCOL_NORMALIZATION_MODE, normalize, &status);
UnicodeString uPattern = cPattern;
@@ -2071,7 +2074,7 @@
UCollator *coll = ucol_openFromShortString("S1", FALSE, NULL, &status);
if (U_FAILURE(status)) {
- errln("Failed to create collator in MonkeyTest!");
+ errcheckln(status, "Failed to create collator in MonkeyTest! - %s", u_errorName(status));
return;
}
@@ -2208,7 +2211,7 @@
UCollator *coll = ucol_openFromShortString("S1", FALSE, NULL, &status);
if (U_FAILURE(status)) {
- errln("Failed to create collator in MonkeyTest!");
+ errcheckln(status, "Failed to create collator in MonkeyTest! - %s", u_errorName(status));
return;
}
Modified: trunk/source/test/intltest/strcase.cpp
===================================================================
--- trunk/source/test/intltest/strcase.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/strcase.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2002-2008, International Business Machines
+* Copyright (C) 2002-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -376,14 +376,14 @@
break; // won't happen
}
if(result!=output) {
- errln("error: UnicodeString.%s() got a wrong result for a test case from casing.res", name);
+ dataerrln("error: UnicodeString.%s() got a wrong result for a test case from casing.res", name);
}
#if !UCONFIG_NO_BREAK_ITERATION
if(whichCase==TEST_TITLE && options==0) {
result=input;
result.toTitle((BreakIterator *)iter, locale);
if(result!=output) {
- errln("error: UnicodeString.toTitle(options=0) got a wrong result for a test case from casing.res");
+ dataerrln("error: UnicodeString.toTitle(options=0) got a wrong result for a test case from casing.res");
}
}
#endif
@@ -445,7 +445,7 @@
result.releaseBuffer(U_SUCCESS(errorCode) ? resultLength : 0);
if(U_FAILURE(errorCode)) {
- errln("error: %s() got an error for a test case from casing.res - %s", name, u_errorName(errorCode));
+ errcheckln(errorCode, "error: %s() got an error for a test case from casing.res - %s", name, u_errorName(errorCode));
} else if(result!=output) {
errln("error: %s() got a wrong result for a test case from casing.res", name);
errln("expected \"" + output + "\" got \"" + result + "\"" );
@@ -514,7 +514,7 @@
}
if(U_FAILURE(status)) {
- errln("error: TestCasing() setup failed for %s test case from casing.res: %s", dataNames[whichCase], u_errorName(status));
+ dataerrln("error: TestCasing() setup failed for %s test case from casing.res: %s", dataNames[whichCase], u_errorName(status));
status = U_ZERO_ERROR;
} else {
TestCasingImpl(input, output, whichCase, iter, cLocaleID, options);
@@ -537,7 +537,7 @@
input=UNICODE_STRING_SIMPLE("sTrA\\u00dfE").unescape();
(result=input).toTitle(NULL);
if(result!=UNICODE_STRING_SIMPLE("Stra\\u00dfe").unescape()) {
- errln("UnicodeString::toTitle(NULL) failed");
+ dataerrln("UnicodeString::toTitle(NULL) failed.");
}
#endif
}
Modified: trunk/source/test/intltest/svccoll.cpp
===================================================================
--- trunk/source/test/intltest/svccoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/svccoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -42,7 +42,7 @@
Collator* frcol = Collator::createInstance(FR, status);
Collator* uscol = Collator::createInstance(US, status);
if(U_FAILURE(status)) {
- errln("Failed to create collators with %s", u_errorName(status));
+ errcheckln(status, "Failed to create collators with %s", u_errorName(status));
delete frcol;
delete uscol;
return;
@@ -357,7 +357,7 @@
Collator* gecol = Collator::createInstance(Locale::getGermany(), status);
Collator* jpcol = Collator::createInstance(Locale::getJapan(), status);
if(U_FAILURE(status)) {
- errln("Failed to create collators with %s", u_errorName(status));
+ errcheckln(status, "Failed to create collators with %s", u_errorName(status));
delete frcol;
delete gecol;
delete jpcol;
@@ -560,7 +560,7 @@
delete iter;
iter = Collator::getKeywordValues(KW[0], ec);
- if (!assertTrue("getKeywordValues != NULL", iter!=NULL)) return;
+ if (!assertTrue("getKeywordValues != NULL", iter!=NULL, FALSE, TRUE)) return;
if (!assertSuccess("getKeywordValues", ec)) return;
checkStringEnumeration("getKeywordValues", *iter, KWVAL, KWVAL_COUNT);
delete iter;
Modified: trunk/source/test/intltest/tchcfmt.cpp
===================================================================
--- trunk/source/test/intltest/tchcfmt.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tchcfmt.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,7 +1,7 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2008, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -127,7 +127,7 @@
Format* filenumform = NumberFormat::createInstance( status );
if (!filenumform) {
- it_errln("*** test_complex_example filenumform");
+ dataerrln((UnicodeString)"*** test_complex_example filenumform - " + u_errorName(status));
delete fileform;
return;
}
Modified: trunk/source/test/intltest/testidn.cpp
===================================================================
--- trunk/source/test/intltest/testidn.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/testidn.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -82,7 +82,7 @@
profile = usprep_openByType(USPREP_RFC3491_NAMEPREP, &errorCode);
if(U_FAILURE(errorCode)){
- test.errln("Failed to load IDNA data file. " + UnicodeString(u_errorName(errorCode)));
+ test.errcheckln(errorCode, "Failed to load IDNA data file. " + UnicodeString(u_errorName(errorCode)));
return errorCode;
}
Modified: trunk/source/test/intltest/testidna.cpp
===================================================================
--- trunk/source/test/intltest/testidna.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/testidna.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -487,7 +487,7 @@
}
if(status != expectedStatus){
- errln( "Did not get the expected error for "+
+ errcheckln(status, "Did not get the expected error for "+
UnicodeString(testName)+
" null terminated source. Expected: " +UnicodeString(u_errorName(expectedStatus))
+ " Got: "+ UnicodeString(u_errorName(status))
@@ -655,7 +655,7 @@
errln("Did not get the expected result for %s with null termniated strings.\n",testName);
}
if(U_FAILURE(status)){
- errln( "%s null terminated source failed. Error: %s\n", testName,u_errorName(status));
+ errcheckln(status, "%s null terminated source failed. Error: %s", testName,u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -665,7 +665,7 @@
errln("Did not get the expected result for %s with null termniated strings with options set.\n", testName);
}
if(U_FAILURE(status)){
- errln( "%s null terminated source and options set failed. Error: %s\n",testName, u_errorName(status));
+ errcheckln(status, "%s null terminated source and options set failed. Error: %s",testName, u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -675,7 +675,7 @@
errln("Did not get the expected result for %s with string length.\n",testName);
}
if(U_FAILURE(status)){
- errln( "%s with string length. Error: %s\n",testName, u_errorName(status));
+ errcheckln(status, "%s with string length. Error: %s",testName, u_errorName(status));
}
status = U_ZERO_ERROR;
@@ -685,7 +685,7 @@
errln("Did not get the expected result for %s with string length and options set.\n",testName);
}
if(U_FAILURE(status)){
- errln( "%s with string length and options set. Error: %s\n", u_errorName(status), testName);
+ errcheckln(status, "%s with string length and options set. Error: %s", u_errorName(status), testName);
}
}
@@ -725,7 +725,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)){
- errln( "%s failed to convert domainNames[%i].Error: %s \n",testName, i, u_errorName(status));
+ errcheckln(status, "%s failed to convert domainNames[%i].Error: %s",testName, i, u_errorName(status));
break;
}
testAPI(buf,expected,testName,FALSE,U_ZERO_ERROR, TRUE, TRUE, func);
@@ -751,7 +751,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)){
- errln( "%s failed to convert domainNames[%i].Error: %s \n",testName,i, u_errorName(status));
+ errcheckln(status, "%s failed to convert domainNames[%i].Error: %s",testName,i, u_errorName(status));
break;
}
testAPI(buf,expected,testName, FALSE,U_ZERO_ERROR, TRUE, TRUE, func);
@@ -1004,7 +1004,7 @@
// test null-terminated source
expectedLen = func(src,-1,expected,MAX_DEST_SIZE, options, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s null terminated source failed. Error: %s\n",testName, u_errorName(status));
+ errcheckln(status, "%s null terminated source failed. Error: %s",testName, u_errorName(status));
}
memcpy(odd,expected,(expectedLen+1) * U_SIZEOF_UCHAR);
memcpy(even,expected,(expectedLen+1) * U_SIZEOF_UCHAR);
@@ -1012,7 +1012,7 @@
if((i%2) ==0){
evenLen = func(odd,-1,even,MAX_DEST_SIZE,options, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s null terminated source failed\n",testName);
+ errcheckln(status, "%s null terminated source failed - %s",testName, u_errorName(status));
break;
}
}else{
@@ -1041,7 +1041,7 @@
status = U_ZERO_ERROR;
expectedLen = func(src,-1,expected,MAX_DEST_SIZE,options|UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s null terminated source with options set failed. Error: %s\n",testName, u_errorName(status));
+ errcheckln(status, "%s null terminated source with options set failed. Error: %s",testName, u_errorName(status));
}
memcpy(odd,expected,(expectedLen+1) * U_SIZEOF_UCHAR);
memcpy(even,expected,(expectedLen+1) * U_SIZEOF_UCHAR);
@@ -1049,7 +1049,7 @@
if((i%2) ==0){
evenLen = func(odd,-1,even,MAX_DEST_SIZE,options|UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s null terminated source with options set failed\n",testName);
+ errcheckln(status, "%s null terminated source with options set failed - %s",testName, u_errorName(status));
break;
}
}else{
@@ -1079,7 +1079,7 @@
status = U_ZERO_ERROR;
expectedLen = func(src,srcLen,expected,MAX_DEST_SIZE,options, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s null terminated source failed. Error: %s\n",testName, u_errorName(status));
+ errcheckln(status, "%s null terminated source failed. Error: %s",testName, u_errorName(status));
}
memcpy(odd,expected,(expectedLen+1) * U_SIZEOF_UCHAR);
memcpy(even,expected,(expectedLen+1) * U_SIZEOF_UCHAR);
@@ -1087,13 +1087,13 @@
if((i%2) ==0){
evenLen = func(odd,oddLen,even,MAX_DEST_SIZE,options, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s source with source length failed\n",testName);
+ errcheckln(status, "%s source with source length failed - %s",testName, u_errorName(status));
break;
}
}else{
oddLen = func(even,evenLen,odd,MAX_DEST_SIZE,options, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s source with source length failed\n",testName);
+ errcheckln(status, "%s source with source length failed - %s",testName, u_errorName(status));
break;
}
}
@@ -1114,7 +1114,7 @@
status = U_ZERO_ERROR;
expectedLen = func(src,srcLen,expected,MAX_DEST_SIZE,options|UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s null terminated source with options set failed. Error: %s\n",testName, u_errorName(status));
+ errcheckln(status, "%s null terminated source with options set failed. Error: %s",testName, u_errorName(status));
}
memcpy(odd,expected,(expectedLen+1) * U_SIZEOF_UCHAR);
memcpy(even,expected,(expectedLen+1) * U_SIZEOF_UCHAR);
@@ -1122,13 +1122,13 @@
if((i%2) ==0){
evenLen = func(odd,oddLen,even,MAX_DEST_SIZE,options|UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s source with source length and options set failed\n",testName);
+ errcheckln(status, "%s source with source length and options set failed - %s",testName, u_errorName(status));
break;
}
}else{
oddLen = func(even,evenLen,odd,MAX_DEST_SIZE,options|UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
if(U_FAILURE(status)){
- errln("%s source with source length and options set failed\n",testName);
+ errcheckln(status, "%s source with source length and options set failed - %s",testName, u_errorName(status));
break;
}
}
@@ -1460,11 +1460,7 @@
getInstance(status); // Init prep
if (U_FAILURE(status)) {
- if (status == U_FILE_ACCESS_ERROR) {
- dataerrln("[DATA] Test could not initialize.");
- } else {
- errln("Test could not initialize. Got %s", u_errorName(status));
- }
+ dataerrln("Test could not initialize. Got %s", u_errorName(status));
return;
}
@@ -1540,9 +1536,7 @@
getInstance(status); // Init prep
if (U_FAILURE(status)) {
if (status == U_FILE_ACCESS_ERROR) {
- dataerrln("[DATA] Test could not initialize.");
- } else {
- errln("Test could not initialize. Got %s", u_errorName(status));
+ dataerrln("Test could not initialize. Got %s", u_errorName(status));
}
return;
}
Modified: trunk/source/test/intltest/thcoll.cpp
===================================================================
--- trunk/source/test/intltest/thcoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/thcoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1999-2006, International Business Machines
+* Copyright (C) 1999-2009, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -52,7 +52,7 @@
char* /*par*/) {
if((!coll) && exec) {
- errln(__FILE__ " cannot test - failed to create collator.");
+ dataerrln(__FILE__ " cannot test - failed to create collator.");
name = "some test";
return;
}
Modified: trunk/source/test/intltest/tmsgfmt.cpp
===================================================================
--- trunk/source/test/intltest/tmsgfmt.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tmsgfmt.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -287,7 +287,7 @@
UnicodeString buffer;
form = new MessageFormat(testCases[i], Locale::getUS(), success);
if (U_FAILURE(success)) {
- errln("MessageFormat creation failed.#1");
+ dataerrln("MessageFormat creation failed.#1 - %s", u_errorName(success));
logln(((UnicodeString)"MessageFormat for ") + testCases[i] + " creation failed.\n");
continue;
}
@@ -305,7 +305,7 @@
FieldPosition fieldpos(0);
form->format(testArgs, count, result, fieldpos, success);
if (U_FAILURE(success)) {
- errln("MessageFormat failed test #3");
+ dataerrln("MessageFormat failed test #3 - %s", u_errorName(success));
logln("TestMessageFormat::PatternTest failed test #3");
continue;
}
@@ -388,7 +388,7 @@
err);
if (U_FAILURE(err)) {
- errln("TestMessageFormat::testStaticFormat #1");
+ dataerrln("TestMessageFormat::testStaticFormat #1 - %s", u_errorName(err));
logln(UnicodeString("TestMessageFormat::testStaticFormat failed test #1 with error code ")+(int32_t)err);
return;
}
@@ -424,7 +424,7 @@
err);
if (U_FAILURE(err)) {
- errln("TestTurkishCasing #1 with error code %s", u_errorName(err));
+ dataerrln("TestTurkishCasing #1 with error code %s", u_errorName(err));
return;
}
@@ -455,7 +455,7 @@
FieldPosition ignore(FieldPosition::DONT_CARE);
form->format(testArgs1, 2, string, ignore, err);
if (U_FAILURE(err) || string != "The disk \"MyDisk\" contains 0 file(s).") {
- errln(UnicodeString("TestMessageFormat::testSimpleFormat failed on test #1"));
+ dataerrln(UnicodeString("TestMessageFormat::testSimpleFormat failed on test #1 - ") + u_errorName(err));
}
ignore.setField(FieldPosition::DONT_CARE);
@@ -463,14 +463,14 @@
form->format(testArgs2, 2, string, ignore, err);
if (U_FAILURE(err) || string != "The disk \"MyDisk\" contains 1 file(s).") {
logln(string);
- errln(UnicodeString("TestMessageFormat::testSimpleFormat failed on test #2")+string);
+ dataerrln(UnicodeString("TestMessageFormat::testSimpleFormat failed on test #2")+string + " - " + u_errorName(err));
}
ignore.setField(FieldPosition::DONT_CARE);
string.remove();
form->format(testArgs3, 2, string, ignore, err);
if (U_FAILURE(err) || string != "The disk \"MyDisk\" contains 12 file(s).") {
- errln(UnicodeString("TestMessageFormat::testSimpleFormat failed on test #3")+string);
+ dataerrln(UnicodeString("TestMessageFormat::testSimpleFormat failed on test #3")+string + " - " + u_errorName(err));
}
delete form;
@@ -510,7 +510,7 @@
Formattable testArgs3[] = {(int32_t)1273, "MyDisk"};
form->format(testArgs3, 2, string, ignore, err);
if (string != "The disk \"MyDisk\" contains 1,273 files.") {
- errln("TestMessageFormat::testMsgFormatChoice failed on test #3");
+ dataerrln("TestMessageFormat::testMsgFormatChoice failed on test #3 - %s", u_errorName(err));
}
delete form;
@@ -530,7 +530,7 @@
UnicodeString t5("{0, plural, one {{0, number,C''''est #,##0.0# fichier}} other {Ce sont # fichiers}} dans la liste.");
MessageFormat* mfNum = new MessageFormat(t1, Locale("fr"), err);
if (U_FAILURE(err)) {
- errln("TestMessageFormat::testMsgFormatPlural #1 - argumentIndex");
+ dataerrln("TestMessageFormat::testMsgFormatPlural #1 - argumentIndex - %s", u_errorName(err));
logln(UnicodeString("TestMessageFormat::testMsgFormatPlural #1 with error code ")+(int32_t)err);
return;
}
@@ -775,7 +775,7 @@
logln(result);
if (result != compareStrEng) {
- errln("*** MSG format err.");
+ dataerrln("*** MSG format err. - %s", u_errorName(err));
}
msg.setLocale(Locale::getEnglish());
@@ -807,7 +807,7 @@
if (result == compareStrGer) {
logln("MSG setLocale tested.");
}else{
- errln( "*** MSG setLocale err.");
+ dataerrln( "*** MSG setLocale err. - %s", u_errorName(err));
}
if (getLocale_ok) {
@@ -849,7 +849,7 @@
err);
if (err != U_ILLEGAL_ARGUMENT_ERROR) {
- errln("*** MSG format without expected error code.");
+ dataerrln("*** MSG format without expected error code. - %s", u_errorName(err));
}
err = U_ZERO_ERROR;
@@ -865,7 +865,7 @@
logln("MSG format( Formattable&, ... ) expected:" + compareStr);
logln("MSG format( Formattable&, ... ) result:" + result);
if (result != compareStr) {
- errln("*** MSG format( Formattable&, .... ) err.");
+ dataerrln("*** MSG format( Formattable&, .... ) err. - %s", u_errorName(err));
}else{
logln("MSG format( Formattable&, ... ) tested.");
}
@@ -972,7 +972,7 @@
Format** formatsToAdopt;
if (!formats || !formatsCmp || (count <= 0) || (count != countCmp)) {
- errln("Error getting Formats");
+ dataerrln("Error getting Formats");
return;
}
@@ -1208,7 +1208,7 @@
"and to delight of {5}, {6}, {7}, {8}, {9}, and {10} {11}.";
MessageFormat msg(pattern, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: constructor failed");
+ dataerrln("FAIL: constructor failed - %s", u_errorName(ec));
return;
}
Modified: trunk/source/test/intltest/transapi.cpp
===================================================================
--- trunk/source/test/intltest/transapi.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/transapi.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/************************************************************************
* COPYRIGHT:
- * Copyright (c) 2000-2008, International Business Machines Corporation
+ * Copyright (c) 2000-2009, International Business Machines Corporation
* and others. All Rights Reserved.
************************************************************************/
/************************************************************************
@@ -72,7 +72,7 @@
UErrorCode status = U_ZERO_ERROR;
Transliterator* t= Transliterator::createInstance(trans, UTRANS_FORWARD, parseError, status);
if(t==0 || U_FAILURE(status)){
- errln("FAIL: construction of Latin-Greek");
+ dataerrln("FAIL: construction of Latin-Greek - %s",u_errorName(status));
return;
}else{
ID= t->getID();
@@ -138,7 +138,7 @@
Transliterator* t2 = Transliterator::createInstance("Latin-Devanagari", UTRANS_FORWARD, parseError, status);
Transliterator* invt2 = Transliterator::createInstance("Devanagari-Latin", UTRANS_FORWARD, parseError, status);
if(t1 == 0 || invt1 == 0 || t2 == 0 || invt2 == 0) {
- errln("FAIL: in instantiation");
+ dataerrln("FAIL: in instantiation - %s", u_errorName(status));
return;
}
@@ -194,7 +194,7 @@
t1=Transliterator::createInstance("Latin-Devanagari", UTRANS_FORWARD, parseError, status);
t2=Transliterator::createInstance("Latin-Greek", UTRANS_FORWARD, parseError, status);
if(t1 == 0 || t2 == 0){
- errln("FAIL: construction");
+ dataerrln("FAIL: construction - %s", u_errorName(status));
return;
}
t3=t1->clone();
@@ -243,7 +243,7 @@
for (uint32_t i=0; i<sizeof(dispNames)/sizeof(dispNames[0]); i=i+2 ) {
t = Transliterator::createInstance(dispNames[i+0], UTRANS_FORWARD, parseError, status);
if(t==0){
- errln("FAIL: construction: " + dispNames[i+0]);
+ dataerrln("FAIL: construction: " + dispNames[i+0] + " - " + u_errorName(status));
status = U_ZERO_ERROR;
continue;
}
@@ -292,8 +292,8 @@
for(uint32_t i=0;i<sizeof(Data)/sizeof(Data[0]); i=i+3){
t=Transliterator::createInstance(Data[i+0], UTRANS_FORWARD, parseError, status);
if(t==0){
- errln("FAIL: construction: " + Data[i+0] + " Error: " + u_errorName(status));
- errln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
+ dataerrln("FAIL: construction: " + Data[i+0] + " Error: " + u_errorName(status));
+ dataerrln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
status = U_ZERO_ERROR;
continue;
}
@@ -339,7 +339,7 @@
for(uint32_t i=0; i<sizeof(Data2)/sizeof(Data2[0]); i=i+6){
t=Transliterator::createInstance(Data2[i+0], UTRANS_FORWARD, parseError, status);
if(t==0){
- errln("FAIL: construction: " + prettify(Data2[i+0]));
+ dataerrln("FAIL: construction: " + prettify(Data2[i+0]) + " - " + u_errorName(status));
continue;
}
start=getInt(Data2[i+2]);
@@ -554,7 +554,7 @@
rs="Initial String: add--";
t=Transliterator::createInstance("Any-Hex", UTRANS_FORWARD, parseError, status);
if(t == 0)
- errln("FAIL : construction");
+ dataerrln("FAIL : construction - %s", u_errorName(status));
else {
keyboardAux(t, Data, rs, 0, 20);
delete t;
@@ -563,7 +563,7 @@
rs="Hindi --";
t=Transliterator::createInstance("Latin-Devanagari", UTRANS_FORWARD, parseError, status);
if(t == 0)
- errln("FAIL : construction");
+ dataerrln("FAIL : construction - %s", u_errorName(status));
else
keyboardAux(t, Data, rs, 20, 40);
@@ -902,7 +902,7 @@
if (prettify(result) == prettify(expected))
logln((UnicodeString)"Ok: " + prettify(message) + " passed \"" + prettify(expected) + "\"");
else
- errln((UnicodeString)"FAIL:" + message + " failed Got-->" + prettify(result)+ ", Expected--> " + prettify(expected) );
+ dataerrln((UnicodeString)"FAIL:" + message + " failed Got-->" + prettify(result)+ ", Expected--> " + prettify(expected) );
}
Modified: trunk/source/test/intltest/transrt.cpp
===================================================================
--- trunk/source/test/intltest/transrt.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/transrt.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 2000-2008, International Business Machines
+* Copyright (C) 2000-2009, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
@@ -474,7 +474,7 @@
UnicodeSet okAnyway("[^[:Letter:]]", status);
if (U_FAILURE(status)) {
- parent->errln("FAIL: Initializing UnicodeSet with [:Other:] or [^[:Letter:]]");
+ parent->dataerrln("FAIL: Initializing UnicodeSet with [:Other:] or [^[:Letter:]] - Error: %s", u_errorName(status));
return;
}
@@ -1027,7 +1027,7 @@
#define ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \
- errln("error at file %s, line %d, status = %s", __FILE__, __LINE__, \
+ errcheckln(status, "error at file %s, line %d, status = %s", __FILE__, __LINE__, \
u_errorName(status)); \
return;}}
@@ -1286,7 +1286,7 @@
UErrorCode error = U_ZERO_ERROR;
LegalHebrew* legal = new LegalHebrew(error);
if(U_FAILURE(error)){
- errln("Could not construct LegalHebrew object. Error: %s", u_errorName(error));
+ dataerrln("Could not construct LegalHebrew object. Error: %s", u_errorName(error));
return;
}
RTTest test("Latin-Hebrew");
@@ -1391,7 +1391,7 @@
errln("FAIL: could not create the Inverse:-( \n");
}
}else {
- errln("FAIL: could not create the transliterator. Error: %s\n", u_errorName(status));
+ dataerrln("FAIL: could not create the transliterator. Error: %s\n", u_errorName(status));
}
}
Modified: trunk/source/test/intltest/transtst.cpp
===================================================================
--- trunk/source/test/intltest/transtst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/transtst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -341,7 +341,7 @@
UTRANS_FORWARD, parseError,
status);
if (U_FAILURE(status)) {
- errln("FAIL: RBT constructor failed");
+ dataerrln("FAIL: RBT constructor failed - %s", u_errorName(status));
return;
}
expect(*t, "abcdefgABCDEFGU", "&bcd&fg!^**!^*&");
@@ -600,7 +600,7 @@
UErrorCode status = U_ZERO_ERROR;
Transliterator* t = Transliterator::createInstance("Latin-Hiragana;Hiragana-Latin", UTRANS_FORWARD, parseError, status);
if (t == 0) {
- errln("FAIL: construction of Latin-Hiragana;Hiragana-Latin failed");
+ dataerrln("FAIL: construction of Latin-Hiragana;Hiragana-Latin failed - %s", u_errorName(status));
} else {
expect(*t, "aaaaa", "aaaaa");
delete t;
@@ -761,7 +761,7 @@
UParseError parseError;
Transliterator *gl = Transliterator::createInstance("Greek-Latin; NFD; [:M:]Remove; NFC", UTRANS_FORWARD, parseError, status);
if (gl == NULL) {
- errln("FAIL: createInstance(Greek-Latin) returned NULL");
+ dataerrln("FAIL: createInstance(Greek-Latin) returned NULL - %s", u_errorName(status));
return;
}
@@ -1074,7 +1074,7 @@
Transliterator* hk = Transliterator::createInstance("Hiragana-Katakana", UTRANS_FORWARD, parseError, status);
Transliterator* kh = Transliterator::createInstance("Katakana-Hiragana", UTRANS_FORWARD, parseError, status);
if (hk == 0 || kh == 0) {
- errln("FAIL: createInstance failed");
+ dataerrln("FAIL: createInstance failed - %s", u_errorName(status));
delete hk;
delete kh;
return;
@@ -1148,7 +1148,7 @@
UParseError parseError;
Transliterator* dg = Transliterator::createInstance(ID, UTRANS_FORWARD, parseError, status);
if (dg == 0) {
- errln("FAIL: createInstance(" + ID + ") returned NULL");
+ dataerrln("FAIL: createInstance(" + ID + ") returned NULL - " + u_errorName(status));
return;
}
UnicodeString id = dg->getID();
@@ -1313,8 +1313,8 @@
for (int32_t i=0; i<DATA_length; i+=3) {
Transliterator *t = Transliterator::createInstance(DATA[i], UTRANS_FORWARD, parseError, status);
if (t == 0) {
- errln(UnicodeString("FAIL: ") + DATA[i+2] +
- " cannot create ID \"" + DATA[i] + "\"");
+ dataerrln(UnicodeString("FAIL: ") + DATA[i+2] +
+ " cannot create ID \"" + DATA[i] + "\" - " + u_errorName(status));
} else {
UnicodeString exp;
if (DATA[i+1]) {
@@ -1378,7 +1378,7 @@
logln((UnicodeString)"Ok: createInstance(" +
id + "," + DATA[i+1] + ") => " + newID);
} else {
- errln((UnicodeString)"FAIL: createInstance(" +
+ dataerrln((UnicodeString)"FAIL: createInstance(" +
id + "," + DATA[i+1] + ") => " + newID +
", expected " + expID);
}
@@ -1533,7 +1533,7 @@
// Now test toRules
t = Transliterator::createInstance("Greek-Latin; Latin-Cyrillic", UTRANS_FORWARD, parseError, status);
if (t == 0) {
- errln("FAIL: createInstance failed");
+ dataerrln("FAIL: createInstance failed - %s", u_errorName(status));
return;
}
UnicodeString exp("::Greek-Latin;\n::Latin-Cyrillic;");
@@ -1621,7 +1621,7 @@
Transliterator *t = Transliterator::createInstance
("Greek-Latin; Latin-Greek; Lower", UTRANS_FORWARD, parseError, status);
if (t == 0) {
- errln("FAIL: createInstance failed");
+ dataerrln("FAIL: createInstance failed - %s", u_errorName(status));
return;
}
t->adoptFilter(new UnicodeSet("[^A]", status));
@@ -1732,7 +1732,7 @@
Transliterator *t = Transliterator::createFromRules("ID",
UnicodeString(DATA[d+1], -1, US_INV), UTRANS_FORWARD, parseError, status);
if (t == 0) {
- errln("FAIL: createFromRules failed");
+ dataerrln("FAIL: createFromRules failed - %s", u_errorName(status));
return;
}
UnicodeString rules, escapedRules;
@@ -2074,7 +2074,7 @@
Transliterator *t = Transliterator::createInstance
("Greek-Latin; Title()", UTRANS_REVERSE,parseError, status);
if (t == 0) {
- errln("FAIL: createInstance");
+ dataerrln("FAIL: createInstance - %s", u_errorName(status));
return;
}
UnicodeString exp("(Title);Latin-Greek");
@@ -2225,7 +2225,7 @@
UErrorCode ec = U_ZERO_ERROR;
Transliterator *t = Transliterator::createInstance(ID, UTRANS_FORWARD, pe, ec);
if (t == 0 || U_FAILURE(ec)) {
- errln("FAIL: createInstance");
+ dataerrln("FAIL: createInstance - %s", u_errorName(ec));
return;
}
Transliterator *u = t->createInverse(ec);
@@ -2253,7 +2253,7 @@
UErrorCode ec = U_ZERO_ERROR;
Transliterator *t = Transliterator::createInstance(ID, UTRANS_FORWARD, pe, ec);
if (t == 0 || U_FAILURE(ec)) {
- errln("FAIL: createInstance");
+ dataerrln("FAIL: createInstance - %s", u_errorName(ec));
return;
}
Transliterator *u = t->createInverse(ec);
@@ -2355,7 +2355,7 @@
}
delete t;
} else {
- errln((UnicodeString)"FAIL: " + id + " => " + transID + ", " +
+ dataerrln((UnicodeString)"FAIL: " + id + " => " + transID + ", " +
u_errorName(ec));
}
}
@@ -2378,7 +2378,7 @@
UErrorCode ec = U_ZERO_ERROR;
Transliterator *t = Transliterator::createInstance("Latin-Hiragana", UTRANS_FORWARD, pe, ec);
if (t == 0 || U_FAILURE(ec)) {
- errln("FAIL: createInstance Latin-Hiragana");
+ dataerrln("FAIL: createInstance Latin-Hiragana - %s", u_errorName(ec));
return;
}
// Katakana should be untouched
@@ -2637,8 +2637,8 @@
Transliterator* latinToDev=Transliterator::createInstance("Latin-Devanagari", UTRANS_FORWARD, parseError, status);
Transliterator* devToLatin=Transliterator::createInstance("Devanagari-Latin", UTRANS_FORWARD, parseError, status);
if(U_FAILURE(status)){
- errln("FAIL: construction " + UnicodeString(" Error: ") + u_errorName(status));
- errln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
+ dataerrln("FAIL: construction " + UnicodeString(" Error: ") + u_errorName(status));
+ dataerrln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
return;
}
UnicodeString gotResult;
@@ -2685,8 +2685,8 @@
Transliterator* latinToDev=Transliterator::createInstance("Latin-Telugu", UTRANS_FORWARD, parseError, status);
Transliterator* devToLatin=Transliterator::createInstance("Telugu-Latin", UTRANS_FORWARD, parseError, status);
if(U_FAILURE(status)){
- errln("FAIL: construction " + UnicodeString(" Error: ") + u_errorName(status));
- errln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
+ dataerrln("FAIL: construction " + UnicodeString(" Error: ") + u_errorName(status));
+ dataerrln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
return;
}
UnicodeString gotResult;
@@ -2745,8 +2745,8 @@
Transliterator* latinToDev=Transliterator::createInstance("Latin-Devanagari", UTRANS_FORWARD, parseError, status);
Transliterator* devToLatin=Transliterator::createInstance("Devanagari-Latin", UTRANS_FORWARD, parseError, status);
if(U_FAILURE(status)){
- errln("FAIL: construction " + UnicodeString(" Error: ") + u_errorName(status));
- errln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
+ dataerrln("FAIL: construction " + UnicodeString(" Error: ") + u_errorName(status));
+ dataerrln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
return;
}
UnicodeString gotResult;
@@ -2814,8 +2814,8 @@
Transliterator* latinToTelToLatin=Transliterator::createInstance("Latin-Telugu;Telugu-Latin", UTRANS_FORWARD, parseError, status);
if(U_FAILURE(status)){
- errln("FAIL: construction " + UnicodeString(" Error: ") + u_errorName(status));
- errln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
+ dataerrln("FAIL: construction " + UnicodeString(" Error: ") + u_errorName(status));
+ dataerrln("PreContext: " + prettify(parseError.preContext) + " PostContext: " + prettify( parseError.postContext) );
return;
}
UnicodeString gotResult;
@@ -2848,7 +2848,7 @@
UnicodeSetIterator nvIter(non_vowel);
Transliterator* trans = Transliterator::createInstance("Devanagari-Gurmukhi",UTRANS_FORWARD, parseError, status);
if(U_FAILURE(status)) {
- errln("Error creating transliterator %s", u_errorName(status));
+ dataerrln("Error creating transliterator %s", u_errorName(status));
delete trans;
return;
}
@@ -2880,7 +2880,7 @@
UErrorCode ec = U_ZERO_ERROR;
Transliterator *t = Transliterator::createInstance("ru_RU-Latin", UTRANS_FORWARD, pe, ec);
if (U_FAILURE(ec)) {
- errln("FAIL: createInstance(ru_RU-Latin)");
+ dataerrln("FAIL: createInstance(ru_RU-Latin) - %s", u_errorName(ec));
delete t;
return;
}
@@ -2932,7 +2932,7 @@
UErrorCode ec = U_ZERO_ERROR;
Transliterator *t = Transliterator::createInstance(DATA[i], UTRANS_FORWARD, pe, ec);
if (U_FAILURE(ec)) {
- errln((UnicodeString)"FAIL: createInstance(" + DATA[i] + ")");
+ dataerrln((UnicodeString)"FAIL: createInstance(" + DATA[i] + ") - " + u_errorName(ec));
delete t;
continue;
}
@@ -3084,7 +3084,7 @@
if (!expValid) {
logln((UnicodeString)"Ok: getInstance(" + ID +") => " + u_errorName(ec));
} else {
- errln((UnicodeString)"FAIL: Couldn't create " + ID);
+ dataerrln((UnicodeString)"FAIL: Couldn't create " + ID + " - " + u_errorName(ec));
}
delete t;
continue;
@@ -3173,7 +3173,7 @@
if (U_FAILURE(ec)) {
delete t2;
delete t3;
- errln((UnicodeString)"FAIL: createFromRules => " + u_errorName(ec));
+ dataerrln((UnicodeString)"FAIL: createFromRules => " + u_errorName(ec));
return;
}
@@ -3290,7 +3290,7 @@
UnicodeString name;
Transliterator::getDisplayName(DATA[i], US, name);
if (name != DATA[i+1]) {
- errln((UnicodeString)"FAIL: " + DATA[i] + ".getDisplayName() => " +
+ dataerrln((UnicodeString)"FAIL: " + DATA[i] + ".getDisplayName() => " +
name + ", expected " + DATA[i+1]);
} else {
logln((UnicodeString)"Ok: " + DATA[i] + ".getDisplayName() => " + name);
@@ -3300,12 +3300,12 @@
Transliterator *t = Transliterator::createInstance(DATA[i], UTRANS_REVERSE, pe, ec);
if (U_FAILURE(ec)) {
delete t;
- errln("FAIL: createInstance failed");
+ dataerrln("FAIL: createInstance failed - %s", u_errorName(ec));
continue;
}
name = Transliterator::getDisplayName(t->getID(), US, name);
if (name != DATA[i+2]) {
- errln((UnicodeString)"FAIL: " + t->getID() + ".getDisplayName() => " +
+ dataerrln((UnicodeString)"FAIL: " + t->getID() + ".getDisplayName() => " +
name + ", expected " + DATA[i+2]);
} else {
logln((UnicodeString)"Ok: " + t->getID() + ".getDisplayName() => " + name);
@@ -3388,7 +3388,7 @@
Transliterator *t = Transliterator::createFromRules(registerRules[0+i],
registerRules[i+1], UTRANS_FORWARD, pos, status);
if (U_FAILURE(status)) {
- errln("Fails: Unable to create the transliterator from rules.");
+ dataerrln("Fails: Unable to create the transliterator from rules. - %s", u_errorName(status));
} else {
Transliterator::registerInstance(t);
}
@@ -3399,7 +3399,7 @@
const UnicodeString& name = testCases[i];
Transliterator *t = Transliterator::createInstance(name, UTRANS_FORWARD, pe, ec);
if (U_FAILURE(ec)) {
- errln((UnicodeString)"FAIL: Couldn't create " + name);
+ dataerrln((UnicodeString)"FAIL: Couldn't create " + name + " - " + u_errorName(ec));
delete t;
continue;
}
@@ -3626,7 +3626,7 @@
UErrorCode ec = U_ZERO_ERROR;
Transliterator *t = Transliterator::createFromRules("Test", rule, UTRANS_FORWARD, pe, ec);
if (t == NULL) {
- errln("FAIL: createFromRules failed");
+ dataerrln("FAIL: createFromRules failed - %s", u_errorName(ec));
return;
}
@@ -3761,7 +3761,7 @@
UNICODE_STRING_SIMPLE("'\\'u(..)(..) > '<img src=\"http://www.unicode.org/gifs/24/' $1 '/U' $1$2 '.gif\">';"),
UTRANS_FORWARD, pe, ec);
if (t == NULL || U_FAILURE(ec)) {
- errln((UnicodeString)"FAIL: createFromRules gif " + u_errorName(ec));
+ dataerrln((UnicodeString)"FAIL: createFromRules gif " + u_errorName(ec));
return;
}
_TUFReg("Any-gif", t, 0);
@@ -3840,7 +3840,7 @@
Transliterator* anyLatin =
Transliterator::createInstance("Any-Latin", UTRANS_FORWARD, parseError, status);
if (anyLatin==0) {
- errln("FAIL: createInstance returned NULL");
+ dataerrln("FAIL: createInstance returned NULL - %s", u_errorName(status));
delete anyLatin;
return;
}
@@ -3861,7 +3861,7 @@
// function call parameters going on in this test.
UnicodeSet alphabetic("[:alphabetic:]", status);
if (U_FAILURE(status)) {
- errln("Failure: file %s, line %d, status = %s", __FILE__, __LINE__, u_errorName(status));
+ dataerrln("Failure: file %s, line %d, status = %s", __FILE__, __LINE__, u_errorName(status));
return;
}
alphabetic.freeze();
@@ -4004,7 +4004,7 @@
}
const char* myId = uscript_getName(code);
if(!myId) {
- errln("Valid script code returned NULL name. Check your data!");
+ dataerrln("Valid script code returned NULL name. Check your data!");
return;
}
uprv_strcpy(id,myId);
@@ -4043,7 +4043,7 @@
UErrorCode ec = U_ZERO_ERROR; \
Transliterator* t = Transliterator::createInstance(id, UTRANS_FORWARD, ec); \
if (U_FAILURE(ec)) { \
- errln("FAIL: Couldn't create " id); \
+ dataerrln("FAIL: Couldn't create %s - %s", id, u_errorName(ec)); \
} else { \
if (t->getDynamicClassID() != cls::getStaticClassID()) { \
errln("FAIL: " #cls " dynamic and static class ID mismatch"); \
@@ -4477,7 +4477,7 @@
err = U_ZERO_ERROR;
t1 = Transliterator::createInstance(realID, UTRANS_FORWARD, err);
if (U_FAILURE(err)) {
- errln("Failed to instantiate transliterator with real ID");
+ dataerrln("Failed to instantiate transliterator with real ID - %s", u_errorName(err));
Transliterator::unregister(realID);
return;
}
@@ -4531,7 +4531,7 @@
Transliterator* hf = Transliterator::createInstance("Halfwidth-Fullwidth", UTRANS_FORWARD, parseError, status);
Transliterator* fh = Transliterator::createInstance("Fullwidth-Halfwidth", UTRANS_FORWARD, parseError, status);
if (hf == 0 || fh == 0) {
- errln("FAIL: createInstance failed");
+ dataerrln("FAIL: createInstance failed - %s", u_errorName(status));
delete hf;
delete fh;
return;
@@ -4580,7 +4580,7 @@
UErrorCode status = U_ZERO_ERROR;
Transliterator* tr = Transliterator::createInstance("Any-Latin", UTRANS_FORWARD, parseError, status);
if (tr == 0) {
- errln("FAIL: createInstance failed");
+ dataerrln("FAIL: createInstance failed - %s", u_errorName(status));
return;
}
if (U_FAILURE(status)) {
@@ -4662,7 +4662,7 @@
UParseError pe;
Transliterator *t = Transliterator::createInstance(id, UTRANS_FORWARD, pe, ec);
if (U_FAILURE(ec)) {
- errln((UnicodeString)"FAIL: Could not create " + id);
+ errln((UnicodeString)"FAIL: Could not create " + id + " - " + u_errorName(ec));
delete t;
return;
}
@@ -4673,7 +4673,7 @@
void TransliteratorTest::reportParseError(const UnicodeString& message,
const UParseError& parseError,
const UErrorCode& status) {
- errln(message +
+ dataerrln(message +
/*", parse error " + parseError.code +*/
", line " + parseError.line +
", offset " + parseError.offset +
@@ -4821,7 +4821,7 @@
if (pass) {
logln(UnicodeString("(")+tag+") " + prettify(summary));
} else {
- errln(UnicodeString("FAIL: (")+tag+") "
+ dataerrln(UnicodeString("FAIL: (")+tag+") "
+ prettify(summary)
+ ", expected " + prettify(expectedResult));
}
Modified: trunk/source/test/intltest/trcoll.cpp
===================================================================
--- trunk/source/test/intltest/trcoll.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/trcoll.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -92,7 +92,7 @@
if (exec) logln("TestSuite CollationTurkishTest: ");
if((!myCollation) && exec) {
- errln(__FILE__ " cannot test - failed to create collator.");
+ dataerrln(__FILE__ " cannot test - failed to create collator.");
name = "some test";
return;
}
Modified: trunk/source/test/intltest/trnserr.cpp
===================================================================
--- trunk/source/test/intltest/trnserr.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/trnserr.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/********************************************************************
- * Copyright (c) 2001-2007, International Business Machines
+ * Copyright (c) 2001-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*********************************************************************
* This test program is intended for testing error conditions of the
@@ -63,7 +63,7 @@
Transliterator* t= Transliterator::createInstance(trans, UTRANS_FORWARD, parseError, status);
if(t==0 || U_FAILURE(status)){
- errln("FAIL: construction of Latin-Greek");
+ dataerrln("FAIL: construction of Latin-Greek - %s", u_errorName(status));
return;
}
pos.contextLimit = 0;
Modified: trunk/source/test/intltest/tsdate.cpp
===================================================================
--- trunk/source/test/intltest/tsdate.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tsdate.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/***********************************************************************
- * Copyright (c) 1997-2006, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -112,7 +112,7 @@
{
if (fFormat == 0)
{
- errln("FAIL: DateFormat creation failed");
+ dataerrln("FAIL: DateFormat creation failed");
return;
}
@@ -263,7 +263,7 @@
}
logln(all);
}
- else errln((UnicodeString)"**** FAIL: Zero available locales or null array pointer");
+ else dataerrln((UnicodeString)"**** FAIL: Zero available locales or null array pointer");
}
void IntlTestDateFormat::monsterTest(/*char *par*/)
Modified: trunk/source/test/intltest/tsdcfmsy.cpp
===================================================================
--- trunk/source/test/intltest/tsdcfmsy.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tsdcfmsy.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -37,13 +37,15 @@
DecimalFormatSymbols fr(Locale::getFrench(), status);
if(U_FAILURE(status)) {
- errln("ERROR: Couldn't create French DecimalFormatSymbols");
+ errcheckln(status, "ERROR: Couldn't create French DecimalFormatSymbols - %s", u_errorName(status));
+ return;
}
status = U_ZERO_ERROR;
DecimalFormatSymbols en(Locale::getEnglish(), status);
if(U_FAILURE(status)) {
- errln("ERROR: Couldn't create English DecimalFormatSymbols");
+ errcheckln(status, "ERROR: Couldn't create English DecimalFormatSymbols - %s", u_errorName(status));
+ return;
}
if(en == fr || ! (en != fr) ) {
Modified: trunk/source/test/intltest/tsdtfmsy.cpp
===================================================================
--- trunk/source/test/intltest/tsdtfmsy.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tsdtfmsy.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/********************************************************************
- * Copyright (c) 1997-2008, International Business Machines
+ * Copyright (c) 1997-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
@@ -135,19 +135,22 @@
DateFormatSymbols fr(Locale::getFrench(), status);
if(U_FAILURE(status)) {
- errln("ERROR: Couldn't create French DateFormatSymbols " + (UnicodeString)u_errorName(status));
+ errcheckln(status, "ERROR: Couldn't create French DateFormatSymbols " + (UnicodeString)u_errorName(status));
+ return;
}
status = U_ZERO_ERROR;
DateFormatSymbols fr2(Locale::getFrench(), status);
if(U_FAILURE(status)) {
- errln("ERROR: Couldn't create French DateFormatSymbols " + (UnicodeString)u_errorName(status));
+ errcheckln(status, "ERROR: Couldn't create French DateFormatSymbols " + (UnicodeString)u_errorName(status));
+ return;
}
status = U_ZERO_ERROR;
DateFormatSymbols en(Locale::getEnglish(), status);
if(U_FAILURE(status)) {
- errln("ERROR: Couldn't create English DateFormatSymbols " + (UnicodeString)u_errorName(status));
+ errcheckln(status, "ERROR: Couldn't create English DateFormatSymbols " + (UnicodeString)u_errorName(status));
+ return;
}
if(en == fr || ! (en != fr) ) {
Modified: trunk/source/test/intltest/tsmthred.cpp
===================================================================
--- trunk/source/test/intltest/tsmthred.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tsmthred.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -994,13 +994,13 @@
status = U_ZERO_ERROR;
formatter = NumberFormat::createInstance(Locale::getEnglish(),status);
if(U_FAILURE(status)) {
- error("Error on NumberFormat::createInstance()");
+ error("Error on NumberFormat::createInstance().");
goto cleanupAndReturn;
}
percentFormatter = NumberFormat::createPercentInstance(Locale::getFrench(),status);
if(U_FAILURE(status)) {
- error("Error on NumberFormat::createPercentInstance()");
+ error("Error on NumberFormat::createPercentInstance().");
goto cleanupAndReturn;
}
@@ -1162,7 +1162,7 @@
} else if (haveDisplayedInfo[i] == FALSE) {
logln("Thread # %d is complete..", i);
if(tests[i].getError(theErr)) {
- errln(UnicodeString("#") + i + ": " + theErr);
+ dataerrln(UnicodeString("#") + i + ": " + theErr);
SimpleThread::errorFunc();
}
haveDisplayedInfo[i] = TRUE;
@@ -1317,7 +1317,7 @@
if (testFile == 0) {
*(buffer+bufLen) = 0;
- dataerrln("[DATA] could not open any of the conformance test files, tried opening base %s", buffer);
+ dataerrln("could not open any of the conformance test files, tried opening base %s", buffer);
return;
} else {
infoln(
@@ -1353,13 +1353,13 @@
}
fclose(testFile);
if(U_FAILURE(status)) {
- dataerrln("[DATA] Couldn't read the test file!");
+ dataerrln("Couldn't read the test file!");
return;
}
UCollator *coll = ucol_open("root", &status);
if(U_FAILURE(status)) {
- errln("Couldn't open UCA collator");
+ errcheckln(status, "Couldn't open UCA collator");
return;
}
ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
Modified: trunk/source/test/intltest/tsnmfmt.cpp
===================================================================
--- trunk/source/test/intltest/tsnmfmt.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tsnmfmt.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/***********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2004, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -150,7 +150,7 @@
{
if (U_FAILURE(fStatus))
{
- errln((UnicodeString)"**** FAIL: createXxxInstance failed.");
+ dataerrln((UnicodeString)"**** FAIL: createXxxInstance failed. - " + u_errorName(fStatus));
if (fFormat != 0)
errln("**** FAIL: Non-null format returned by createXxxInstance upon failure.");
delete fFormat;
@@ -401,7 +401,7 @@
logln(all);
}
else
- errln((UnicodeString)"**** FAIL: Zero available locales or null array pointer");
+ dataerrln((UnicodeString)"**** FAIL: Zero available locales or null array pointer");
}
void IntlTestNumberFormat::monsterTest(/* char* par */)
Modified: trunk/source/test/intltest/tufmtts.cpp
===================================================================
--- trunk/source/test/intltest/tufmtts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tufmtts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,205 +1,205 @@
-/********************************************************************
- * Copyright (c) 2008, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/tmunit.h"
-#include "unicode/tmutamt.h"
-#include "unicode/tmutfmt.h"
-#include "tufmtts.h"
-
-
-//TODO: put as compilation flag
-//#define TUFMTTS_DEBUG 1
-
-#ifdef TUFMTTS_DEBUG
-#include <iostream>
-#endif
-
-void TimeUnitTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) {
- if (exec) logln("TestSuite TimeUnitTest");
- switch (index) {
- TESTCASE(0, testBasic);
- TESTCASE(1, testAPI);
- default: name = ""; break;
- }
-}
-
-/**
- * Test basic
- */
-void TimeUnitTest::testBasic() {
- const char* locales[] = {"en", "sl", "fr", "zh", "ar", "ru", "zh_Hant"};
- for ( unsigned int locIndex = 0;
- locIndex < sizeof(locales)/sizeof(locales[0]);
- ++locIndex ) {
- UErrorCode status = U_ZERO_ERROR;
- Locale loc(locales[locIndex]);
- TimeUnitFormat** formats = new TimeUnitFormat*[2];
- formats[TimeUnitFormat::kFull] = new TimeUnitFormat(loc, status);
- if (!assertSuccess("TimeUnitFormat(full)", status)) return;
- formats[TimeUnitFormat::kAbbreviate] = new TimeUnitFormat(loc, TimeUnitFormat::kAbbreviate, status);
- if (!assertSuccess("TimeUnitFormat(short)", status)) return;
-#ifdef TUFMTTS_DEBUG
- std::cout << "locale: " << locales[locIndex] << "\n";
-#endif
- for (int style = TimeUnitFormat::kFull;
- style <= TimeUnitFormat::kAbbreviate;
- ++style) {
- for (TimeUnit::UTimeUnitFields j = TimeUnit::UTIMEUNIT_YEAR;
- j < TimeUnit::UTIMEUNIT_FIELD_COUNT;
- j = (TimeUnit::UTimeUnitFields)(j+1)) {
-#ifdef TUFMTTS_DEBUG
- std::cout << "time unit: " << j << "\n";
-#endif
- double tests[] = {0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 5, 10, 100, 101.35};
- for (unsigned int i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) {
-#ifdef TUFMTTS_DEBUG
- std::cout << "number: " << tests[i] << "\n";
-#endif
- TimeUnitAmount* source = new TimeUnitAmount(tests[i], j, status);
- if (!assertSuccess("TimeUnitAmount()", status)) return;
- UnicodeString formatted;
- Formattable formattable;
- formattable.adoptObject(source);
- formatted = ((Format*)formats[style])->format(formattable, formatted, status);
- if (!assertSuccess("format()", status)) return;
-#ifdef TUFMTTS_DEBUG
- char formatResult[1000];
- formatted.extract(0, formatted.length(), formatResult, "UTF-8");
- std::cout << "format result: " << formatResult << "\n";
-#endif
- Formattable result;
- ((Format*)formats[style])->parseObject(formatted, result, status);
- if (!assertSuccess("parseObject()", status)) return;
- if (result != formattable) {
- dataerrln("No round trip: ");
- }
- // other style parsing
- Formattable result_1;
- ((Format*)formats[1-style])->parseObject(formatted, result_1, status);
- if (!assertSuccess("parseObject()", status)) return;
- if (result_1 != formattable) {
- dataerrln("No round trip: ");
- }
- }
- }
- }
- delete formats[TimeUnitFormat::kFull];
- delete formats[TimeUnitFormat::kAbbreviate];
- delete[] formats;
- }
-}
-
-
-void TimeUnitTest::testAPI() {
- //================= TimeUnit =================
- UErrorCode status = U_ZERO_ERROR;
-
- TimeUnit* tmunit = TimeUnit::createInstance(TimeUnit::UTIMEUNIT_YEAR, status);
- if (!assertSuccess("TimeUnit::createInstance", status)) return;
-
- TimeUnit* another = (TimeUnit*)tmunit->clone();
- TimeUnit third(*tmunit);
- TimeUnit fourth = third;
-
- assertTrue("orig and clone are equal", (*tmunit == *another));
- assertTrue("copied and assigned are equal", (third == fourth));
-
- TimeUnit* tmunit_m = TimeUnit::createInstance(TimeUnit::UTIMEUNIT_MONTH, status);
- assertTrue("year != month", (*tmunit != *tmunit_m));
-
- TimeUnit::UTimeUnitFields field = tmunit_m->getTimeUnitField();
- assertTrue("field of month time unit is month", (field == TimeUnit::UTIMEUNIT_MONTH));
-
- delete tmunit;
- delete another;
- delete tmunit_m;
- //
- //================= TimeUnitAmount =================
-
- Formattable formattable((int32_t)2);
- TimeUnitAmount tma_long(formattable, TimeUnit::UTIMEUNIT_DAY, status);
- if (!assertSuccess("TimeUnitAmount(formattable...)", status)) return;
-
- formattable.setDouble(2);
- TimeUnitAmount tma_double(formattable, TimeUnit::UTIMEUNIT_DAY, status);
- if (!assertSuccess("TimeUnitAmount(formattable...)", status)) return;
-
- formattable.setDouble(3);
- TimeUnitAmount tma_double_3(formattable, TimeUnit::UTIMEUNIT_DAY, status);
- if (!assertSuccess("TimeUnitAmount(formattable...)", status)) return;
-
- TimeUnitAmount tma(2, TimeUnit::UTIMEUNIT_DAY, status);
- if (!assertSuccess("TimeUnitAmount(number...)", status)) return;
-
- TimeUnitAmount tma_h(2, TimeUnit::UTIMEUNIT_HOUR, status);
- if (!assertSuccess("TimeUnitAmount(number...)", status)) return;
-
- TimeUnitAmount second(tma);
- TimeUnitAmount third_tma = tma;
- TimeUnitAmount* fourth_tma = (TimeUnitAmount*)tma.clone();
-
- assertTrue("orig and copy are equal", (second == tma));
- assertTrue("clone and assigned are equal", (third_tma == *fourth_tma));
- assertTrue("different if number diff", (tma_double != tma_double_3));
- assertTrue("different if number type diff", (tma_double != tma_long));
- assertTrue("different if time unit diff", (tma != tma_h));
- assertTrue("same even different constructor", (tma_double == tma));
-
- assertTrue("getTimeUnitField", (tma.getTimeUnitField() == TimeUnit::UTIMEUNIT_DAY));
- delete fourth_tma;
- //
- //================= TimeUnitFormat =================
- //
- TimeUnitFormat* tmf_en = new TimeUnitFormat(Locale("en"), status);
- if (!assertSuccess("TimeUnitFormat(en...)", status)) return;
- TimeUnitFormat tmf_fr(Locale("fr"), status);
- if (!assertSuccess("TimeUnitFormat(fr...)", status)) return;
-
- assertTrue("TimeUnitFormat: en and fr diff", (*tmf_en != tmf_fr));
-
- TimeUnitFormat tmf_assign = *tmf_en;
- assertTrue("TimeUnitFormat: orig and assign are equal", (*tmf_en == tmf_assign));
-
- TimeUnitFormat tmf_copy(tmf_fr);
- assertTrue("TimeUnitFormat: orig and copy are equal", (tmf_fr == tmf_copy));
-
- TimeUnitFormat* tmf_clone = (TimeUnitFormat*)tmf_en->clone();
- assertTrue("TimeUnitFormat: orig and clone are equal", (*tmf_en == *tmf_clone));
- delete tmf_clone;
-
- tmf_en->setLocale(Locale("fr"), status);
- if (!assertSuccess("setLocale(fr...)", status)) return;
-
- NumberFormat* numberFmt = NumberFormat::createInstance(
- Locale("fr"), status);
- if (!assertSuccess("NumberFormat::createInstance()", status)) return;
- tmf_en->setNumberFormat(*numberFmt, status);
- if (!assertSuccess("setNumberFormat(en...)", status)) return;
- assertTrue("TimeUnitFormat: setLocale", (*tmf_en == tmf_fr));
-
- delete tmf_en;
-
- TimeUnitFormat* en_long = new TimeUnitFormat(Locale("en"), TimeUnitFormat::kFull, status);
- if (!assertSuccess("TimeUnitFormat(en...)", status)) return;
- delete en_long;
-
- TimeUnitFormat* en_short = new TimeUnitFormat(Locale("en"), TimeUnitFormat::kAbbreviate, status);
- if (!assertSuccess("TimeUnitFormat(en...)", status)) return;
- delete en_short;
-
- TimeUnitFormat* format = new TimeUnitFormat(status);
- format->setLocale(Locale("zh"), status);
- format->setNumberFormat(*numberFmt, status);
- if (!assertSuccess("TimeUnitFormat(en...)", status)) return;
- delete numberFmt;
- delete format;
-}
-
-
-#endif
+/********************************************************************
+ * Copyright (c) 2008-2009, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ ********************************************************************/
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/tmunit.h"
+#include "unicode/tmutamt.h"
+#include "unicode/tmutfmt.h"
+#include "tufmtts.h"
+
+
+//TODO: put as compilation flag
+//#define TUFMTTS_DEBUG 1
+
+#ifdef TUFMTTS_DEBUG
+#include <iostream>
+#endif
+
+void TimeUnitTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) {
+ if (exec) logln("TestSuite TimeUnitTest");
+ switch (index) {
+ TESTCASE(0, testBasic);
+ TESTCASE(1, testAPI);
+ default: name = ""; break;
+ }
+}
+
+/**
+ * Test basic
+ */
+void TimeUnitTest::testBasic() {
+ const char* locales[] = {"en", "sl", "fr", "zh", "ar", "ru", "zh_Hant"};
+ for ( unsigned int locIndex = 0;
+ locIndex < sizeof(locales)/sizeof(locales[0]);
+ ++locIndex ) {
+ UErrorCode status = U_ZERO_ERROR;
+ Locale loc(locales[locIndex]);
+ TimeUnitFormat** formats = new TimeUnitFormat*[2];
+ formats[TimeUnitFormat::kFull] = new TimeUnitFormat(loc, status);
+ if (!assertSuccess("TimeUnitFormat(full)", status, TRUE)) return;
+ formats[TimeUnitFormat::kAbbreviate] = new TimeUnitFormat(loc, TimeUnitFormat::kAbbreviate, status);
+ if (!assertSuccess("TimeUnitFormat(short)", status)) return;
+#ifdef TUFMTTS_DEBUG
+ std::cout << "locale: " << locales[locIndex] << "\n";
+#endif
+ for (int style = TimeUnitFormat::kFull;
+ style <= TimeUnitFormat::kAbbreviate;
+ ++style) {
+ for (TimeUnit::UTimeUnitFields j = TimeUnit::UTIMEUNIT_YEAR;
+ j < TimeUnit::UTIMEUNIT_FIELD_COUNT;
+ j = (TimeUnit::UTimeUnitFields)(j+1)) {
+#ifdef TUFMTTS_DEBUG
+ std::cout << "time unit: " << j << "\n";
+#endif
+ double tests[] = {0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 5, 10, 100, 101.35};
+ for (unsigned int i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) {
+#ifdef TUFMTTS_DEBUG
+ std::cout << "number: " << tests[i] << "\n";
+#endif
+ TimeUnitAmount* source = new TimeUnitAmount(tests[i], j, status);
+ if (!assertSuccess("TimeUnitAmount()", status)) return;
+ UnicodeString formatted;
+ Formattable formattable;
+ formattable.adoptObject(source);
+ formatted = ((Format*)formats[style])->format(formattable, formatted, status);
+ if (!assertSuccess("format()", status)) return;
+#ifdef TUFMTTS_DEBUG
+ char formatResult[1000];
+ formatted.extract(0, formatted.length(), formatResult, "UTF-8");
+ std::cout << "format result: " << formatResult << "\n";
+#endif
+ Formattable result;
+ ((Format*)formats[style])->parseObject(formatted, result, status);
+ if (!assertSuccess("parseObject()", status)) return;
+ if (result != formattable) {
+ dataerrln("No round trip: ");
+ }
+ // other style parsing
+ Formattable result_1;
+ ((Format*)formats[1-style])->parseObject(formatted, result_1, status);
+ if (!assertSuccess("parseObject()", status)) return;
+ if (result_1 != formattable) {
+ dataerrln("No round trip: ");
+ }
+ }
+ }
+ }
+ delete formats[TimeUnitFormat::kFull];
+ delete formats[TimeUnitFormat::kAbbreviate];
+ delete[] formats;
+ }
+}
+
+
+void TimeUnitTest::testAPI() {
+ //================= TimeUnit =================
+ UErrorCode status = U_ZERO_ERROR;
+
+ TimeUnit* tmunit = TimeUnit::createInstance(TimeUnit::UTIMEUNIT_YEAR, status);
+ if (!assertSuccess("TimeUnit::createInstance", status)) return;
+
+ TimeUnit* another = (TimeUnit*)tmunit->clone();
+ TimeUnit third(*tmunit);
+ TimeUnit fourth = third;
+
+ assertTrue("orig and clone are equal", (*tmunit == *another));
+ assertTrue("copied and assigned are equal", (third == fourth));
+
+ TimeUnit* tmunit_m = TimeUnit::createInstance(TimeUnit::UTIMEUNIT_MONTH, status);
+ assertTrue("year != month", (*tmunit != *tmunit_m));
+
+ TimeUnit::UTimeUnitFields field = tmunit_m->getTimeUnitField();
+ assertTrue("field of month time unit is month", (field == TimeUnit::UTIMEUNIT_MONTH));
+
+ delete tmunit;
+ delete another;
+ delete tmunit_m;
+ //
+ //================= TimeUnitAmount =================
+
+ Formattable formattable((int32_t)2);
+ TimeUnitAmount tma_long(formattable, TimeUnit::UTIMEUNIT_DAY, status);
+ if (!assertSuccess("TimeUnitAmount(formattable...)", status)) return;
+
+ formattable.setDouble(2);
+ TimeUnitAmount tma_double(formattable, TimeUnit::UTIMEUNIT_DAY, status);
+ if (!assertSuccess("TimeUnitAmount(formattable...)", status)) return;
+
+ formattable.setDouble(3);
+ TimeUnitAmount tma_double_3(formattable, TimeUnit::UTIMEUNIT_DAY, status);
+ if (!assertSuccess("TimeUnitAmount(formattable...)", status)) return;
+
+ TimeUnitAmount tma(2, TimeUnit::UTIMEUNIT_DAY, status);
+ if (!assertSuccess("TimeUnitAmount(number...)", status)) return;
+
+ TimeUnitAmount tma_h(2, TimeUnit::UTIMEUNIT_HOUR, status);
+ if (!assertSuccess("TimeUnitAmount(number...)", status)) return;
+
+ TimeUnitAmount second(tma);
+ TimeUnitAmount third_tma = tma;
+ TimeUnitAmount* fourth_tma = (TimeUnitAmount*)tma.clone();
+
+ assertTrue("orig and copy are equal", (second == tma));
+ assertTrue("clone and assigned are equal", (third_tma == *fourth_tma));
+ assertTrue("different if number diff", (tma_double != tma_double_3));
+ assertTrue("different if number type diff", (tma_double != tma_long));
+ assertTrue("different if time unit diff", (tma != tma_h));
+ assertTrue("same even different constructor", (tma_double == tma));
+
+ assertTrue("getTimeUnitField", (tma.getTimeUnitField() == TimeUnit::UTIMEUNIT_DAY));
+ delete fourth_tma;
+ //
+ //================= TimeUnitFormat =================
+ //
+ TimeUnitFormat* tmf_en = new TimeUnitFormat(Locale("en"), status);
+ if (!assertSuccess("TimeUnitFormat(en...)", status, TRUE)) return;
+ TimeUnitFormat tmf_fr(Locale("fr"), status);
+ if (!assertSuccess("TimeUnitFormat(fr...)", status)) return;
+
+ assertTrue("TimeUnitFormat: en and fr diff", (*tmf_en != tmf_fr));
+
+ TimeUnitFormat tmf_assign = *tmf_en;
+ assertTrue("TimeUnitFormat: orig and assign are equal", (*tmf_en == tmf_assign));
+
+ TimeUnitFormat tmf_copy(tmf_fr);
+ assertTrue("TimeUnitFormat: orig and copy are equal", (tmf_fr == tmf_copy));
+
+ TimeUnitFormat* tmf_clone = (TimeUnitFormat*)tmf_en->clone();
+ assertTrue("TimeUnitFormat: orig and clone are equal", (*tmf_en == *tmf_clone));
+ delete tmf_clone;
+
+ tmf_en->setLocale(Locale("fr"), status);
+ if (!assertSuccess("setLocale(fr...)", status)) return;
+
+ NumberFormat* numberFmt = NumberFormat::createInstance(
+ Locale("fr"), status);
+ if (!assertSuccess("NumberFormat::createInstance()", status)) return;
+ tmf_en->setNumberFormat(*numberFmt, status);
+ if (!assertSuccess("setNumberFormat(en...)", status)) return;
+ assertTrue("TimeUnitFormat: setLocale", (*tmf_en == tmf_fr));
+
+ delete tmf_en;
+
+ TimeUnitFormat* en_long = new TimeUnitFormat(Locale("en"), TimeUnitFormat::kFull, status);
+ if (!assertSuccess("TimeUnitFormat(en...)", status)) return;
+ delete en_long;
+
+ TimeUnitFormat* en_short = new TimeUnitFormat(Locale("en"), TimeUnitFormat::kAbbreviate, status);
+ if (!assertSuccess("TimeUnitFormat(en...)", status)) return;
+ delete en_short;
+
+ TimeUnitFormat* format = new TimeUnitFormat(status);
+ format->setLocale(Locale("zh"), status);
+ format->setNumberFormat(*numberFmt, status);
+ if (!assertSuccess("TimeUnitFormat(en...)", status)) return;
+ delete numberFmt;
+ delete format;
+}
+
+
+#endif
Modified: trunk/source/test/intltest/tufmtts.h
===================================================================
--- trunk/source/test/intltest/tufmtts.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tufmtts.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,37 +1,37 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 2008, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
-#ifndef __INTLTESTTIMEUNITTEST__
-#define __INTLTESTTIMEUNITTEST__
-
-
-#if !UCONFIG_NO_FORMATTING
-
-#include "unicode/utypes.h"
-#include "unicode/locid.h"
-#include "intltest.h"
-
-/**
- * Test basic functionality of various API functions
- **/
-class TimeUnitTest: public IntlTest {
- void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
-
-public:
- /**
- * Performs basic tests
- **/
- void testBasic();
-
- /**
- * Performs API tests
- **/
- void testAPI();
-};
-
-#endif /* #if !UCONFIG_NO_FORMATTING */
-
-#endif
+/********************************************************************
+ * COPYRIGHT:
+ * Copyright (c) 2008, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ ********************************************************************/
+
+#ifndef __INTLTESTTIMEUNITTEST__
+#define __INTLTESTTIMEUNITTEST__
+
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/utypes.h"
+#include "unicode/locid.h"
+#include "intltest.h"
+
+/**
+ * Test basic functionality of various API functions
+ **/
+class TimeUnitTest: public IntlTest {
+ void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
+
+public:
+ /**
+ * Performs basic tests
+ **/
+ void testBasic();
+
+ /**
+ * Performs API tests
+ **/
+ void testAPI();
+};
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
Modified: trunk/source/test/intltest/tzbdtest.cpp
===================================================================
--- trunk/source/test/intltest/tzbdtest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tzbdtest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/***********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2006, International Business Machines Corporation
+ * Copyright (c) 1997-2009, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@@ -97,7 +97,7 @@
mindelta <= INTERVAL &&
maxdelta >= 0 &&
maxdelta <= INTERVAL) logln(UnicodeString("PASS: Expected boundary at ") + expectedBoundary);
- else errln(UnicodeString("FAIL: Expected boundary at ") + expectedBoundary);
+ else dataerrln(UnicodeString("FAIL: Expected boundary at ") + expectedBoundary);
}
// -------------------------------------
@@ -120,12 +120,12 @@
UDate min = d;
UDate max = min + SIX_MONTHS;
if (tz->inDaylightTime(d, status) != startsInDST) {
- errln("FAIL: " + tz->getID(str) + " inDaylightTime(" + dateToString(d) + ") != " + (startsInDST ? "true" : "false"));
+ dataerrln("FAIL: " + tz->getID(str) + " inDaylightTime(" + dateToString(d) + ") != " + (startsInDST ? "true" : "false"));
startsInDST = !startsInDST;
}
if (failure(status, "TimeZone::inDaylightTime")) return;
if (tz->inDaylightTime(max, status) == startsInDST) {
- errln("FAIL: " + tz->getID(str) + " inDaylightTime(" + dateToString(max) + ") != " + (startsInDST ? "false" : "true"));
+ dataerrln("FAIL: " + tz->getID(str) + " inDaylightTime(" + dateToString(max) + ") != " + (startsInDST ? "false" : "true"));
return;
}
if (failure(status, "TimeZone::inDaylightTime")) return;
@@ -194,17 +194,17 @@
if (time_zone->inDaylightTime(d, status) == expInDaylightTime)
logln(UnicodeString("PASS: inDaylightTime = ") + (time_zone->inDaylightTime(d, status)?"true":"false"));
else
- errln(UnicodeString("FAIL: inDaylightTime = ") + (time_zone->inDaylightTime(d, status)?"true":"false"));
+ dataerrln(UnicodeString("FAIL: inDaylightTime = ") + (time_zone->inDaylightTime(d, status)?"true":"false"));
if (failure(status, "TimeZone::inDaylightTime"))
return;
if (time_zone->useDaylightTime() == expUseDaylightTime)
logln(UnicodeString("PASS: useDaylightTime = ") + (time_zone->useDaylightTime()?"true":"false"));
else
- errln(UnicodeString("FAIL: useDaylightTime = ") + (time_zone->useDaylightTime()?"true":"false"));
+ dataerrln(UnicodeString("FAIL: useDaylightTime = ") + (time_zone->useDaylightTime()?"true":"false"));
if (time_zone->getRawOffset() == expZoneOffset)
logln(UnicodeString("PASS: getRawOffset() = ") + (expZoneOffset / ONE_HOUR));
else
- errln(UnicodeString("FAIL: getRawOffset() = ") + (time_zone->getRawOffset() / ONE_HOUR) + "; expected " + (expZoneOffset / ONE_HOUR));
+ dataerrln(UnicodeString("FAIL: getRawOffset() = ") + (time_zone->getRawOffset() / ONE_HOUR) + "; expected " + (expZoneOffset / ONE_HOUR));
GregorianCalendar *gc = new GregorianCalendar(time_zone->clone(), status);
gc->setTime(d, status);
@@ -216,7 +216,7 @@
status);
if (failure(status, "GregorianCalendar::get")) return;
if (offset == expDSTOffset) logln(UnicodeString("PASS: getOffset() = ") + (offset / ONE_HOUR));
- else errln(UnicodeString("FAIL: getOffset() = ") + (offset / ONE_HOUR) + "; expected " + (expDSTOffset / ONE_HOUR));
+ else dataerrln(UnicodeString("FAIL: getOffset() = ") + (offset / ONE_HOUR) + "; expected " + (expDSTOffset / ONE_HOUR));
delete gc;
}
@@ -242,7 +242,7 @@
logln(UnicodeString("Ok: ") + year + "/" + (month+1) + "/" + dom + " " + hour + ":00 => " +
e + " (" + ed + ")");
} else {
- errln(UnicodeString("FAIL: ") + year + "/" + (month+1) + "/" + dom + " " + hour + ":00 => " +
+ dataerrln(UnicodeString("FAIL: ") + year + "/" + (month+1) + "/" + dom + " " + hour + ":00 => " +
e + " (" + (e * H) + ")" +
", expected " + epochHours + " (" + ed + ")");
}
@@ -257,7 +257,7 @@
cal.get(UCAL_DATE, status) + " " +
cal.get(UCAL_MILLISECOND, status)/H);
} else {
- errln(UnicodeString("FAIL: ") + epochHours + " (" + ed + ") => " +
+ dataerrln(UnicodeString("FAIL: ") + epochHours + " (" + ed + ") => " +
cal.get(UCAL_YEAR, status) + "/" +
(cal.get(UCAL_MONTH, status)+1) + "/" +
cal.get(UCAL_DATE, status) + " " +
@@ -478,7 +478,7 @@
errln("FAIL: useDaylightTime false but 2 changes seen");
}
if (changes != expectedChanges) {
- errln(UnicodeString("FAIL: ") + changes + " changes seen; expected " + expectedChanges);
+ dataerrln(UnicodeString("FAIL: ") + changes + " changes seen; expected " + expectedChanges);
}
}
Modified: trunk/source/test/intltest/tzfmttst.cpp
===================================================================
--- trunk/source/test/intltest/tzfmttst.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tzfmttst.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -115,8 +115,8 @@
SimpleDateFormat *sdf = new SimpleDateFormat((UnicodeString)PATTERNS[patidx], LOCALES[locidx], status);
if (U_FAILURE(status)) {
- errln((UnicodeString)"new SimpleDateFormat failed for pattern " +
- PATTERNS[patidx] + " for locale " + LOCALES[locidx].getName());
+ errcheckln(status, (UnicodeString)"new SimpleDateFormat failed for pattern " +
+ PATTERNS[patidx] + " for locale " + LOCALES[locidx].getName() + " - " + u_errorName(status));
status = U_ZERO_ERROR;
continue;
}
@@ -337,8 +337,8 @@
SimpleDateFormat *sdf = new SimpleDateFormat(pattern, LOCALES[locidx], status);
if (U_FAILURE(status)) {
- errln((UnicodeString)"new SimpleDateFormat failed for pattern " +
- pattern + " for locale " + LOCALES[locidx].getName());
+ errcheckln(status, (UnicodeString)"new SimpleDateFormat failed for pattern " +
+ pattern + " for locale " + LOCALES[locidx].getName() + " - " + u_errorName(status));
status = U_ZERO_ERROR;
continue;
}
Modified: trunk/source/test/intltest/tzoffloc.cpp
===================================================================
--- trunk/source/test/intltest/tzoffloc.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tzoffloc.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 2007, International Business Machines Corporation and *
+* Copyright (C) 2007-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -193,7 +193,7 @@
SimpleDateFormat df(UnicodeString("yyyy-MM-dd HH:mm:ss"), status);
if (U_FAILURE(status)) {
- errln("Failed to initialize a SimpleDateFormat");
+ errcheckln(status, "Failed to initialize a SimpleDateFormat - %s", u_errorName(status));
}
df.setTimeZone(*utc);
UnicodeString dateStr;
@@ -210,7 +210,7 @@
} else if (offset != OFFSETS1[d]) {
dateStr.remove();
df.format(MILLIS[d], dateStr);
- errln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dataerrln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dateStr + "(standard) - Got: " + offset + " Expected: " + OFFSETS1[d]);
}
}
@@ -227,7 +227,7 @@
} else if (rawOffset != OFFSETS2[m][0] || dstOffset != OFFSETS2[m][1]) {
dateStr.remove();
df.format(MILLIS[m], dateStr);
- errln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dataerrln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dateStr + "(wall) - Got: "
+ rawOffset + "/" + dstOffset
+ " Expected: " + OFFSETS2[m][0] + "/" + OFFSETS2[m][1]);
@@ -248,7 +248,7 @@
} else if (rawOffset != OFFSETS2[m][0] || dstOffset != OFFSETS2[m][1]) {
dateStr.remove();
df.format(MILLIS[m], dateStr);
- errln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dataerrln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dateStr + "(wall/kStandard/kStandard) - Got: "
+ rawOffset + "/" + dstOffset
+ " Expected: " + OFFSETS2[m][0] + "/" + OFFSETS2[m][1]);
@@ -269,7 +269,7 @@
} else if (rawOffset != OFFSETS3[m][0] || dstOffset != OFFSETS3[m][1]) {
dateStr.remove();
df.format(MILLIS[m], dateStr);
- errln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dataerrln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dateStr + "(wall/kDaylight/kDaylight) - Got: "
+ rawOffset + "/" + dstOffset
+ " Expected: " + OFFSETS3[m][0] + "/" + OFFSETS3[m][1]);
@@ -290,7 +290,7 @@
} else if (rawOffset != OFFSETS2[m][0] || dstOffset != OFFSETS2[m][1]) {
dateStr.remove();
df.format(MILLIS[m], dateStr);
- errln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dataerrln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dateStr + "(wall/kFormer/kLatter) - Got: "
+ rawOffset + "/" + dstOffset
+ " Expected: " + OFFSETS2[m][0] + "/" + OFFSETS2[m][1]);
@@ -311,7 +311,7 @@
} else if (rawOffset != OFFSETS3[m][0] || dstOffset != OFFSETS3[m][1]) {
dateStr.remove();
df.format(MILLIS[m], dateStr);
- errln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dataerrln((UnicodeString)"Bad offset returned by TESTZONES[" + i + "] at "
+ dateStr + "(wall/kLatter/kFormer) - Got: "
+ rawOffset + "/" + dstOffset
+ " Expected: " + OFFSETS3[m][0] + "/" + OFFSETS3[m][1]);
Modified: trunk/source/test/intltest/tzregts.cpp
===================================================================
--- trunk/source/test/intltest/tzregts.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tzregts.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,5 +1,5 @@
/********************************************************************
- * Copyright (c) 1997-2007, International Business Machines
+ * Copyright (c) 1997-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
@@ -147,7 +147,7 @@
SimpleDateFormat sdf((UnicodeString)"E d MMM yyyy G HH:mm", status);
if(U_FAILURE(status)) {
- errln("Error creating date format %s", u_errorName(status));
+ errcheckln(status, "Error creating date format %s", u_errorName(status));
return;
}
sdf.setCalendar(cal);
@@ -237,7 +237,7 @@
int32_t SToffset = (int32_t)(-8 * 60*60*1000L);
int32_t DToffset = (int32_t)(-7 * 60*60*1000L);
-#define ERR_IF_FAIL(x) if(x) { errln("FAIL: TimeZone misbehaving - %s", #x); }
+#define ERR_IF_FAIL(x) if(x) { dataerrln("FAIL: TimeZone misbehaving - %s", #x); }
ERR_IF_FAIL(U_FAILURE(status))
ERR_IF_FAIL(offset1 != SToffset)
@@ -464,7 +464,7 @@
//Date dt = new Date(1998-1900, Calendar::APRIL, 5, 10, 0);
if (! tz->useDaylightTime() || U_FAILURE(status))
- errln("We're not in Daylight Savings Time and we should be.\n");
+ dataerrln("We're not in Daylight Savings Time and we should be. - %s", u_errorName(status));
//cal.setTime(dt);
int32_t era = cal->get(UCAL_ERA, status);
@@ -852,7 +852,7 @@
UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat *fmt = new SimpleDateFormat("z", Locale::getUS(), status);
if(U_FAILURE(status)) {
- errln("Error creating calendar %s", u_errorName(status));
+ errcheckln(status, "Error creating calendar %s", u_errorName(status));
delete fmt;
return;
}
@@ -1046,7 +1046,7 @@
// Make sure we got valid zones
if (zoneWith->getID(str) != UnicodeString(idWithLocaleData) ||
zoneWithout->getID(str) != UnicodeString(idWithoutLocaleData)) {
- errln(UnicodeString("Fail: Unable to create zones - wanted ") + idWithLocaleData + ", got " + zoneWith->getID(str) + ", and wanted " + idWithoutLocaleData + " but got " + zoneWithout->getID(str));
+ dataerrln(UnicodeString("Fail: Unable to create zones - wanted ") + idWithLocaleData + ", got " + zoneWith->getID(str) + ", and wanted " + idWithoutLocaleData + " but got " + zoneWithout->getID(str));
} else {
GregorianCalendar calWith(*zoneWith, status);
GregorianCalendar calWithout(*zoneWithout, status);
Modified: trunk/source/test/intltest/tzrulets.cpp
===================================================================
--- trunk/source/test/intltest/tzrulets.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tzrulets.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -25,6 +25,8 @@
#define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
#define HOUR (60*60*1000)
+static const UVersionInfo ICU_432 = {4,3,2,0};
+
static const char *const TESTZIDS[] = {
"AGT",
"America/New_York",
@@ -498,7 +500,7 @@
UDate jan1_2010 = getUTCMillis(2010, UCAL_JANUARY, 1);
if (!ny->hasEquivalentTransitions(*rbtz, jan1_1967, jan1_2010, TRUE, status)) {
- errln("FAIL: The RBTZ must be equivalent to America/New_York between 1967 and 2010");
+ dataerrln("FAIL: The RBTZ must be equivalent to America/New_York between 1967 and 2010");
}
if (U_FAILURE(status)) {
errln("FAIL: error returned from hasEquivalentTransitions for ny/rbtz 1967-2010");
@@ -512,7 +514,7 @@
// Same with above, but calling RBTZ#hasEquivalentTransitions against OlsonTimeZone
if (!rbtz->hasEquivalentTransitions(*ny, jan1_1967, jan1_2010, TRUE, status)) {
- errln("FAIL: The RBTZ must be equivalent to America/New_York between 1967 and 2010");
+ dataerrln("FAIL: The RBTZ must be equivalent to America/New_York between 1967 and 2010 ");
}
if (U_FAILURE(status)) {
errln("FAIL: error returned from hasEquivalentTransitions for rbtz/ny 1967-2010");
@@ -559,12 +561,12 @@
errln("FAIL: ny->getOffset failed");
}
if (offset1 != offset2 || dst1 != dst2) {
- errln("FAIL: Incompatible time zone offset/dstSavings for ny and rbtz");
+ dataerrln("FAIL: Incompatible time zone offset/dstSavings for ny and rbtz");
}
// Check inDaylightTime
if (rbtz->inDaylightTime(times[i], status) != ny->inDaylightTime(times[i], status)) {
- errln("FAIL: Incompatible daylight saving time for ny and rbtz");
+ dataerrln("FAIL: Incompatible daylight saving time for ny and rbtz");
}
if (U_FAILURE(status)) {
errln("FAIL: inDaylightTime failed");
@@ -696,7 +698,7 @@
UDate jan1_2011 = getUTCMillis(2010, UCAL_JANUARY, 1);
if (newyork->hasEquivalentTransitions(*indianapolis, jan1_2005, jan1_2011, TRUE, status)) {
- errln("FAIL: New_York is not equivalent to Indianapolis between 2005 and 2010");
+ dataerrln("FAIL: New_York is not equivalent to Indianapolis between 2005 and 2010");
}
if (U_FAILURE(status)) {
errln("FAIL: error status is returned from hasEquivalentTransition");
@@ -715,7 +717,7 @@
errln("FAIL: error status is returned from hasEquivalentTransition");
}
if (indianapolis->hasEquivalentTransitions(*gmt_5, jan1_1971, jan1_2007, TRUE, status)) {
- errln("FAIL: Indianapolis is not equivalent to GMT+5 between 1971 and 2006");
+ dataerrln("FAIL: Indianapolis is not equivalent to GMT+5 between 1971 and 2006");
}
if (U_FAILURE(status)) {
errln("FAIL: error status is returned from hasEquivalentTransition");
@@ -740,7 +742,7 @@
// raw offsets are different
BasicTimeZone *losangeles = (BasicTimeZone*)TimeZone::createTimeZone("America/Los_Angeles");
if (newyork->hasEquivalentTransitions(*losangeles, jan1_2006, jan1_2011, TRUE, status)) {
- errln("FAIL: New_York is not equivalent to Los Angeles, but returned true");
+ dataerrln("FAIL: New_York is not equivalent to Los Angeles, but returned true");
}
if (U_FAILURE(status)) {
errln("FAIL: error status is returned from hasEquivalentTransition for newyork/losangeles");
@@ -773,6 +775,12 @@
errln("FAIL: error returned while enumerating timezone IDs.");
break;
}
+ if (!isICUVersionAtLeast(ICU_432)) {
+ // See ticket#7008
+ if (*tzid == UnicodeString("Asia/Amman")) {
+ continue;
+ }
+ }
BasicTimeZone *tz = (BasicTimeZone*)TimeZone::createTimeZone(*tzid);
VTimeZone *vtz_org = VTimeZone::createVTimeZoneByID(*tzid);
vtz_org->setTZURL("http://source.icu-project.org/timezone");
@@ -866,6 +874,12 @@
errln("FAIL: error returned while enumerating timezone IDs.");
break;
}
+ if (!isICUVersionAtLeast(ICU_432)) {
+ // See ticket#7008
+ if (*tzid == UnicodeString("Asia/Amman")) {
+ continue;
+ }
+ }
BasicTimeZone *tz = (BasicTimeZone*)TimeZone::createTimeZone(*tzid);
VTimeZone *vtz_org = VTimeZone::createVTimeZoneByID(*tzid);
VTimeZone *vtz_new = NULL;
@@ -1697,12 +1711,12 @@
UBool btr1 = otz->getNextTransition(base, TRUE, tzt1);
UBool btr2 = vtz->getNextTransition(base, TRUE, tzt2);
if (!btr1 || !btr2 || tzt1 != tzt2) {
- errln("FAIL: getNextTransition returned different results in VTimeZone and OlsonTimeZone");
+ dataerrln("FAIL: getNextTransition returned different results in VTimeZone and OlsonTimeZone");
}
btr1 = otz->getPreviousTransition(base, FALSE, tzt1);
btr2 = vtz->getPreviousTransition(base, FALSE, tzt2);
if (!btr1 || !btr2 || tzt1 != tzt2) {
- errln("FAIL: getPreviousTransition returned different results in VTimeZone and OlsonTimeZone");
+ dataerrln("FAIL: getPreviousTransition returned different results in VTimeZone and OlsonTimeZone");
}
// TimeZoneTransition constructor/clone
Modified: trunk/source/test/intltest/tztest.cpp
===================================================================
--- trunk/source/test/intltest/tztest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/tztest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -131,7 +131,7 @@
UErrorCode status = U_ZERO_ERROR;
const char* tzver = TimeZone::getTZDataVersion(status);
if (U_FAILURE(status)) {
- errln("FAIL: getTZDataVersion failed");
+ errcheckln(status, "FAIL: getTZDataVersion failed - %s", u_errorName(status));
} else if (uprv_strlen(tzver) != 5 /* 4 digits + 1 letter */) {
errln((UnicodeString)"FAIL: getTZDataVersion returned " + tzver);
} else {
@@ -304,7 +304,7 @@
double foundOffset = tz->getRawOffset();
int32_t foundHour = (int32_t)foundOffset / millisPerHour;
if (expectedOffset != foundOffset) {
- errln("FAIL: Offset for PRT should be %d, found %d", expectedHour, foundHour);
+ dataerrln("FAIL: Offset for PRT should be %d, found %d", expectedHour, foundHour);
} else {
logln("PASS: Offset for PRT should be %d, found %d", expectedHour, foundHour);
}
@@ -325,17 +325,17 @@
UDate d = date(97, UCAL_APRIL, 30);
UnicodeString str;
logln("The timezone is " + time_zone->getID(str));
- if (!time_zone->inDaylightTime(d, status)) errln("FAIL: inDaylightTime returned FALSE");
+ if (!time_zone->inDaylightTime(d, status)) dataerrln("FAIL: inDaylightTime returned FALSE");
if (U_FAILURE(status)) { errln("FAIL: TimeZone::inDaylightTime failed"); return; }
- if (!time_zone->useDaylightTime()) errln("FAIL: useDaylightTime returned FALSE");
- if (time_zone->getRawOffset() != - 8 * millisPerHour) errln("FAIL: getRawOffset returned wrong value");
+ if (!time_zone->useDaylightTime()) dataerrln("FAIL: useDaylightTime returned FALSE");
+ if (time_zone->getRawOffset() != - 8 * millisPerHour) dataerrln("FAIL: getRawOffset returned wrong value");
GregorianCalendar *gc = new GregorianCalendar(status);
if (U_FAILURE(status)) { errln("FAIL: Couldn't create GregorianCalendar"); return; }
gc->setTime(d, status);
if (U_FAILURE(status)) { errln("FAIL: GregorianCalendar::setTime failed"); return; }
if (time_zone->getOffset(gc->AD, gc->get(UCAL_YEAR, status), gc->get(UCAL_MONTH, status),
gc->get(UCAL_DATE, status), (uint8_t)gc->get(UCAL_DAY_OF_WEEK, status), 0, status) != - 7 * millisPerHour)
- errln("FAIL: getOffset returned wrong value");
+ dataerrln("FAIL: getOffset returned wrong value");
if (U_FAILURE(status)) { errln("FAIL: GregorianCalendar::set failed"); return; }
delete gc;
delete time_zone;
@@ -964,7 +964,7 @@
// JDK 1.4 creates custom zones with IDs of the form "GMT+02:00"
// ICU creates custom zones with IDs of the form "GMT+02:00"
else if (exp != kUnparseable && (ioffset != exp || itsID != expectedID)) {
- errln("Expected offset of " + formatOffset(exp, temp) +
+ dataerrln("Expected offset of " + formatOffset(exp, temp) +
", id " + expectedID +
", for " + id +
", got offset of " + offset +
@@ -1168,7 +1168,7 @@
zone->getDisplayName(Locale::getEnglish(), name);
logln("PST->" + name);
if (name.compare("Pacific Standard Time") != 0)
- errln("Fail: Expected \"Pacific Standard Time\" but got " + name);
+ dataerrln("Fail: Expected \"Pacific Standard Time\" but got " + name);
//*****************************************************************
// THE FOLLOWING LINES MUST BE UPDATED IF THE LOCALE DATA CHANGES
@@ -1196,7 +1196,7 @@
kData[i].style,
Locale::getEnglish(), name);
if (name.compare(kData[i].expect) != 0)
- errln("Fail: Expected " + UnicodeString(kData[i].expect) + "; got " + name);
+ dataerrln("Fail: Expected " + UnicodeString(kData[i].expect) + "; got " + name);
logln("PST [with options]->" + name);
}
for (i=0; kData[i].expect[0] != '\0'; i++)
@@ -1205,7 +1205,7 @@
name = zone->getDisplayName(kData[i].useDst,
kData[i].style, name);
if (name.compare(kData[i].expect) != 0)
- errln("Fail: Expected " + UnicodeString(kData[i].expect) + "; got " + name);
+ dataerrln("Fail: Expected " + UnicodeString(kData[i].expect) + "; got " + name);
logln("PST [with options]->" + name);
}
@@ -1232,7 +1232,7 @@
name = zone2->getDisplayName(Locale::getEnglish(),name);
logln("Modified PST->" + name);
if (name.compare("Pacific Standard Time") != 0)
- errln("Fail: Expected \"Pacific Standard Time\"");
+ dataerrln("Fail: Expected \"Pacific Standard Time\"");
// Make sure we get the default display format for Locales
// with no display name data.
@@ -1252,7 +1252,7 @@
ResourceBundle enRB(NULL,
Locale::getEnglish(), status);
if(U_FAILURE(status))
- errln("Couldn't get ResourceBundle for en");
+ errcheckln(status, "Couldn't get ResourceBundle for en - %s", u_errorName(status));
ResourceBundle mtRB(NULL,
mt_MT, status);
@@ -1264,7 +1264,7 @@
if (noZH) {
logln("Warning: Not testing the mt_MT behavior because resource is absent");
if (name != "Pacific Standard Time")
- errln("Fail: Expected Pacific Standard Time");
+ dataerrln("Fail: Expected Pacific Standard Time");
}
@@ -1272,10 +1272,10 @@
name.compare("GMT-8:00") &&
name.compare("GMT-0800") &&
name.compare("GMT-800")) {
- errln(UnicodeString("Fail: Expected GMT-08:00 or something similar for PST in mt_MT but got ") + name );
- errln("************************************************************");
- errln("THE ABOVE FAILURE MAY JUST MEAN THE LOCALE DATA HAS CHANGED");
- errln("************************************************************");
+ dataerrln(UnicodeString("Fail: Expected GMT-08:00 or something similar for PST in mt_MT but got ") + name );
+ dataerrln("************************************************************");
+ dataerrln("THE ABOVE FAILURE MAY JUST MEAN THE LOCALE DATA HAS CHANGED");
+ dataerrln("************************************************************");
}
// Now try a non-existent zone
@@ -1288,7 +1288,7 @@
name.compare("GMT+1:30") &&
name.compare("GMT+0130") &&
name.compare("GMT+130"))
- errln("Fail: Expected GMT+01:30 or something similar");
+ dataerrln("Fail: Expected GMT+01:30 or something similar");
name.truncate(0);
zone2->getDisplayName(name);
logln("GMT+90min->" + name);
@@ -1296,7 +1296,7 @@
name.compare("GMT+1:30") &&
name.compare("GMT+0130") &&
name.compare("GMT+130"))
- errln("Fail: Expected GMT+01:30 or something similar");
+ dataerrln("Fail: Expected GMT+01:30 or something similar");
// clean up
delete zone;
delete zone2;
@@ -1439,7 +1439,7 @@
UnicodeString id;
int32_t expected = 1800000;
if (expected != dst_icu) {
- errln(UnicodeString("java reports dst savings of ") + expected +
+ dataerrln(UnicodeString("java reports dst savings of ") + expected +
" but icu reports " + dst_icu +
" for tz " + tz_icu->getID(id));
} else {
@@ -1464,7 +1464,7 @@
int32_t i;
if (s == NULL || n <= 0) {
- errln("FAIL: TimeZone::createEnumeration() returned nothing");
+ dataerrln("FAIL: TimeZone::createEnumeration() returned nothing");
return;
}
for (i=0; i<n; ++i) {
@@ -1556,7 +1556,7 @@
if (tz == 0) {
errln("FAIL: Cannot create %s", id);
} else if (tz->getID(s) != UnicodeString(id)) {
- errln((UnicodeString)"FAIL: createTimeZone(" + id + ") => " + s);
+ dataerrln((UnicodeString)"FAIL: createTimeZone(" + id + ") => " + s);
} else {
UErrorCode ec = U_ZERO_ERROR;
int32_t raw, dst;
@@ -1583,7 +1583,7 @@
void TimeZoneTest::TestEquivalentIDs() {
int32_t n = TimeZone::countEquivalentIDs("PST");
if (n < 2) {
- errln((UnicodeString)"FAIL: countEquivalentIDs(PST) = " + n);
+ dataerrln((UnicodeString)"FAIL: countEquivalentIDs(PST) = " + n);
} else {
UBool sawLA = FALSE;
for (int32_t i=0; i<n; ++i) {
@@ -1841,11 +1841,11 @@
continue;
}
if (canonicalID != data[i].expected) {
- errln((UnicodeString)"FAIL: getCanonicalID(\"" + data[i].id
+ dataerrln((UnicodeString)"FAIL: getCanonicalID(\"" + data[i].id
+ "\") returned " + canonicalID + " - expected: " + data[i].expected);
}
if (isSystemID != data[i].isSystem) {
- errln((UnicodeString)"FAIL: getCanonicalID(\"" + data[i].id
+ dataerrln((UnicodeString)"FAIL: getCanonicalID(\"" + data[i].id
+ "\") set " + isSystemID + " to isSystemID");
}
}
@@ -1923,16 +1923,17 @@
displayName.extract(name, 100, NULL, status);
if (isReferenceYear) {
sawAnError = TRUE;
- errln("Incorrect time zone display name. zone = \"%s\",\n"
+ dataerrln("Incorrect time zone display name. zone = \"%s\",\n"
" locale = \"%s\", style = %s, Summertime = %d\n"
" Expected \"%s\", "
- " Got \"%s\"\n", zoneDisplayTestData[testNum].zoneName,
+ " Got \"%s\"\n Error: %s", zoneDisplayTestData[testNum].zoneName,
zoneDisplayTestData[testNum].localeName,
zoneDisplayTestData[testNum].style==TimeZone::SHORT ?
"SHORT" : "LONG",
zoneDisplayTestData[testNum].summerTime,
zoneDisplayTestData[testNum].expectedDisplayName,
- name);
+ name,
+ u_errorName(status));
} else {
logln("Incorrect time zone display name. zone = \"%s\",\n"
" locale = \"%s\", style = %s, Summertime = %d\n"
@@ -1949,7 +1950,7 @@
delete zone;
}
if (sawAnError) {
- errln("Note: Errors could be the result of changes to zoneStrings locale data");
+ dataerrln("***Note: Errors could be the result of changes to zoneStrings locale data");
}
}
Modified: trunk/source/test/intltest/ucaconf.cpp
===================================================================
--- trunk/source/test/intltest/ucaconf.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/ucaconf.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2002-2008, International Business Machines Corporation and
+ * Copyright (c) 2002-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -31,7 +31,7 @@
const char *srcDir = IntlTest::getSourceTestData(status);
if (U_FAILURE(status)) {
- dataerrln("[DATA] Could not open test data %s", u_errorName(status));
+ dataerrln("Could not open test data %s", u_errorName(status));
return;
}
uprv_strcpy(testDataPath, srcDir);
@@ -136,7 +136,7 @@
if (testFile == 0) {
*(buffer+bufLen) = 0;
- dataerrln("[DATA] Could not open any of the conformance test files, tried opening base %s\n", buffer);
+ dataerrln("Could not open any of the conformance test files, tried opening base %s\n", buffer);
return;
} else {
infoln(
Modified: trunk/source/test/intltest/ucdtest.cpp
===================================================================
--- trunk/source/test/intltest/ucdtest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/ucdtest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -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.
********************************************************************/
@@ -225,7 +225,7 @@
UErrorCode errorCode=U_ZERO_ERROR;
UnicodeSet alpha(UNICODE_STRING_SIMPLE("[:Alphabetic:]"), errorCode);
if(U_FAILURE(errorCode)) {
- errln("UnicodeSet([:Alphabetic:]) failed - %s\n", u_errorName(errorCode));
+ dataerrln("UnicodeSet([:Alphabetic:]) failed - %s", u_errorName(errorCode));
return;
}
Modified: trunk/source/test/intltest/uobjtest.cpp
===================================================================
--- trunk/source/test/intltest/uobjtest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/uobjtest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2002-2008, International Business Machines Corporation and
+ * Copyright (c) 2002-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -33,12 +33,12 @@
*/
-#define TESTCLASSID_FACTORY(c, f) { delete testClass(f, #c, #f, c ::getStaticClassID()); if(U_FAILURE(status)) { errln(UnicodeString(#c " - " #f " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
-#define TESTCLASSID_TRANSLIT(c, t) { delete testClass(Transliterator::createInstance(UnicodeString(t), UTRANS_FORWARD,parseError,status), #c, "Transliterator: " #t, c ::getStaticClassID()); if(U_FAILURE(status)) { errln(UnicodeString(#c " - Transliterator: " #t " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
-#define TESTCLASSID_CTOR(c, x) { delete testClass(new c x, #c, "new " #c #x, c ::getStaticClassID()); if(U_FAILURE(status)) { errln(UnicodeString(#c " - new " #x " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
+#define TESTCLASSID_FACTORY(c, f) { delete testClass(f, #c, #f, c ::getStaticClassID()); if(U_FAILURE(status)) { errcheckln(status, UnicodeString(#c " - " #f " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
+#define TESTCLASSID_TRANSLIT(c, t) { delete testClass(Transliterator::createInstance(UnicodeString(t), UTRANS_FORWARD,parseError,status), #c, "Transliterator: " #t, c ::getStaticClassID()); if(U_FAILURE(status)) { dataerrln(UnicodeString(#c " - Transliterator: " #t " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
+#define TESTCLASSID_CTOR(c, x) { delete testClass(new c x, #c, "new " #c #x, c ::getStaticClassID()); if(U_FAILURE(status)) { dataerrln(UnicodeString(#c " - new " #x " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
#define TESTCLASSID_DEFAULT(c) delete testClass(new c, #c, "new " #c , c::getStaticClassID())
#define TESTCLASSID_ABSTRACT(c) testClass(NULL, #c, NULL, c::getStaticClassID())
-#define TESTCLASSID_FACTORY_HIDDEN(c, f) {UObject *objVar = f; delete testClass(objVar, #c, #f, objVar!=NULL? objVar->getDynamicClassID(): NULL); if(U_FAILURE(status)) { errln(UnicodeString(#c " - " #f " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
+#define TESTCLASSID_FACTORY_HIDDEN(c, f) {UObject *objVar = f; delete testClass(objVar, #c, #f, objVar!=NULL? objVar->getDynamicClassID(): NULL); if(U_FAILURE(status)) { dataerrln(UnicodeString(#c " - " #f " - got err status ") + UnicodeString(u_errorName(status))); status = U_ZERO_ERROR; } }
#define MAX_CLASS_ID 200
@@ -73,12 +73,12 @@
}
if(staticID == NULL) {
- errln("FAIL: staticID == NULL!" + what);
+ dataerrln("FAIL: staticID == NULL! " + what);
}
if(factory != NULL) { /* NULL factory means: abstract */
if(!obj) {
- errln( "FAIL: ==NULL!" + what);
+ dataerrln( "FAIL: ==NULL! " + what);
return obj;
}
@@ -87,7 +87,7 @@
}
if(dynamicID != staticID) {
- errln("FAIL: dynamicID != staticID!" + what );
+ dataerrln("FAIL: dynamicID != staticID! " + what);
}
}
Modified: trunk/source/test/intltest/usettest.cpp
===================================================================
--- trunk/source/test/intltest/usettest.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/intltest/usettest.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -27,11 +27,11 @@
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#define TEST_ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \
- errln("fail in file \"%s\", line %d: \"%s\"", __FILE__, __LINE__, \
+ dataerrln("fail in file \"%s\", line %d: \"%s\"", __FILE__, __LINE__, \
u_errorName(status));}}
#define TEST_ASSERT(expr) {if (!(expr)) { \
- errln("fail in file \"%s\", line %d", __FILE__, __LINE__); }}
+ dataerrln("fail in file \"%s\", line %d", __FILE__, __LINE__); }}
UnicodeString operator+(const UnicodeString& left, const UnicodeSet& set) {
UnicodeString pat;
@@ -130,7 +130,7 @@
ec = U_ZERO_ERROR;
UnicodeSet s(OTHER_TOPATTERN_TESTS[j], ec);
if (U_FAILURE(ec)) {
- errln((UnicodeString)"FAIL: bad pattern " + OTHER_TOPATTERN_TESTS[j]);
+ dataerrln((UnicodeString)"FAIL: bad pattern " + OTHER_TOPATTERN_TESTS[j] + " - " + UnicodeString(u_errorName(ec)));
continue;
}
checkPat(OTHER_TOPATTERN_TESTS[j], s);
@@ -281,7 +281,8 @@
const char* pat = " [:Lu:] "; // Whitespace ok outside [:..:]
UnicodeSet set(pat, status);
if (U_FAILURE(status)) {
- errln((UnicodeString)"Fail: Can't construct set with " + pat);
+ dataerrln((UnicodeString)"Fail: Can't construct set with " + pat + " - " + UnicodeString(u_errorName(status)));
+ return;
} else {
expectContainment(set, pat, "ABC", "abc");
}
@@ -321,7 +322,7 @@
UnicodeSet *set1=new UnicodeSet(UNICODE_STRING_SIMPLE("\\p{Lowercase Letter}"), status); // :Ll: Letter, lowercase
UnicodeSet *set1a=new UnicodeSet(UNICODE_STRING_SIMPLE("[:Ll:]"), status); // Letter, lowercase
if (U_FAILURE(status)){
- errln((UnicodeString)"FAIL: Can't construst set with category->Ll");
+ dataerrln((UnicodeString)"FAIL: Can't construst set with category->Ll" + " - " + UnicodeString(u_errorName(status)));
return;
}
UnicodeSet *set2=new UnicodeSet(UNICODE_STRING_SIMPLE("\\p{Decimal Number}"), status); //Number, Decimal digit
@@ -1246,7 +1247,7 @@
if (s == t) {
logln((UnicodeString)"Ok: " + pat + ".closeOver(" + selector + ") => " + exp);
} else {
- errln((UnicodeString)"FAIL: " + pat + ".closeOver(" + selector + ") => " +
+ dataerrln((UnicodeString)"FAIL: " + pat + ".closeOver(" + selector + ") => " +
s.toPattern(buf, TRUE) + ", expected " + exp);
}
}
@@ -1922,7 +1923,7 @@
UErrorCode ec = U_ZERO_ERROR;
UnicodeSet set(pat, ec);
if (U_FAILURE(ec)) {
- errln((UnicodeString)"FAIL: pattern \"" +
+ dataerrln((UnicodeString)"FAIL: pattern \"" +
pat + "\" => " + u_errorName(ec));
return;
}
@@ -2104,14 +2105,14 @@
UnicodeString idPattern=UNICODE_STRING("[:ID_Continue:]", 15);
UnicodeSet idSet(idPattern, errorCode);
if(U_FAILURE(errorCode)) {
- errln("FAIL: unable to create UnicodeSet([:ID_Continue:]) - %s", u_errorName(errorCode));
+ dataerrln("FAIL: unable to create UnicodeSet([:ID_Continue:]) - %s", u_errorName(errorCode));
return;
}
UnicodeString wsPattern=UNICODE_STRING("[:White_Space:]", 15);
UnicodeSet wsSet(wsPattern, errorCode);
if(U_FAILURE(errorCode)) {
- errln("FAIL: unable to create UnicodeSet([:White_Space:]) - %s", u_errorName(errorCode));
+ dataerrln("FAIL: unable to create UnicodeSet([:White_Space:]) - %s", u_errorName(errorCode));
return;
}
@@ -3597,7 +3598,7 @@
UErrorCode errorCode=U_ZERO_ERROR;
sets[SLOW]=new UnicodeSet(UnicodeString(s, -1, US_INV).unescape(), errorCode);
if(U_FAILURE(errorCode)) {
- errln("FAIL: Unable to create UnicodeSet(%s) - %s", s, u_errorName(errorCode));
+ dataerrln("FAIL: Unable to create UnicodeSet(%s) - %s", s, u_errorName(errorCode));
break;
}
sets[SLOW_NOT]=new UnicodeSet(*sets[SLOW]);
Modified: trunk/source/test/perf/Makefile.in
===================================================================
--- trunk/source/test/perf/Makefile.in 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/perf/Makefile.in 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,84 +1,84 @@
-## Makefile.in for ICU tests
-## Copyright (c) 1999-2008, International Business Machines Corporation and
-## others. All Rights Reserved.
-
-## Source directory information
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-
-top_builddir = ../..
-
-include $(top_builddir)/icudefs.mk
-
-## Build directory information
-subdir = test
-
- at ICUIO_TRUE@IOTEST = iotest
-
-## Files to remove for 'make clean'
-CLEANFILES = *~
-
-SUBDIRS = collationperf charperf normperf ubrkperf unisetperf usetperf ustrperf utfperf utrie2perf
-
-## List of phony targets
-.PHONY : everything all all-local all-recursive install install-local \
-install-recursive clean clean-local clean-recursive distclean \
-distclean-local distclean-recursive dist dist-recursive dist-local \
-check check-recursive check-local
-
-## Clear suffix list
-.SUFFIXES :
-
-## List of standard targets
-everything: all-recursive all-local
-all:
-ifneq ($(RECURSIVE),YES)
- @echo simply use \`make\' \(or \`make everything\'\) to do all
-endif
-
-install: install-recursive install-local
-clean: clean-recursive clean-local
-distclean : distclean-recursive distclean-local
- $(RMV) hdrtst/Makefile
- $(RMV) perf/convperf/Makefile
-
-dist: dist-recursive dist-local
-check: everything check-recursive check-local
-check-recursive: all-recursive
-
-## Recursive targets
-all-recursive install-recursive clean-recursive distclean-recursive dist-recursive check-recursive:
- @dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$target' in \`$$subdir'"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-local"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $$local_target) || exit; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) "$$target-local" || exit; \
- fi
-
-all-local:
-
-install-local:
-
-dist-local:
-
-clean-local:
- test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
-
-distclean-local: clean-local
- $(RMV) Makefile
-
-check-local: all-local
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
+## Makefile.in for ICU tests
+## Copyright (c) 1999-2008, International Business Machines Corporation and
+## others. All Rights Reserved.
+
+## Source directory information
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+
+top_builddir = ../..
+
+include $(top_builddir)/icudefs.mk
+
+## Build directory information
+subdir = test
+
+ at ICUIO_TRUE@IOTEST = iotest
+
+## Files to remove for 'make clean'
+CLEANFILES = *~
+
+SUBDIRS = collationperf charperf normperf ubrkperf unisetperf usetperf ustrperf utfperf utrie2perf
+
+## List of phony targets
+.PHONY : everything all all-local all-recursive install install-local \
+install-recursive clean clean-local clean-recursive distclean \
+distclean-local distclean-recursive dist dist-recursive dist-local \
+check check-recursive check-local
+
+## Clear suffix list
+.SUFFIXES :
+
+## List of standard targets
+everything: all-recursive all-local
+all:
+ifneq ($(RECURSIVE),YES)
+ @echo simply use \`make\' \(or \`make everything\'\) to do all
+endif
+
+install: install-recursive install-local
+clean: clean-recursive clean-local
+distclean : distclean-recursive distclean-local
+ $(RMV) hdrtst/Makefile
+ $(RMV) perf/convperf/Makefile
+
+dist: dist-recursive dist-local
+check: everything check-recursive check-local
+check-recursive: all-recursive
+
+## Recursive targets
+all-recursive install-recursive clean-recursive distclean-recursive dist-recursive check-recursive:
+ @dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$target' in \`$$subdir'"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-local"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $$local_target) || exit; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) "$$target-local" || exit; \
+ fi
+
+all-local:
+
+install-local:
+
+dist-local:
+
+clean-local:
+ test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
+
+distclean-local: clean-local
+ $(RMV) Makefile
+
+check-local: all-local
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
Modified: trunk/source/test/perf/strsrchperf/Makefile.in
===================================================================
--- trunk/source/test/perf/strsrchperf/Makefile.in 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/perf/strsrchperf/Makefile.in 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,79 +1,79 @@
-## Makefile.in for ICU - test/perf/strsrchperf
-## Copyright (c) 2008, International Business Machines Corporation and
-## others. All Rights Reserved.
-
-## Source directory information
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-
-top_builddir = ../../..
-
-include $(top_builddir)/icudefs.mk
-
-## Build directory information
-subdir = test/perf/strsrchperf
-
-## Extra files to remove for 'make clean'
-CLEANFILES = *~ $(DEPS)
-
-## Target information
-TARGET = strsrchperf
-
-CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw
-LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M)
-
-OBJECTS = strsrchperf.o
-
-DEPS = $(OBJECTS:.o=.d)
-
-## List of phony targets
-.PHONY : all all-local install install-local clean clean-local \
-distclean distclean-local dist dist-local check check-local
-
-## Clear suffix list
-.SUFFIXES :
-
-## List of standard targets
-all: all-local
-install: install-local
-clean: clean-local
-distclean : distclean-local
-dist: dist-local
-check: all check-local
-
-all-local: $(TARGET)
-
-install-local:
-
-dist-local:
-
-clean-local:
- test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
- $(RMV) $(OBJECTS) $(TARGET)
-
-distclean-local: clean-local
- $(RMV) Makefile
-
-check-local: all-local
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-$(TARGET) : $(OBJECTS)
- $(LINK.cc) -o $@ $^ $(LIBS)
- $(POST_BUILD_STEP)
-
-invoke:
- ICU_DATA=$${ICU_DATA:-$(top_builddir)/data/} TZ=PST8PDT $(INVOKE) $(INVOCATION)
-
-ifeq (,$(MAKECMDGOALS))
--include $(DEPS)
-else
-ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
-ifneq ($(patsubst %install,,$(MAKECMDGOALS)),)
--include $(DEPS)
-endif
-endif
-endif
-
+## Makefile.in for ICU - test/perf/strsrchperf
+## Copyright (c) 2008, International Business Machines Corporation and
+## others. All Rights Reserved.
+
+## Source directory information
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+
+top_builddir = ../../..
+
+include $(top_builddir)/icudefs.mk
+
+## Build directory information
+subdir = test/perf/strsrchperf
+
+## Extra files to remove for 'make clean'
+CLEANFILES = *~ $(DEPS)
+
+## Target information
+TARGET = strsrchperf
+
+CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw
+LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M)
+
+OBJECTS = strsrchperf.o
+
+DEPS = $(OBJECTS:.o=.d)
+
+## List of phony targets
+.PHONY : all all-local install install-local clean clean-local \
+distclean distclean-local dist dist-local check check-local
+
+## Clear suffix list
+.SUFFIXES :
+
+## List of standard targets
+all: all-local
+install: install-local
+clean: clean-local
+distclean : distclean-local
+dist: dist-local
+check: all check-local
+
+all-local: $(TARGET)
+
+install-local:
+
+dist-local:
+
+clean-local:
+ test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
+ $(RMV) $(OBJECTS) $(TARGET)
+
+distclean-local: clean-local
+ $(RMV) Makefile
+
+check-local: all-local
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(TARGET) : $(OBJECTS)
+ $(LINK.cc) -o $@ $^ $(LIBS)
+ $(POST_BUILD_STEP)
+
+invoke:
+ ICU_DATA=$${ICU_DATA:-$(top_builddir)/data/} TZ=PST8PDT $(INVOKE) $(INVOCATION)
+
+ifeq (,$(MAKECMDGOALS))
+-include $(DEPS)
+else
+ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
+ifneq ($(patsubst %install,,$(MAKECMDGOALS)),)
+-include $(DEPS)
+endif
+endif
+endif
+
Modified: trunk/source/test/perf/strsrchperf/StrSrchPerf_r.pl
===================================================================
--- trunk/source/test/perf/strsrchperf/StrSrchPerf_r.pl 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/perf/strsrchperf/StrSrchPerf_r.pl 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,62 +1,62 @@
-#!/usr/bin/perl
-# ********************************************************************
-# * COPYRIGHT:
-# * Copyright (c) 2008, International Business Machines
-# * Corporation and others. All Rights Reserved.
-# ********************************************************************
-
-#use strict;
-
-require "../perldriver/Common.pl";
-
-use lib '../perldriver';
-
-use PerfFramework;
-
-my $options = {
- "title" => "String search performance regression: ICU ("
- . $ICUPreviousVersion . " and "
- . $ICULatestVersion . ")",
- "headers" => "ICU" . $ICUPreviousVersion . " ICU" . $ICULatestVersion,
- "operationIs" => "code point",
- "timePerOperationIs" => "Time per code point",
- "passes" => "10",
- "time" => "5",
-
- #"outputType"=>"HTML",
- "dataDir" => $UDHRDataPath,
- "outputDir" => "../results"
-};
-
-# programs
-
-my $p1; # Previous
-my $p2; # Latest
-
-if ($OnWindows) {
- $p1 = $ICUPathPrevious . "/strsrchperf/$WindowsPlatform/Release/strsrchperf.exe -b";
- $p2 = $ICUPathLatest . "/strsrchperf/$WindowsPlatform/Release/strsrchperf.exe -b";
-}
-else {
- $p1 = $ICUPathPrevious . "/strsrchperf/strsrchperf -b";
- $p2 = $ICUPathLatest . "/strsrchperf/strsrchperf -b";
-}
-
-my $dataFiles = {
- "en" => ["udhr_eng.txt"],
- "de" => ["udhr_deu_1996.txt"],
- "fr" => ["udhr_fra.txt"],
- "ru" => ["udhr_rus.txt"],
- "th" => ["udhr_tha.txt"],
- "ja" => ["udhr_jpn.txt"],
- "zh" => ["udhr_cmn_hans.txt"],
-};
-
-my $tests = {
- "ICU Forward Search", [ "$p1 Test_ICU_Forward_Search", "$p2 Test_ICU_Forward_Search" ],
- "ICU Backward Search",[ "$p1 Test_ICU_Backward_Search", "$p2 Test_ICU_Backward_Search" ],
-};
-
-runTests( $options, $tests, $dataFiles );
-
-
+#!/usr/bin/perl
+# ********************************************************************
+# * COPYRIGHT:
+# * Copyright (c) 2008, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# ********************************************************************
+
+#use strict;
+
+require "../perldriver/Common.pl";
+
+use lib '../perldriver';
+
+use PerfFramework;
+
+my $options = {
+ "title" => "String search performance regression: ICU ("
+ . $ICUPreviousVersion . " and "
+ . $ICULatestVersion . ")",
+ "headers" => "ICU" . $ICUPreviousVersion . " ICU" . $ICULatestVersion,
+ "operationIs" => "code point",
+ "timePerOperationIs" => "Time per code point",
+ "passes" => "10",
+ "time" => "5",
+
+ #"outputType"=>"HTML",
+ "dataDir" => $UDHRDataPath,
+ "outputDir" => "../results"
+};
+
+# programs
+
+my $p1; # Previous
+my $p2; # Latest
+
+if ($OnWindows) {
+ $p1 = $ICUPathPrevious . "/strsrchperf/$WindowsPlatform/Release/strsrchperf.exe -b";
+ $p2 = $ICUPathLatest . "/strsrchperf/$WindowsPlatform/Release/strsrchperf.exe -b";
+}
+else {
+ $p1 = $ICUPathPrevious . "/strsrchperf/strsrchperf -b";
+ $p2 = $ICUPathLatest . "/strsrchperf/strsrchperf -b";
+}
+
+my $dataFiles = {
+ "en" => ["udhr_eng.txt"],
+ "de" => ["udhr_deu_1996.txt"],
+ "fr" => ["udhr_fra.txt"],
+ "ru" => ["udhr_rus.txt"],
+ "th" => ["udhr_tha.txt"],
+ "ja" => ["udhr_jpn.txt"],
+ "zh" => ["udhr_cmn_hans.txt"],
+};
+
+my $tests = {
+ "ICU Forward Search", [ "$p1 Test_ICU_Forward_Search", "$p2 Test_ICU_Forward_Search" ],
+ "ICU Backward Search",[ "$p1 Test_ICU_Backward_Search", "$p2 Test_ICU_Backward_Search" ],
+};
+
+runTests( $options, $tests, $dataFiles );
+
+
Modified: trunk/source/test/perf/strsrchperf/strsrchperf.cpp
===================================================================
--- trunk/source/test/perf/strsrchperf/strsrchperf.cpp 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/perf/strsrchperf/strsrchperf.cpp 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,148 +1,148 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (C) 2008-2009 IBM, Inc. All Rights Reserved.
- *
- ********************************************************************/
-/**
- * This program tests string search performance.
- * APIs tested:
- * ICU4C
- */
-
-#include "strsrchperf.h"
-
-StringSearchPerformanceTest::StringSearchPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status)
-:UPerfTest(argc,argv,status){
- int32_t start, end;
-
-#ifdef TEST_BOYER_MOORE_SEARCH
- bms = NULL;
-#else
- srch = NULL;
-#endif
-
- pttrn = NULL;
- if(status== U_ILLEGAL_ARGUMENT_ERROR || line_mode){
- fprintf(stderr,gUsageString, "strsrchperf");
- return;
- }
- /* Get the Text */
- src = getBuffer(srcLen, status);
-
-#if 0
- /* Get a word to find. Do this by selecting a random word with a word breakiterator. */
- UBreakIterator* brk = ubrk_open(UBRK_WORD, locale, src, srcLen, &status);
- if(U_FAILURE(status)){
- fprintf(stderr, "FAILED to create pattern for searching. Error: %s\n", u_errorName(status));
- return;
- }
- start = ubrk_preceding(brk, 1000);
- end = ubrk_following(brk, start);
- pttrnLen = end - start;
- UChar* temp = (UChar*)malloc(sizeof(UChar)*(pttrnLen));
- for (int i = 0; i < pttrnLen; i++) {
- temp[i] = src[start++];
- }
- pttrn = temp; /* store word in pttrn */
- ubrk_close(brk);
-#else
- /* The first line of the file contains the pattern */
- start = 0;
-
- for(end = start; ; end += 1) {
- UChar ch = src[end];
-
- if (ch == 0x000A || ch == 0x000D || ch == 0x2028) {
- break;
- }
- }
-
- pttrnLen = end - start;
- UChar* temp = (UChar*)malloc(sizeof(UChar)*(pttrnLen));
- for (int i = 0; i < pttrnLen; i++) {
- temp[i] = src[start++];
- }
- pttrn = temp; /* store word in pttrn */
-#endif
-
-#ifdef TEST_BOYER_MOORE_SEARCH
- UnicodeString patternString(pttrn, pttrnLen);
- UCollator *coll = ucol_open(locale, &status);
- CollData *data = CollData::open(coll, status);
-
- targetString = new UnicodeString(src, srcLen);
- bms = new BoyerMooreSearch(data, patternString, targetString, status);
-#else
- /* Create the StringSearch object to be use in performance test. */
- srch = usearch_open(pttrn, pttrnLen, src, srcLen, locale, NULL, &status);
-#endif
-
- if(U_FAILURE(status)){
- fprintf(stderr, "FAILED to create UPerfTest object. Error: %s\n", u_errorName(status));
- return;
- }
-
-}
-
-StringSearchPerformanceTest::~StringSearchPerformanceTest() {
- CollData *data = bms->getData();
- UCollator *coll = data->getCollator();
-
- delete bms;
- delete targetString;
- CollData::close(data);
- ucol_close(coll);
-
- if (pttrn != NULL) {
- free(pttrn);
- }
-
-#ifndef TEST_BOYER_MOORE_SEARCH
- if (srch != NULL) {
- usearch_close(srch);
- }
-#endif
-}
-
-UPerfFunction* StringSearchPerformanceTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char *par) {
- switch (index) {
- TESTCASE(0,Test_ICU_Forward_Search);
- TESTCASE(1,Test_ICU_Backward_Search);
-
- default:
- name = "";
- return NULL;
- }
- return NULL;
-}
-
-UPerfFunction* StringSearchPerformanceTest::Test_ICU_Forward_Search(){
-#ifdef TEST_BOYER_MOORE_SEARCH
- StringSearchPerfFunction *func = new StringSearchPerfFunction(ICUForwardSearch, bms, src, srcLen, pttrn, pttrnLen);
-#else
- StringSearchPerfFunction* func = new StringSearchPerfFunction(ICUForwardSearch, srch, src, srcLen, pttrn, pttrnLen);
-#endif
- return func;
-}
-
-UPerfFunction* StringSearchPerformanceTest::Test_ICU_Backward_Search(){
-#ifdef TEST_BOYER_MOORE_SEARCH
- StringSearchPerfFunction *func = new StringSearchPerfFunction(ICUBackwardSearch, bms, src, srcLen, pttrn, pttrnLen);
-#else
- StringSearchPerfFunction* func = new StringSearchPerfFunction(ICUBackwardSearch, srch, src, srcLen, pttrn, pttrnLen);
-#endif
- return func;
-}
-
-int main (int argc, const char* argv[]) {
- UErrorCode status = U_ZERO_ERROR;
- StringSearchPerformanceTest test(argc, argv, status);
- if(U_FAILURE(status)){
- return status;
- }
- if(test.run()==FALSE){
- fprintf(stderr,"FAILED: Tests could not be run please check the arguments.\n");
- return -1;
- }
- return 0;
-}
+/********************************************************************
+ * COPYRIGHT:
+ * Copyright (C) 2008-2009 IBM, Inc. All Rights Reserved.
+ *
+ ********************************************************************/
+/**
+ * This program tests string search performance.
+ * APIs tested:
+ * ICU4C
+ */
+
+#include "strsrchperf.h"
+
+StringSearchPerformanceTest::StringSearchPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status)
+:UPerfTest(argc,argv,status){
+ int32_t start, end;
+
+#ifdef TEST_BOYER_MOORE_SEARCH
+ bms = NULL;
+#else
+ srch = NULL;
+#endif
+
+ pttrn = NULL;
+ if(status== U_ILLEGAL_ARGUMENT_ERROR || line_mode){
+ fprintf(stderr,gUsageString, "strsrchperf");
+ return;
+ }
+ /* Get the Text */
+ src = getBuffer(srcLen, status);
+
+#if 0
+ /* Get a word to find. Do this by selecting a random word with a word breakiterator. */
+ UBreakIterator* brk = ubrk_open(UBRK_WORD, locale, src, srcLen, &status);
+ if(U_FAILURE(status)){
+ fprintf(stderr, "FAILED to create pattern for searching. Error: %s\n", u_errorName(status));
+ return;
+ }
+ start = ubrk_preceding(brk, 1000);
+ end = ubrk_following(brk, start);
+ pttrnLen = end - start;
+ UChar* temp = (UChar*)malloc(sizeof(UChar)*(pttrnLen));
+ for (int i = 0; i < pttrnLen; i++) {
+ temp[i] = src[start++];
+ }
+ pttrn = temp; /* store word in pttrn */
+ ubrk_close(brk);
+#else
+ /* The first line of the file contains the pattern */
+ start = 0;
+
+ for(end = start; ; end += 1) {
+ UChar ch = src[end];
+
+ if (ch == 0x000A || ch == 0x000D || ch == 0x2028) {
+ break;
+ }
+ }
+
+ pttrnLen = end - start;
+ UChar* temp = (UChar*)malloc(sizeof(UChar)*(pttrnLen));
+ for (int i = 0; i < pttrnLen; i++) {
+ temp[i] = src[start++];
+ }
+ pttrn = temp; /* store word in pttrn */
+#endif
+
+#ifdef TEST_BOYER_MOORE_SEARCH
+ UnicodeString patternString(pttrn, pttrnLen);
+ UCollator *coll = ucol_open(locale, &status);
+ CollData *data = CollData::open(coll, status);
+
+ targetString = new UnicodeString(src, srcLen);
+ bms = new BoyerMooreSearch(data, patternString, targetString, status);
+#else
+ /* Create the StringSearch object to be use in performance test. */
+ srch = usearch_open(pttrn, pttrnLen, src, srcLen, locale, NULL, &status);
+#endif
+
+ if(U_FAILURE(status)){
+ fprintf(stderr, "FAILED to create UPerfTest object. Error: %s\n", u_errorName(status));
+ return;
+ }
+
+}
+
+StringSearchPerformanceTest::~StringSearchPerformanceTest() {
+ CollData *data = bms->getData();
+ UCollator *coll = data->getCollator();
+
+ delete bms;
+ delete targetString;
+ CollData::close(data);
+ ucol_close(coll);
+
+ if (pttrn != NULL) {
+ free(pttrn);
+ }
+
+#ifndef TEST_BOYER_MOORE_SEARCH
+ if (srch != NULL) {
+ usearch_close(srch);
+ }
+#endif
+}
+
+UPerfFunction* StringSearchPerformanceTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char *par) {
+ switch (index) {
+ TESTCASE(0,Test_ICU_Forward_Search);
+ TESTCASE(1,Test_ICU_Backward_Search);
+
+ default:
+ name = "";
+ return NULL;
+ }
+ return NULL;
+}
+
+UPerfFunction* StringSearchPerformanceTest::Test_ICU_Forward_Search(){
+#ifdef TEST_BOYER_MOORE_SEARCH
+ StringSearchPerfFunction *func = new StringSearchPerfFunction(ICUForwardSearch, bms, src, srcLen, pttrn, pttrnLen);
+#else
+ StringSearchPerfFunction* func = new StringSearchPerfFunction(ICUForwardSearch, srch, src, srcLen, pttrn, pttrnLen);
+#endif
+ return func;
+}
+
+UPerfFunction* StringSearchPerformanceTest::Test_ICU_Backward_Search(){
+#ifdef TEST_BOYER_MOORE_SEARCH
+ StringSearchPerfFunction *func = new StringSearchPerfFunction(ICUBackwardSearch, bms, src, srcLen, pttrn, pttrnLen);
+#else
+ StringSearchPerfFunction* func = new StringSearchPerfFunction(ICUBackwardSearch, srch, src, srcLen, pttrn, pttrnLen);
+#endif
+ return func;
+}
+
+int main (int argc, const char* argv[]) {
+ UErrorCode status = U_ZERO_ERROR;
+ StringSearchPerformanceTest test(argc, argv, status);
+ if(U_FAILURE(status)){
+ return status;
+ }
+ if(test.run()==FALSE){
+ fprintf(stderr,"FAILED: Tests could not be run please check the arguments.\n");
+ return -1;
+ }
+ return 0;
+}
Modified: trunk/source/test/perf/strsrchperf/strsrchperf.h
===================================================================
--- trunk/source/test/perf/strsrchperf/strsrchperf.h 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/perf/strsrchperf/strsrchperf.h 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,137 +1,137 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (C) 2008-2009 IBM, Inc. All Rights Reserved.
- *
- ********************************************************************/
-#ifndef _STRSRCHPERF_H
-#define _STRSRCHPERF_H
-
-#include "unicode/ubrk.h"
-#include "unicode/usearch.h"
-#include "unicode/colldata.h"
-#include "unicode/bmsearch.h"
-#include "unicode/uperf.h"
-#include <stdlib.h>
-#include <stdio.h>
-
-#define TEST_BOYER_MOORE_SEARCH
-
-#ifdef TEST_BOYER_MOORE_SEARCH
-typedef void (*StrSrchFn) (BoyerMooreSearch * bms, const UChar *src, int32_t srcLen, const UChar *pttrn, int32_t pttrnLen, UErrorCode *status);
-#else
-typedef void (*StrSrchFn)(UStringSearch* srch, const UChar* src,int32_t srcLen, const UChar* pttrn, int32_t pttrnLen, UErrorCode* status);
-#endif
-
-class StringSearchPerfFunction : public UPerfFunction {
-private:
- StrSrchFn fn;
- const UChar* src;
- int32_t srcLen;
- const UChar* pttrn;
- int32_t pttrnLen;
-#ifdef TEST_BOYER_MOORE_SEARCH
- BoyerMooreSearch *bms;
-#else
- UStringSearch* srch;
-#endif
-
-public:
- virtual void call(UErrorCode* status) {
-#ifdef TEST_BOYER_MOORE_SEARCH
- (*fn)(bms, src, srcLen, pttrn, pttrnLen, status);
-#else
- (*fn)(srch, src, srcLen, pttrn, pttrnLen, status);
-#endif
- }
-
- virtual long getOperationsPerIteration() {
-#if 0
- return (long)(srcLen/pttrnLen);
-#else
- return (long) srcLen;
-#endif
- }
-
-#ifdef TEST_BOYER_MOORE_SEARCH
- StringSearchPerfFunction(StrSrchFn func, BoyerMooreSearch *search, const UChar *source, int32_t sourceLen, const UChar *pattern, int32_t patternLen) {
- fn = func;
- src = source;
- srcLen = sourceLen;
- pttrn = pattern;
- pttrnLen = patternLen;
- bms = search;
- }
-#else
- StringSearchPerfFunction(StrSrchFn func, UStringSearch* search, const UChar* source,int32_t sourceLen, const UChar* pattern, int32_t patternLen) {
- fn = func;
- src = source;
- srcLen = sourceLen;
- pttrn = pattern;
- pttrnLen = patternLen;
- srch = search;
- }
-#endif
-};
-
-class StringSearchPerformanceTest : public UPerfTest {
-private:
- const UChar* src;
- int32_t srcLen;
- UChar* pttrn;
- int32_t pttrnLen;
-#ifdef TEST_BOYER_MOORE_SEARCH
- UnicodeString *targetString;
- BoyerMooreSearch *bms;
-#else
- UStringSearch* srch;
-#endif
-
-public:
- StringSearchPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status);
- ~StringSearchPerformanceTest();
- virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = NULL);
-
- UPerfFunction* Test_ICU_Forward_Search();
-
- UPerfFunction* Test_ICU_Backward_Search();
-};
-
-
-#ifdef TEST_BOYER_MOORE_SEARCH
-void ICUForwardSearch(BoyerMooreSearch *bms, const UChar *source, int32_t sourceLen, const UChar *pattern, int32_t patternLen, UErrorCode * /*status*/) {
- int32_t offset = 0, start = -1, end = -1;
-
- while (bms->search(offset, start, end)) {
- offset = end;
- }
-}
-
-void ICUBackwardSearch(BoyerMooreSearch *bms, const UChar *source, int32_t sourceLen, const UChar *pattern, int32_t patternLen, UErrorCode * /*status*/) {
- int32_t offset = 0, start = -1, end = -1;
-
- /* NOTE: No Boyer-Moore backward search yet... */
- while (bms->search(offset, start, end)) {
- offset = end;
- }
-}
-#else
-void ICUForwardSearch(UStringSearch *srch, const UChar* source, int32_t sourceLen, const UChar* pattern, int32_t patternLen, UErrorCode* status) {
- int32_t match;
-
- match = usearch_first(srch, status);
- while (match != USEARCH_DONE) {
- match = usearch_next(srch, status);
- }
-}
-
-void ICUBackwardSearch(UStringSearch *srch, const UChar* source, int32_t sourceLen, const UChar* pattern, int32_t patternLen, UErrorCode* status) {
- int32_t match;
-
- match = usearch_last(srch, status);
- while (match != USEARCH_DONE) {
- match = usearch_previous(srch, status);
- }
-}
-#endif
-
-#endif /* _STRSRCHPERF_H */
+/********************************************************************
+ * COPYRIGHT:
+ * Copyright (C) 2008-2009 IBM, Inc. All Rights Reserved.
+ *
+ ********************************************************************/
+#ifndef _STRSRCHPERF_H
+#define _STRSRCHPERF_H
+
+#include "unicode/ubrk.h"
+#include "unicode/usearch.h"
+#include "unicode/colldata.h"
+#include "unicode/bmsearch.h"
+#include "unicode/uperf.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+#define TEST_BOYER_MOORE_SEARCH
+
+#ifdef TEST_BOYER_MOORE_SEARCH
+typedef void (*StrSrchFn) (BoyerMooreSearch * bms, const UChar *src, int32_t srcLen, const UChar *pttrn, int32_t pttrnLen, UErrorCode *status);
+#else
+typedef void (*StrSrchFn)(UStringSearch* srch, const UChar* src,int32_t srcLen, const UChar* pttrn, int32_t pttrnLen, UErrorCode* status);
+#endif
+
+class StringSearchPerfFunction : public UPerfFunction {
+private:
+ StrSrchFn fn;
+ const UChar* src;
+ int32_t srcLen;
+ const UChar* pttrn;
+ int32_t pttrnLen;
+#ifdef TEST_BOYER_MOORE_SEARCH
+ BoyerMooreSearch *bms;
+#else
+ UStringSearch* srch;
+#endif
+
+public:
+ virtual void call(UErrorCode* status) {
+#ifdef TEST_BOYER_MOORE_SEARCH
+ (*fn)(bms, src, srcLen, pttrn, pttrnLen, status);
+#else
+ (*fn)(srch, src, srcLen, pttrn, pttrnLen, status);
+#endif
+ }
+
+ virtual long getOperationsPerIteration() {
+#if 0
+ return (long)(srcLen/pttrnLen);
+#else
+ return (long) srcLen;
+#endif
+ }
+
+#ifdef TEST_BOYER_MOORE_SEARCH
+ StringSearchPerfFunction(StrSrchFn func, BoyerMooreSearch *search, const UChar *source, int32_t sourceLen, const UChar *pattern, int32_t patternLen) {
+ fn = func;
+ src = source;
+ srcLen = sourceLen;
+ pttrn = pattern;
+ pttrnLen = patternLen;
+ bms = search;
+ }
+#else
+ StringSearchPerfFunction(StrSrchFn func, UStringSearch* search, const UChar* source,int32_t sourceLen, const UChar* pattern, int32_t patternLen) {
+ fn = func;
+ src = source;
+ srcLen = sourceLen;
+ pttrn = pattern;
+ pttrnLen = patternLen;
+ srch = search;
+ }
+#endif
+};
+
+class StringSearchPerformanceTest : public UPerfTest {
+private:
+ const UChar* src;
+ int32_t srcLen;
+ UChar* pttrn;
+ int32_t pttrnLen;
+#ifdef TEST_BOYER_MOORE_SEARCH
+ UnicodeString *targetString;
+ BoyerMooreSearch *bms;
+#else
+ UStringSearch* srch;
+#endif
+
+public:
+ StringSearchPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status);
+ ~StringSearchPerformanceTest();
+ virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = NULL);
+
+ UPerfFunction* Test_ICU_Forward_Search();
+
+ UPerfFunction* Test_ICU_Backward_Search();
+};
+
+
+#ifdef TEST_BOYER_MOORE_SEARCH
+void ICUForwardSearch(BoyerMooreSearch *bms, const UChar *source, int32_t sourceLen, const UChar *pattern, int32_t patternLen, UErrorCode * /*status*/) {
+ int32_t offset = 0, start = -1, end = -1;
+
+ while (bms->search(offset, start, end)) {
+ offset = end;
+ }
+}
+
+void ICUBackwardSearch(BoyerMooreSearch *bms, const UChar *source, int32_t sourceLen, const UChar *pattern, int32_t patternLen, UErrorCode * /*status*/) {
+ int32_t offset = 0, start = -1, end = -1;
+
+ /* NOTE: No Boyer-Moore backward search yet... */
+ while (bms->search(offset, start, end)) {
+ offset = end;
+ }
+}
+#else
+void ICUForwardSearch(UStringSearch *srch, const UChar* source, int32_t sourceLen, const UChar* pattern, int32_t patternLen, UErrorCode* status) {
+ int32_t match;
+
+ match = usearch_first(srch, status);
+ while (match != USEARCH_DONE) {
+ match = usearch_next(srch, status);
+ }
+}
+
+void ICUBackwardSearch(UStringSearch *srch, const UChar* source, int32_t sourceLen, const UChar* pattern, int32_t patternLen, UErrorCode* status) {
+ int32_t match;
+
+ match = usearch_last(srch, status);
+ while (match != USEARCH_DONE) {
+ match = usearch_previous(srch, status);
+ }
+}
+#endif
+
+#endif /* _STRSRCHPERF_H */
Modified: trunk/source/test/testdata/NumberFormatTestCases.txt
===================================================================
--- trunk/source/test/testdata/NumberFormatTestCases.txt 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/testdata/NumberFormatTestCases.txt 2009-07-02 19:31:11 UTC (rev 213)
@@ -79,8 +79,8 @@
#fpc: - 123/QQQ "QQQ123.00" 123/QQQ # QQQ is fake
fpc: - 123/GTQ "GTQ123.00" 123/GTQ
# ChoiceFormat-based display names
-fpc: - 1/INR "\u20a81.00" 1/INR
-fpc: - 2/INR "\u20a82.00" 2/INR
+fpc: - 1/INR "Rs1.00" 1/INR
+fpc: - 2/INR "Rs2.00" 2/INR
# Display names with shared prefix (YDD vs. Y)
fpc: - 100/YDD "YDD100.00" 100/YDD
fpc: - 100/CNY "CN\u00a5100.00" 100/CNY
Modified: trunk/source/test/testdata/pkgdataMakefile.in
===================================================================
--- trunk/source/test/testdata/pkgdataMakefile.in 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/testdata/pkgdataMakefile.in 2009-07-02 19:31:11 UTC (rev 213)
@@ -1,40 +1,40 @@
-## pkgdataMakefile.in for ICU data
-## Copyright (c) 2008-2009, International Business Machines Corporation and
-## others. All Rights Reserved.
-
-## Source directory information
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-
-# So that you have $(top_builddir)/config.status
-top_builddir = ../..
-
-## All the flags and other definitions are included here.
-include $(top_builddir)/icudefs.mk
-
-MIDDLE_SO_TARGET=
-
-OUTPUTFILE=pkgdata.inc
-
-all : clean
- @echo GENCCODE_ASSEMBLY_TYPE=$(GENCCODE_ASSEMBLY) >> $(OUTPUTFILE)
- @echo SO=$(SO) >> $(OUTPUTFILE)
- @echo SOBJ=$(SOBJ) >> $(OUTPUTFILE)
- @echo A=$(A) >> $(OUTPUTFILE)
- @echo LIBPREFIX=$(LIBPREFIX) >> $(OUTPUTFILE)
- @echo LIB_EXT_ORDER=$(FINAL_SO_TARGET) >> $(OUTPUTFILE)
- @echo COMPILE="$(COMPILE.c)" >> $(OUTPUTFILE)
- @echo LIBFLAGS="-I$(top_srcdir)/common -I$(top_builddir)/common $(SHAREDLIBCPPFLAGS) $(SHAREDLIBCFLAGS)" >> $(OUTPUTFILE)
- @echo GENLIB="$(SHLIB.c)" >> $(OUTPUTFILE)
- @echo LDICUDTFLAGS=$(LDFLAGSICUDT) >> $(OUTPUTFILE)
- @echo LD_SONAME=$(LD_SONAME) >> $(OUTPUTFILE)
- @echo RPATH_FLAGS=$(RPATH_FLAGS) >> $(OUTPUTFILE)
- @echo BIR_LDFLAGS=$(BIR_LDFLAGS) >> $(OUTPUTFILE)
- @echo AR=$(AR) >> $(OUTPUTFILE)
- @echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
- @echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
- @echo INSTALL_CMD=$(INSTALL_DATA) >> $(OUTPUTFILE)
-
-clean :
- $(RMV) $(OUTPUTFILE)
-
+## pkgdataMakefile.in for ICU data
+## Copyright (c) 2008-2009, International Business Machines Corporation and
+## others. All Rights Reserved.
+
+## Source directory information
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+
+# So that you have $(top_builddir)/config.status
+top_builddir = ../..
+
+## All the flags and other definitions are included here.
+include $(top_builddir)/icudefs.mk
+
+MIDDLE_SO_TARGET=
+
+OUTPUTFILE=pkgdata.inc
+
+all : clean
+ @echo GENCCODE_ASSEMBLY_TYPE=$(GENCCODE_ASSEMBLY) >> $(OUTPUTFILE)
+ @echo SO=$(SO) >> $(OUTPUTFILE)
+ @echo SOBJ=$(SOBJ) >> $(OUTPUTFILE)
+ @echo A=$(A) >> $(OUTPUTFILE)
+ @echo LIBPREFIX=$(LIBPREFIX) >> $(OUTPUTFILE)
+ @echo LIB_EXT_ORDER=$(FINAL_SO_TARGET) >> $(OUTPUTFILE)
+ @echo COMPILE="$(COMPILE.c)" >> $(OUTPUTFILE)
+ @echo LIBFLAGS="-I$(top_srcdir)/common -I$(top_builddir)/common $(SHAREDLIBCPPFLAGS) $(SHAREDLIBCFLAGS)" >> $(OUTPUTFILE)
+ @echo GENLIB="$(SHLIB.c)" >> $(OUTPUTFILE)
+ @echo LDICUDTFLAGS=$(LDFLAGSICUDT) >> $(OUTPUTFILE)
+ @echo LD_SONAME=$(LD_SONAME) >> $(OUTPUTFILE)
+ @echo RPATH_FLAGS=$(RPATH_FLAGS) >> $(OUTPUTFILE)
+ @echo BIR_LDFLAGS=$(BIR_LDFLAGS) >> $(OUTPUTFILE)
+ @echo AR=$(AR) >> $(OUTPUTFILE)
+ @echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
+ @echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
+ @echo INSTALL_CMD=$(INSTALL_DATA) >> $(OUTPUTFILE)
+
+clean :
+ $(RMV) $(OUTPUTFILE)
+
Modified: trunk/source/test/testdata/structLocale.txt
===================================================================
--- trunk/source/test/testdata/structLocale.txt 2009-07-02 19:28:39 UTC (rev 212)
+++ trunk/source/test/testdata/structLocale.txt 2009-07-02 19:31:11 UTC (rev 213)
@@ -4154,6 +4154,7 @@
mdf{""}
mdr{""}
men{""}
+ mfe{""}
mg{""}
mga{""}
mh{""}
@@ -15141,6 +15142,16 @@
//ec{""} // Metazones have no exemplar city
cu:int{0}
}
+ "meta:Taipei"{
+ ld{""}
+ lg{""}
+ ls{""}
+ sd{""}
+ sg{""}
+ ss{""}
+ //ec{""} // Metazones have no exemplar city
+ cu:int{0}
+ }
"meta:Tajikistan"{
ld{""}
lg{""}
More information about the sword-cvs
mailing list