ICU-329 update tests after first take on adding better error reporting with UParseError struct.

X-SVN-Rev: 5474
This commit is contained in:
Ram Viswanadha 2001-08-16 00:58:53 +00:00
parent 00462d3f97
commit 4458f53dc1
15 changed files with 198 additions and 122 deletions

View File

@ -327,7 +327,7 @@ static void TestTertiary()
rules=(UChar*)malloc(sizeof(UChar*) * (len+1));
u_uastrcpy(rules, str);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, NULL, &status);
if(U_FAILURE(status)){
log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
}
@ -354,7 +354,7 @@ static void TestPrimary( )
rules=(UChar*)malloc(sizeof(UChar*) * (len+1));
u_uastrcpy(rules, str);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH,NULL, &status);
if(U_FAILURE(status)){
log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
}
@ -382,7 +382,7 @@ static void TestSecondary()
rules=(UChar*)malloc(sizeof(UChar*) * (len+1));
u_uastrcpy(rules, str);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH,NULL, &status);
if(U_FAILURE(status)){
log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
}
@ -408,7 +408,7 @@ static void TestIdentical()
rules=(UChar*)malloc(sizeof(UChar*) * (len+1));
u_uastrcpy(rules, str);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_IDENTICAL, &status);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_IDENTICAL, NULL,&status);
if(U_FAILURE(status)){
log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
}
@ -433,7 +433,7 @@ static void TestExtra()
rules=(UChar*)malloc(sizeof(UChar*) * (len+1));
u_uastrcpy(rules, str);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
myCollation=ucol_openRules(rules, len, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH,NULL, &status);
if(U_FAILURE(status)){
log_err("ERROR: in creation of rule based collator :%s\n", myErrorName(status));
}
@ -528,7 +528,7 @@ static void TestVariableTop(void)
enCollation = ucol_open("en_US", &status);
myCollation = ucol_openRules(rules, len, UCOL_NO_NORMALIZATION,
UCOL_PRIMARY, &status);
UCOL_PRIMARY,NULL, &status);
if (U_FAILURE(status)) {
log_err("ERROR: in creation of rule based collator :%s\n",
myErrorName(status));
@ -603,7 +603,7 @@ static void TestSurrogates(void)
enCollation = ucol_open("en_US", &status);
myCollation = ucol_openRules(rules, rlen - 1, UCOL_NO_NORMALIZATION,
UCOL_TERTIARY, &status);
UCOL_TERTIARY,NULL, &status);
if (U_FAILURE(status)) {
log_err("ERROR: in creation of rule based collator :%s\n",
myErrorName(status));

View File

@ -30,6 +30,7 @@ void addUTransTest(TestNode** root);
void addPUtilTest(TestNode** root);
void addCompactArrayTest(TestNode** root);
void addCompactArrayExTest(TestNode** root);
void addTestDeprecatedAPI(TestNode** root);
void addAllTests(TestNode** root)
{
@ -47,5 +48,6 @@ void addAllTests(TestNode** root)
addPUtilTest(root);
addCompactArrayTest(root);
addCompactArrayExTest(root);
addTestDeprecatedAPI(root);
}

View File

@ -328,7 +328,7 @@ void TestRuleBasedColl()
u_uastrcpy(ruleset1, "&9 < a, A < b, B < c, C; ch, cH, Ch, CH < d, D, e, E");
u_uastrcpy(ruleset2, "&9 < a, A < b, B < c, C < d, D, e, E");
col1 = ucol_openRules(ruleset1, u_strlen(ruleset1), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
col1 = ucol_openRules(ruleset1, u_strlen(ruleset1), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH, NULL,&status);
if (U_FAILURE(status)) {
log_err("RuleBased Collator creation failed.: %s\n", myErrorName(status));
return;
@ -337,7 +337,7 @@ void TestRuleBasedColl()
log_verbose("PASS: RuleBased Collator creation passed\n");
status = U_ZERO_ERROR;
col2 = ucol_openRules(ruleset2, u_strlen(ruleset2), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
col2 = ucol_openRules(ruleset2, u_strlen(ruleset2), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH, NULL, &status);
if (U_FAILURE(status)) {
log_err("RuleBased Collator creation failed.: %s\n", myErrorName(status));
return;
@ -363,7 +363,7 @@ void TestRuleBasedColl()
doAssert((u_strcmp(rule2, rule3) != 0), "Default collator getRules failed");
doAssert((u_strcmp(rule1, rule3) != 0), "Default collator getRules failed");
col4=ucol_openRules(rule2, u_strlen(rule2), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
col4=ucol_openRules(rule2, u_strlen(rule2), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH, NULL, &status);
if (U_FAILURE(status)) {
log_err("RuleBased Collator creation failed.: %s\n", myErrorName(status));
return;

View File

@ -135,7 +135,7 @@ static void TestCalendar()
log_verbose("\nTesting the ucal_getNow function to check if it is fetching tbe current time\n");
now=ucal_getNow();
/* open the date format and format the date to check the output */
datdef=udat_open(UDAT_FULL,UDAT_FULL ,NULL, NULL, 0,&status);
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", myErrorName(status));
}
@ -289,7 +289,7 @@ static void TestGetSetDateAPI()
/* this is supposed to open default date format, but later on it treats it like it is "en_US"
- very bad if you try to run the tests on machine where default locale is NOT "en_US" */
/*datdef=udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,NULL,fgGMTID,-1, &status);*/
datdef=udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,"en_US",fgGMTID,-1, &status);
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", myErrorName(status));
@ -473,7 +473,7 @@ static void TestFieldGetSet()
log_err("ucal_open failed: %s\n", myErrorName(status));
return;
}
datdef=udat_open(UDAT_SHORT,UDAT_SHORT ,NULL,fgGMTID,-1, &status);
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", myErrorName(status));
@ -882,7 +882,7 @@ static void TestDOWProgression()
return;
}
datfor=udat_open(UDAT_MEDIUM,UDAT_MEDIUM ,NULL, fgGMTID,-1, &status);
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", myErrorName(status));
}
@ -964,7 +964,7 @@ static void testZones(int32_t yr, int32_t mo, int32_t dt, int32_t hr, int32_t mn
return;
}
datfor=udat_open(UDAT_MEDIUM,UDAT_MEDIUM ,NULL, fgGMTID,-1, &status);
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", myErrorName(status));
}

View File

@ -55,7 +55,7 @@ static void TestDateFormat()
const char t[]="2/3/76 2:50 AM";*/
/*Testing udat_open() to open a dateformat */
log_verbose("\nTesting udat_open() with various parameters\n");
fr = udat_open(UDAT_FULL, UDAT_DEFAULT, "fr_FR", NULL,0, &status);
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",
@ -64,26 +64,26 @@ static void TestDateFormat()
/* this is supposed to open default date format, but later on it treats it like it is "en_US"
- very bad if you try to run the tests on machine where default locale is NOT "en_US" */
/* def = udat_open(UDAT_SHORT, UDAT_SHORT, NULL, NULL, 0, &status); */
def = udat_open(UDAT_SHORT, UDAT_SHORT, "en_US", NULL, 0, &status);
def = udat_open(UDAT_SHORT, UDAT_SHORT, "en_US", NULL, 0,NULL, 0, &status);
if(U_FAILURE(status))
{
log_err("FAIL: error in creating the dateformat using short date and time style\n %s\n",
myErrorName(status) );
}
it = udat_open(UDAT_DEFAULT, UDAT_MEDIUM, "it_IT", NULL, 0, &status);
it = udat_open(UDAT_DEFAULT, UDAT_MEDIUM, "it_IT", NULL, 0, NULL, 0,&status);
if(U_FAILURE(status))
{
log_err("FAIL: error in creating the dateformat using medium date style with italian locale\n %s\n",
myErrorName(status) );
}
de = udat_open(UDAT_LONG, UDAT_LONG, "de_DE", NULL, 0, &status);
de = udat_open(UDAT_LONG, UDAT_LONG, "de_DE", NULL, 0, NULL, 0,&status);
if(U_FAILURE(status))
{
log_err("FAIL: error in creating the dateformat using long time and date styles with german locale\n %s\n",
myErrorName(status));
}
/*creating a default dateformat */
def1 = udat_open(UDAT_SHORT, UDAT_SHORT, NULL, NULL, 0, &status);
def1 = 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\n %s\n",
@ -183,7 +183,7 @@ static void TestDateFormat()
status=U_ZERO_ERROR;
log_verbose("\nTesting the udat_openPattern with a specified pattern\n");
/*for french locale */
fr_pat=udat_openPattern(temp, u_strlen(temp), "fr_FR", &status);
fr_pat=udat_open(UDAT_IGNORE, UDAT_IGNORE,"fr_FR",NULL,0,temp, u_strlen(temp), &status);
if(U_FAILURE(status))
{
log_err("FAIL: Error in creating a date format using udat_openPattern \n %s\n",
@ -321,7 +321,7 @@ static void TestSymbols()
/*creating a dateformat with french locale */
log_verbose("\ncreating a date format with french locale\n");
fr = udat_open(UDAT_FULL, UDAT_DEFAULT, "fr_FR", NULL, 0, &status);
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",
@ -332,7 +332,7 @@ static void TestSymbols()
/* this is supposed to open default date format, but later on it treats it like it is "en_US"
- very bad if you try to run the tests on machine where default locale is NOT "en_US" */
/* def = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,NULL, NULL, 0, &status); */
def = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,"en_US", NULL, 0, &status);
def = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,"en_US", 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",

View File

@ -52,7 +52,7 @@ void TestTwoDigitYearDSTParse()
pattern=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("EEE MMM dd HH:mm:ss.SSS zzz yyyy G")+1 ));
u_uastrcpy(pattern, "EEE MMM dd HH:mm:ss.SSS zzz yyyy G");
fullFmt= udat_openPattern(pattern, u_strlen(pattern), "en_US", &status);
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",
myErrorName(status) );
@ -60,7 +60,7 @@ void TestTwoDigitYearDSTParse()
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_openPattern(pattern, u_strlen(pattern), "en_US", &status);
fmt= udat_open(UDAT_IGNORE,UDAT_IGNORE,"en_US", NULL, 0,pattern, u_strlen(pattern), &status);
s=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("03-Apr-04 2:20:47 o'clock AM PST")+1) );
@ -111,7 +111,7 @@ void TestPartialParse994()
/* this is supposed to open default date format, but later on it treats it like it is "en_US"
- very bad if you try to run the tests on machine where default locale is NOT "en_US" */
/* f = udat_open(UDAT_DEFAULT, UDAT_SHORT, NULL, NULL, 0, &status); */
f = udat_open(UDAT_DEFAULT, UDAT_SHORT, "en_US", 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));
}
@ -179,7 +179,7 @@ void TestRunTogetherPattern985()
UErrorCode status = U_ZERO_ERROR;
pattern=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("yyyyMMddHHmmssSSS")+1) );
u_uastrcpy(pattern, "yyyyMMddHHmmssSSS");
format = udat_openPattern(pattern, u_strlen(pattern), NULL, &status);
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));
}
@ -212,7 +212,7 @@ void TestCzechMonths459()
UDate june, july, d;
UErrorCode status = U_ZERO_ERROR;
fmt = udat_open(UDAT_FULL, UDAT_FULL, "cs", NULL, 0, &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"); }
lneed=0;
lneed=udat_toPattern(fmt, TRUE, NULL, lneed, &status);
@ -272,7 +272,7 @@ void TestQuotePattern161()
/* this is supposed to open default date format, but later on it treats it like it is "en_US"
- very bad if you try to run the tests on machine where default locale is NOT "en_US" */
/* format= udat_openPattern(pattern, u_strlen(pattern), NULL, &status); */
format= udat_openPattern(pattern, u_strlen(pattern), "en_US", &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_openPattern : %s\n", myErrorName(status)); }
tzID=(UChar*)uprv_malloc(sizeof(UChar) * 4);
u_uastrcpy(tzID, "PST");

View File

@ -56,7 +56,7 @@ void Test4029195()
log_verbose("Testing date format and parse function in regression test\n");
today = ucal_getNow();
df = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,"en_US", NULL, 0, &status);
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));
@ -152,7 +152,7 @@ void Test4056591()
u_uastrcpy(pat, "yyMMdd");
def = udat_openPattern(pat, u_strlen(pat), NULL, &status);
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));
@ -199,7 +199,7 @@ void Test4059917()
pattern=(UChar*)uprv_malloc(sizeof(UChar) * 11);
u_uastrcpy(pattern, "yyyy/MM/dd");
log_verbose("%s\n", austrdup(pattern) );
def = udat_openPattern(pattern, u_strlen(pattern), NULL, &status);
def = udat_open(UDAT_IGNORE,UDAT_IGNORE,NULL,NULL,0,pattern, u_strlen(pattern),&status);
if(U_FAILURE(status))
{
log_err("FAIL: error in creating the dateformat using openPattern: %s\n", myErrorName(status));
@ -211,7 +211,7 @@ void Test4059917()
udat_close(def);
u_uastrcpy(pattern, "yyyyMMdd");
def = udat_openPattern(pattern, u_strlen(pattern), NULL, &status);
def = udat_open(UDAT_IGNORE,UDAT_IGNORE,NULL,NULL,0,pattern, u_strlen(pattern),&status);
if(U_FAILURE(status))
{
log_err("FAIL: error in creating the dateformat using openPattern: %s\n", myErrorName(status));
@ -272,12 +272,12 @@ void Test4060212()
log_verbose( "dateString= %s Using yyyy-DDD.hh:mm:ss\n", austrdup(dateString) );
status = U_ZERO_ERROR;
formatter = udat_openPattern(pattern, u_strlen(pattern), "en_US", &status);
formatter = udat_open(UDAT_IGNORE,UDAT_IGNORE,"en_US",NULL,0,pattern, u_strlen(pattern), &status);
pos=0;
myDate = udat_parse(formatter, dateString, u_strlen(dateString), &pos, &status);
fmt = udat_open(UDAT_FULL,UDAT_LONG ,NULL, NULL, 0, &status);
fmt = udat_open(UDAT_FULL,UDAT_LONG ,NULL, 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",
@ -316,7 +316,7 @@ void Test4061287()
u_uastrcpy(pattern, "dd/mm/yyyy");
status = U_ZERO_ERROR;
log_verbose("Testing parsing by changing the attribute lenient\n");
df = udat_openPattern(pattern, u_strlen(pattern), NULL, &status);
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));
}
@ -369,7 +369,7 @@ void Test4073003()
"4/3/99"
};
fmt= udat_open(UDAT_SHORT,UDAT_SHORT ,NULL, NULL, 0, &status);
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",
@ -431,7 +431,7 @@ void Test4162071()
u_uastrcpy(format, "EEE', 'dd-MMM-yyyy HH:mm:ss z"); /* RFC 822/1123 */
status = U_ZERO_ERROR;
/* Can't hardcode the result to assume the default locale is "en_US". */
df = udat_openPattern(format, u_strlen(format), "en_US", &status);
df = udat_open(UDAT_IGNORE,UDAT_IGNORE,"en_US",NULL,0,format, u_strlen(format),&status);
if(U_FAILURE(status)){
log_err("ERROR: couldn't create date format: %s\n", myErrorName(status));
}
@ -456,7 +456,7 @@ void Test714(void)
UChar *result;
const char* expect = "7:25:43 AM";
fmt= udat_open(UDAT_MEDIUM,UDAT_NONE ,"en_US_CA", NULL, -1, &status);
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",

View File

@ -153,7 +153,7 @@ static void TestG7Locales()
defRules = ucol_getRules(myCollation, &rlen);
status = U_ZERO_ERROR;
tblColl1 = ucol_openRules(defRules, rlen, UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH,NULL, &status);
if (U_FAILURE(status))
{
@ -193,7 +193,7 @@ static void TestDemo1()
log_verbose("Demo Test 1 : Create a new table collation with rules \" & Z < p, P \" \n");
myCollation = ucol_openRules(temp, len, UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH,NULL, &status);
if (U_FAILURE(status))
{
@ -226,7 +226,7 @@ static void TestDemo2()
log_verbose("Demo Test 2 : Create a new table collation with rules \"& C < ch , cH, Ch, CH\"");
myCollation = ucol_openRules(temp, len, UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH, NULL, &status);
if (U_FAILURE(status))
{
@ -257,7 +257,7 @@ static void TestDemo3()
log_verbose("Demo Test 3 : Create a new table collation with rules \"& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'\" \n");
myCollation = ucol_openRules(temp, len, UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH, NULL, &status);
if (U_FAILURE(status))
{
@ -289,7 +289,7 @@ static void TestDemo4()
log_verbose("Demo Test 4 : Create a new table collation with rules \" & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' \"\n");
myCollation = ucol_openRules(temp, len, UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH, NULL, &status);
if (U_FAILURE(status))
{

View File

@ -44,9 +44,6 @@ static char* _testDirectory=NULL;
*/
void ctest_setICU_DATA();
int main(int argc, const char* const argv[])
{
int nerrors;

View File

@ -22,6 +22,10 @@ The main root for C API tests
#include "unicode/utypes.h"
#include "unicode/ctest.h"
#ifndef U_USE_DEPRECATED_API
#define U_USE_DEPRECATED_API 1
#endif
U_CFUNC void addAllTests(TestNode** root);
/**

View File

@ -361,7 +361,7 @@ static void TestNormalization()
UChar source[10];
UCollationElements *iter;
coll = ucol_openRules(rule, rulelen, UNORM_NFD, UCOL_TERTIARY, &status);
coll = ucol_openRules(rule, rulelen, UNORM_NFD, 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",
@ -441,7 +441,7 @@ static void TestPrevious()
/* Test with a contracting character sequence */
u_uastrcpy(rule, "&a,A < b,B < c,C, d,D < z,Z < ch,cH,Ch,CH");
c1 = ucol_openRules(rule, u_strlen(rule), UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
c1 = ucol_openRules(rule, u_strlen(rule), UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, NULL, &status);
log_verbose("Contraction rule testing back and forth with no normalization\n");
@ -465,7 +465,7 @@ static void TestPrevious()
/* Test with an expanding character sequence */
u_uastrcpy(rule, "&a < b < c/abd < d");
c2 = ucol_openRules(rule, u_strlen(rule), UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
c2 = ucol_openRules(rule, u_strlen(rule), UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, NULL, &status);
log_verbose("Expansion rule testing back and forth with no normalization\n");
if (c2 == NULL || U_FAILURE(status))
{
@ -485,7 +485,7 @@ static void TestPrevious()
ucol_close(c2);
/* Now try both */
u_uastrcpy(rule, "&a < b < c/aba < d < z < ch");
c3 = ucol_openRules(rule, u_strlen(rule), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status);
c3 = ucol_openRules(rule, u_strlen(rule), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH,NULL, &status);
log_verbose("Expansion/contraction rule testing back and forth with no normalization\n");
if (c3 == NULL || U_FAILURE(status))
@ -835,7 +835,7 @@ static void TestMaxExpansion()
UChar rule[256];
u_uastrcpy(rule, "&a < ab < c/aba < d < z < ch");
coll = ucol_openRules(rule, u_strlen(rule), UCOL_DEFAULT_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH,NULL, &status);
iter = ucol_openElements(coll, &ch, 1, &status);
while (ch < 0xFFFF && U_SUCCESS(status)) {
@ -931,7 +931,7 @@ static void TestMaxExpansion()
rule[9] = 0;
coll = ucol_openRules(rule, u_strlen(rule), UCOL_DEFAULT_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH,NULL, &status);
iter = ucol_openElements(coll, &ch, 1, &status);
temporder = ucol_previous(iter, &status);
@ -1439,7 +1439,7 @@ static void TestDiscontiguos() {
UCollationElements *resultiter;
coll = ucol_openRules(rule, rulelen, UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH,NULL, &status);
iter = ucol_openElements(coll, rule, 1, &status);
resultiter = ucol_openElements(coll, rule, 1, &status);
@ -1513,7 +1513,7 @@ static void TestCEBufferOverflow()
u_uastrcpy(rule, "&z < AB");
coll = ucol_openRules(rule, u_strlen(rule), UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH, NULL,&status);
if (U_FAILURE(status)) {
log_err("Rule based collator not created for testing ce buffer overflow\n");
}
@ -1684,7 +1684,7 @@ static void TestCEValidity()
char line[300];
UChar codepoints[5];
int count = 0;
UParseError parseError;
if (U_FAILURE(status)) {
log_err("en_US collator creation failed\n");
return;
@ -1755,7 +1755,7 @@ static void TestCEValidity()
while ((current = ucol_tok_parseNextToken(&src, &strength,
&chOffset, &chLen, &exOffset, &exLen,
&specs, startOfRules, &status)) != NULL) {
&specs, startOfRules, &parseError,&status)) != NULL) {
startOfRules = FALSE;
uprv_memcpy(codepoints, rules + chOffset,
chLen * sizeof(UChar));
@ -1852,7 +1852,7 @@ static void TestSortKeyValidity(void)
char line[300];
UChar codepoints[5];
int count = 0;
UParseError parseError;
if (U_FAILURE(status)) {
log_err("en_US collator creation failed\n");
return;
@ -1924,7 +1924,7 @@ static void TestSortKeyValidity(void)
while ((current = ucol_tok_parseNextToken(&src, &strength,
&chOffset, &chLen, &exOffset, &exLen,
&specs, startOfRules, &status)) != NULL) {
&specs, startOfRules,&parseError, &status)) != NULL) {
startOfRules = FALSE;
uprv_memcpy(codepoints, rules + chOffset,
chLen * sizeof(UChar));

View File

@ -28,6 +28,7 @@
#include "cmemory.h"
#include "ucmp32.h"
#include "cstring.h"
#include "unicode/parseerr.h"
#define MAX_TOKEN_LEN 16
@ -182,7 +183,7 @@ static void IncompleteCntTest( )
u_uastrcpy(temp, " & Z < ABC < Q < B");
coll = ucol_openRules(temp, u_strlen(temp), UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH, NULL,&status);
if(U_SUCCESS(status)) {
size = sizeof(cnt1)/sizeof(cnt1[0]);
@ -209,7 +210,7 @@ static void IncompleteCntTest( )
u_uastrcpy(temp, " & Z < DAVIS < MARK <DAV");
coll = ucol_openRules(temp, u_strlen(temp), UCOL_NO_NORMALIZATION,
UCOL_DEFAULT_STRENGTH, &status);
UCOL_DEFAULT_STRENGTH,NULL, &status);
if(U_SUCCESS(status)) {
size = sizeof(cnt2)/sizeof(cnt2[0]);
@ -638,7 +639,7 @@ static void testCollator(UCollator *coll, UErrorCode *status) {
UChar first[256];
UChar second[256];
UChar *rulesCopy = NULL;
UParseError parseError;
src.opts = &opts;
rules = ucol_getRules(coll, &ruleLen);
@ -650,10 +651,10 @@ static void testCollator(UCollator *coll, UErrorCode *status) {
src.extraCurrent = src.end;
src.extraEnd = src.end+UCOL_TOK_EXTRA_RULE_SPACE_SIZE;
*first = *second = 0;
while ((current = ucol_tok_parseNextToken(&src, &strength,
&chOffset, &chLen, &exOffset, &exLen,
&specs, startOfRules, status)) != NULL) {
&specs, startOfRules,&parseError, status)) != NULL) {
startOfRules = FALSE;
varT = (UBool)((specs & UCOL_TOK_VARIABLE_TOP) != 0);
top_ = (UBool)((specs & UCOL_TOK_TOP) != 0);
@ -961,6 +962,7 @@ static void testAgainstUCA(UCollator *coll, UCollator *UCA, const char *refName,
uint32_t UCAdiff = 0;
uint32_t Windiff = 1;
UParseError parseError;
src.opts = &opts;
@ -979,7 +981,7 @@ static void testAgainstUCA(UCollator *coll, UCollator *UCA, const char *refName,
while ((current = ucol_tok_parseNextToken(&src, &strength,
&chOffset, &chLen, &exOffset, &exLen,
&specs, startOfRules, status)) != NULL) {
&specs, startOfRules, &parseError,status)) != NULL) {
startOfRules = FALSE;
varT = (UBool)((specs & UCOL_TOK_VARIABLE_TOP) != 0);
top_ = (UBool)((specs & UCOL_TOK_TOP) != 0);
@ -1042,7 +1044,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
UBool startOfRules = TRUE;
UColTokenParser src;
UColOptionSet opts;
UParseError parseError;
UChar *rulesCopy = NULL;
collIterate c;
@ -1064,7 +1066,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
while ((current = ucol_tok_parseNextToken(&src, &strength,
&chOffset, &chLen, &exOffset, &exLen,
&specs, startOfRules, status)) != NULL) {
&specs, startOfRules, &parseError,status)) != NULL) {
startOfRules = FALSE;
varT = (UBool)((specs & UCOL_TOK_VARIABLE_TOP) != 0);
top_ = (UBool)((specs & UCOL_TOK_TOP) != 0);
@ -1262,7 +1264,7 @@ static void RamsRulesTest( ) {
log_verbose("Testing rule: %s\n", rulesToTest[i]);
u_uastrcpy(rule, rulesToTest[i]);
ruleLen = u_strlen(rule);
coll = ucol_openRules(rule, ruleLen, UCOL_NO_NORMALIZATION, UCOL_TERTIARY, &status);
coll = ucol_openRules(rule, ruleLen, UCOL_NO_NORMALIZATION, UCOL_TERTIARY, NULL,&status);
if(U_SUCCESS(status)) {
testCollator(coll, &status);
testCEs(coll, &status);
@ -1292,7 +1294,7 @@ static void IsTailoredTest( ) {
u_uastrcpy(notTailored, "ZabD");
notTailoredLen = u_strlen(notTailored);
coll = ucol_openRules(rule, ruleLen, UCOL_NO_NORMALIZATION, UCOL_TERTIARY, &status);
coll = ucol_openRules(rule, ruleLen, UCOL_NO_NORMALIZATION, UCOL_TERTIARY, NULL,&status);
if(U_SUCCESS(status)) {
for(i = 0; i<tailoredLen; i++) {
if(!isTailored(coll, tailored[i], &status)) {
@ -1347,7 +1349,7 @@ static void genericRulesStarterWithOptions(const char *rules, const char *s[], u
uint32_t i;
/* Changed UCOL_DEFAULT -> UCOL_DEFAULT_NORMALIZATION due to an inconsistent API and compiler errors */
UCollator *coll = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, &status);
UCollator *coll = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT,NULL, &status);
log_verbose("Rules starter for %s\n", rules);
@ -1369,7 +1371,7 @@ static void genericRulesStarter(const char *rules, const char *s[], uint32_t siz
uint32_t rlen = u_unescape(rules, rlz, 2048);
/* Changed UCOL_DEFAULT -> UCOL_DEFAULT_NORMALIZATION due to an inconsistent API and compiler errors */
UCollator *coll = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, &status);
UCollator *coll = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT,NULL, &status);
log_verbose("Rules starter for %s\n", rules);
@ -1445,7 +1447,7 @@ static void TestImplicitTailoring(void) {
UCollator *coll = NULL;
ruleLen = u_unescape(rule, t1, 256);
coll = ucol_openRules(t1, ruleLen, UCOL_NO_NORMALIZATION, UCOL_TERTIARY, &status);
coll = ucol_openRules(t1, ruleLen, UCOL_NO_NORMALIZATION, UCOL_TERTIARY,NULL, &status);
if(U_SUCCESS(status)) {
size = sizeof(impTest)/sizeof(impTest[0]);
@ -1564,7 +1566,7 @@ static void TestComposeDecompose(void) {
static void TestEmptyRule() {
UErrorCode status = U_ZERO_ERROR;
UChar rulez[] = { 0 };
UCollator *coll = ucol_openRules(rulez, 0, UCOL_NO_NORMALIZATION, UCOL_TERTIARY, &status);
UCollator *coll = ucol_openRules(rulez, 0, UCOL_NO_NORMALIZATION, UCOL_TERTIARY,NULL, &status);
ucol_close(coll);
}
@ -1583,7 +1585,7 @@ static void TestUCARules() {
ruleLen = ucol_getRulesEx(coll, UCOL_FULL_RULES, rules, ruleLen);
}
log_verbose("Rules length is %d\n", ruleLen);
UCAfromRules = ucol_openRules(rules, ruleLen, UNORM_NONE, UCOL_TERTIARY, &status);
UCAfromRules = ucol_openRules(rules, ruleLen, UNORM_NONE, UCOL_TERTIARY, NULL,&status);
if(U_SUCCESS(status)) {
ucol_close(UCAfromRules);
} else {
@ -1783,9 +1785,9 @@ static void TestRedundantRules() {
rlen = u_unescape(rules[i], rlz, 2048);
/* Changed UCOL_DEFAULT -> UCOL_DEFAULT_NORMALIZATION due to an inconsistent API and compiler errors */
credundant = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, &status);
credundant = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, NULL,&status);
rlen = u_unescape(expectedRules[i], rlz, 2048);
cresulting = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, &status);
cresulting = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, NULL,&status);
testAgainstUCA(cresulting, credundant, "expected", TRUE, &status);
@ -1839,9 +1841,9 @@ static void TestExpansionSyntax() {
rlen = u_unescape(rules[i], rlz, 2048);
/* Changed UCOL_DEFAULT -> UCOL_DEFAULT_NORMALIZATION due to an inconsistent API and compiler errors */
credundant = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, &status);
credundant = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT,NULL, &status);
rlen = u_unescape(expectedRules[i], rlz, 2048);
cresulting = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, &status);
cresulting = ucol_openRules(rlz, rlen, UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT, NULL,&status);
/* testAgainstUCA still doesn't handle expansions correctly, so this is not run */
/* as a hard error test, but only in information mode */
@ -1910,7 +1912,7 @@ static void TestCase( )
}
ucol_close(myCollation);
myCollation = ucol_openRules(gRules, u_strlen(gRules), UNORM_NONE, UCOL_TERTIARY, &status);
myCollation = ucol_openRules(gRules, u_strlen(gRules), UNORM_NONE, UCOL_TERTIARY,NULL, &status);
if(U_FAILURE(status)){
log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status));
return;
@ -2373,7 +2375,7 @@ static void TestContraction() {
int j = 0;
log_verbose("Rule %s for testing\n", testrules[i]);
rlen = u_unescape(testrules[i], rule, 32);
coll = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY, &status);
coll = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY,NULL, &status);
if (U_FAILURE(status)) {
log_err("Collator creation failed %s\n", testrules[i]);
return;
@ -2412,7 +2414,7 @@ static void TestContraction() {
}
rlen = u_unescape("& a < b < c < ch < d & c = ch / h", rule, 256);
coll = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY, &status);
coll = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY,NULL, &status);
if (ucol_strcoll(coll, testdata2[0], 2, testdata2[1], 2) != UCOL_LESS) {
log_err("Expected \\u%04x\\u%04x < \\u%04x\\u%04x\n",
testdata2[0][0], testdata2[0][1], testdata2[1][0],
@ -2435,9 +2437,9 @@ static void TestContraction() {
UChar ch = 0x0042 /* 'B' */;
uint32_t ce;
rlen = u_unescape(testrules3[i], rule, 32);
coll1 = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY, &status);
coll1 = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY,NULL, &status);
rlen = u_unescape(testrules3[i + 1], rule, 32);
coll2 = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY, &status);
coll2 = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY,NULL, &status);
if (U_FAILURE(status)) {
log_err("Collator creation failed %s\n", testrules[i]);
return;
@ -2499,7 +2501,7 @@ static void TestExpansion() {
int j = 0;
log_verbose("Rule %s for testing\n", testrules[i]);
rlen = u_unescape(testrules[i], rule, 32);
coll = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY, &status);
coll = ucol_openRules(rule, rlen, UNORM_NFD, UCOL_TERTIARY,NULL, &status);
if (U_FAILURE(status)) {
log_err("Collator creation failed %s\n", testrules[i]);
return;
@ -2644,7 +2646,7 @@ static void TestVariableTopSetting() {
UChar first[256] = { 0 };
UChar second[256] = { 0 };
UParseError parseError;
src.opts = &opts;
log_verbose("Slide variable top over UCARules\n");
@ -2661,7 +2663,7 @@ static void TestVariableTopSetting() {
while ((current = ucol_tok_parseNextToken(&src, &strength,
&chOffset, &chLen, &exOffset, &exLen,
&specs, startOfRules, &status)) != NULL) {
&specs, startOfRules, &parseError,&status)) != NULL) {
startOfRules = FALSE;
if(0) {
log_verbose("%04X %d ", *(rulesCopy+chOffset), chLen);

View File

@ -29,7 +29,7 @@ static const char* txt_testCasePatterns[] = {
"Quotes '', '{', a {0,number,integer} '{'0}",
"Quotes '', '{', a {0,number,integer} '{'0}",
"You deposited {0,number,integer} times an amount of {1,number,currency} on {2,date,short}",
"'{'2,time,full}, for {1, number, integer}, {0,number,integer} is {2,time,full} and full date is {2,date,full}",
"'{'2,time,full}, for {1, number }, {0,number,integer} is {2,time,full} and full date is {2,date,full}",
"'{'1,number,percent} for {0,number,integer} is {1,number,percent}",
};
@ -278,11 +278,7 @@ static void TestSampleFormatAndParse()
/*try to parse this and check*/
log_verbose("\nTesting the parse Message test#5\n");
def1 = udat_open(UDAT_DEFAULT,UDAT_DEFAULT ,NULL, 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));
}
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));
@ -292,15 +288,19 @@ static void TestSampleFormatAndParse()
else
log_verbose("PASS: parseMessage successful on test#5\n");
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));
}else{
if(u_strcmp(myDateFormat(def1, d), myDateFormat(def1, d1))==0)
log_verbose("PASS: parseMessage successful test#5\n");
else{
log_err("FAIL: parseMessage didn't parse the date successfully\n GOT: %s EXPECTED %s\n",
austrdup(myDateFormat(def1,d)), austrdup(myDateFormat(def1,d1)) );
if(u_strcmp(myDateFormat(def1, d), myDateFormat(def1, d1))==0)
log_verbose("PASS: parseMessage successful test#5\n");
else{
log_err("FAIL: parseMessage didn't parse the date successfully\n GOT: %s EXPECTED %s\n",
austrdup(myDateFormat(def1,d)), austrdup(myDateFormat(def1,d1)) );
}
}
udat_close(def1);
ucal_close(cal);
@ -586,6 +586,77 @@ static void TestJ904(void) {
log_err("FAIL: got \"%s\", expected \"%s\"\n", cresult, EXP);
}
}
void TestMessageFormat(void)
{
UMessageFormat *f1, *f2, *f3;
UChar pattern[256];
UChar result[256];
char cresult[256];
UParseError parseError;
char* locale = "hi_IN";
char* retLoc;
char* PAT = "Number {1,number,#0.000}, String {0}, Date {2,date,12:mm:ss.SSS}";
int32_t length=0;
UErrorCode status = U_ZERO_ERROR;
u_austrcpy(PAT,pattern);
/* Test umsg_open */
f1 = umsg_open(pattern,length,NULL,NULL,&status);
if(U_FAILURE(status))
{
log_err("umsg_open failed with pattern %s. Error: \n", PAT, u_errorName(status));
}
/* Test umsg_open with parse error */
status = U_ZERO_ERROR;
f2 = umsg_open(pattern,length,NULL,&parseError,&status);
if(U_FAILURE(status))
{
log_err("umsg_open with parseError failed with pattern %s. Error: %s\n", PAT, u_errorName(status));
}
/* Test umsg_clone */
status = U_ZERO_ERROR;
f3 = umsg_clone(f1,&status);
if(U_FAILURE(status))
{
log_err("umsg_clone failed. Error %s \n", u_errorName(status));
}
/* Test umsg_setLocale */
umsg_setLocale(f1,locale);
/* Test umsg_getLocale */
retLoc = (char*)umsg_getLocale(f1);
if(strcmp(retLoc,locale)!=0)
{
log_err("umsg_setLocale and umsg_getLocale methods failed. Expected:%s Got: %s \n", locale, retLoc);
}
/* Test umsg_applyPattern */
status = U_ZERO_ERROR;
umsg_applyPattern(f1,pattern,strlen(PAT),NULL,&status);
if(U_FAILURE(status))
{
log_err("umsg_applyPattern failed. Error %s \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));
}
if(u_strcmp(result,pattern)!=0){
u_UCharsToChars(result,cresult,256);
log_err("umsg_toPattern method failed. Expected: %s Got: %s \n",PAT,cresult);
}
/* umsg_format umsg_parse */
}
void addMsgForTest(TestNode** root);

View File

@ -63,7 +63,7 @@ static void TestPatterns(void)
{
status = U_ZERO_ERROR;
u_uastrcpy(upat, pat[i]);
fmt= unum_openPattern(upat, u_strlen(upat), "en_US", &status);
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]);
continue;
@ -116,7 +116,7 @@ static void TestQuotes(void)
char tempBuf[256];
log_verbose("\nTestting the handling of quotes in number format\n");
u_uastrcpy(pat, "a'fo''o'b#");
fmt =unum_openPattern(pat, u_strlen(pat), "en_US", &status);
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");
}
@ -144,7 +144,7 @@ static void TestQuotes(void)
u_uastrcpy(pat, "a''b#");
fmt =unum_openPattern(pat, u_strlen(pat), "en_US", &status);
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''b#\"\n");
}
@ -237,7 +237,7 @@ static void TestExponential(void)
{
upat=(UChar*)uprv_malloc(sizeof(UChar) * (strlen(pat[p])+1) );
u_uastrcpy(upat, pat[p]);
fmt=unum_openPattern(upat, u_strlen(upat), "en_US", &status);
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]");
continue;
@ -333,7 +333,7 @@ static void TestCurrencySign(void)
pattern=(UChar*)uprv_malloc(sizeof(UChar) * (strlen("*#,##0.00;-*#,##0.00") + 1) );
u_uastrcpy(pattern, "*#,##0.00;-*#,##0.00");
pattern[0]=pattern[11]=0xa4; /* insert latin-1 currency symbol */
fmt = unum_openPattern(pattern, u_strlen(pattern), "en_US", &status);
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");
}
@ -399,7 +399,7 @@ static void TestCurrency(void)
log_verbose("\nTesting the number format with different currency patterns\n");
for(i=0; i < 3; i++)
{
currencyFmt = unum_open(UNUM_CURRENCY, locale[i], &status);
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",
myErrorName(status));
@ -433,7 +433,7 @@ static void TestRounding487(void)
/* this is supposed to open default date format, but later on it treats it like it is "en_US"
- very bad if you try to run the tests on machine where default locale is NOT "en_US" */
/* nnf = unum_open(UNUM_DEFAULT, NULL, &status); */
nnf = unum_open(UNUM_DEFAULT, "en_US", &status);
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));
}
@ -493,7 +493,7 @@ static void TestDoubleAttribute(void)
UNumberFormatAttribute attr;
UNumberFormatStyle style= UNUM_DEFAULT;
UNumberFormat *def;
def=unum_open(style, NULL, &status);
def=unum_open(style, NULL,0,NULL,NULL, &status);
log_verbose("\nTesting get and set DoubleAttributes\n");
attr=UNUM_ROUNDING_INCREMENT;
dvalue=unum_getDoubleAttribute(def, attr);
@ -515,7 +515,7 @@ static void TestDoubleAttribute(void)
static void TestSecondaryGrouping(void) {
UErrorCode status = U_ZERO_ERROR;
UNumberFormat *f = NULL, *g= NULL;
UNumberFormat *us = unum_open(UNUM_DECIMAL, "en_US", &status);
UNumberFormat *us = unum_open(UNUM_DECIMAL,NULL,0, "en_US", NULL,&status);
UNumberFormatSymbols usSymbols;
UFieldPosition pos;
UChar resultBuffer[512];
@ -529,7 +529,7 @@ static void TestSecondaryGrouping(void) {
CHECK(status, "DecimalFormatSymbols ct");
u_uastrcpy(buffer, "#,##,###");
f = unum_openPattern(buffer, -1, "en_US", &status);
f = unum_open(UNUM_IGNORE,buffer, -1, "en_US",NULL, &status);
CHECK(status, "DecimalFormat ct");
pos.field = 0;
@ -551,7 +551,7 @@ static void TestSecondaryGrouping(void) {
}
memset(resultBuffer,0, sizeof(UChar)*512);
u_uastrcpy(buffer, "#,###");
unum_applyPattern(f, FALSE, buffer, -1);
unum_applyPattern(f, FALSE, buffer, -1,NULL,NULL);
if (U_FAILURE(status))
{
log_err("Fail: applyPattern call failed\n");
@ -571,7 +571,7 @@ static void TestSecondaryGrouping(void) {
log_err("Fail: toPattern() got %s, expected %s\n", resultBuffer, "#,####,###");
}
memset(resultBuffer,0, sizeof(UChar)*512);
g = unum_open(UNUM_DECIMAL, "hi_IN", &status);
g = unum_open(UNUM_DECIMAL, NULL,0,"hi_IN",NULL, &status);
if (U_FAILURE(status))
{
log_err("Fail: Cannot create UNumberFormat for \"hi_IN\" locale.\n");

View File

@ -69,37 +69,37 @@ static void TestNumberFormat()
/* Testing unum_open() with various Numberformat styles and locales*/
status = U_ZERO_ERROR;
log_verbose("Testing unum_open() with default style and locale\n");
def=unum_open(style, NULL, &status);
def=unum_open(style, NULL,0,NULL, NULL,&status);
if(U_FAILURE(status))
log_err("Error in creating NumberFormat default using unum_open(): %s\n", myErrorName(status));
log_verbose("\nTesting unum_open() with french locale and default style(decimal)\n");
fr=unum_open(style, "fr_FR", &status);
fr=unum_open(style,NULL,0, "fr_FR",NULL, &status);
if(U_FAILURE(status))
log_err("Error: could not create NumberFormat (french): %s\n", myErrorName(status));
log_verbose("\nTesting unum_open(currency,NULL,status)\n");
style=UNUM_CURRENCY;
/* Can't hardcode the result to assume the default locale is "en_US". */
cur_def=unum_open(style, "en_US", &status);
cur_def=unum_open(style, NULL,0,"en_US", NULL, &status);
if(U_FAILURE(status))
log_err("Error: could not create NumberFormat using \n unum_open(currency, NULL, &status) %s\n",
myErrorName(status) );
log_verbose("\nTesting unum_open(currency, frenchlocale, status)\n");
cur_fr=unum_open(style, "fr_FR", &status);
cur_fr=unum_open(style,NULL,0, "fr_FR", NULL, &status);
if(U_FAILURE(status))
log_err("Error: could not create NumberFormat using unum_open(currency, french, &status): %s\n",
myErrorName(status));
log_verbose("\nTesting unum_open(percent, NULL, status)\n");
style=UNUM_PERCENT;
per_def=unum_open(style, NULL, &status);
per_def=unum_open(style,NULL,0, NULL,NULL, &status);
if(U_FAILURE(status))
log_err("Error: could not create NumberFormat using unum_open(percent, NULL, &status): %s\n", myErrorName(status));
log_verbose("\nTesting unum_open(percent,frenchlocale, status)\n");
per_fr=unum_open(style, "fr_FR", &status);
per_fr=unum_open(style, NULL,0,"fr_FR", NULL,&status);
if(U_FAILURE(status))
log_err("Error: could not create NumberFormat using unum_open(percent, french, &status): %s\n", myErrorName(status));
@ -293,7 +293,7 @@ uprv_free(result);
/* create a number format using unum_openPattern(....)*/
log_verbose("\nTesting unum_openPattern()\n");
u_uastrcpy(temp1, "#,##0.0#;(#,##0.0#)");
pattern=unum_openPattern(temp1, u_strlen(temp1), NULL, &status);
pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), NULL, NULL,&status);
if(U_FAILURE(status))
{
log_err("error in unum_openPattern(): %s\n", myErrorName(status) );;
@ -343,7 +343,7 @@ uprv_free(result);
}
status=U_ZERO_ERROR;
cur_frpattern=unum_openPattern(result, u_strlen(result), "fr_FR", &status);
cur_frpattern=unum_open(UNUM_IGNORE,result, u_strlen(result), "fr_FR",NULL, &status);
if(U_FAILURE(status))
{
log_err("error in unum_openPattern(): %s\n", myErrorName(status));
@ -375,7 +375,7 @@ uprv_free(result);
if(U_FAILURE(status)){
log_err("Fail: error in unum_setSymbols: %s\n", myErrorName(status));
}
unum_applyPattern(cur_frpattern, FALSE, result, u_strlen(result));
unum_applyPattern(cur_frpattern, FALSE, result, u_strlen(result),NULL,NULL);
unum_getSymbols(cur_frpattern, &symbols2);
if((symbols1.decimalSeparator != symbols2.decimalSeparator) ||
(symbols1.groupingSeparator != symbols2.groupingSeparator) ||
@ -623,7 +623,7 @@ static void TestNumberFormatPadding()
log_verbose("\nTesting unum_openPattern() with padding\n");
u_uastrcpy(temp1, "*#,##0.0#*;(#,##0.0#)");
status=U_ZERO_ERROR;
pattern=unum_openPattern(temp1, u_strlen(temp1), NULL, &status);
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) );;
@ -636,7 +636,7 @@ static void TestNumberFormatPadding()
/* u_uastrcpy(temp1, "*x#,###,###,##0.0#;(*x#,###,###,##0.0#)"); */
u_uastrcpy(temp1, "*x#,###,###,##0.0#;*x(###,###,##0.0#)");
status=U_ZERO_ERROR;
pattern=unum_openPattern(temp1, u_strlen(temp1), "en_US", &status);
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) );;