/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2006, International Business Machines Corporation and
+ * Copyright (c) 1997-2008, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
}
if(U_FAILURE(status)){
log_err("ERROR: failure in message format on testcase %d: %s\n", i, myErrorName(status) );
+ continue;
}
if(u_strcmp(result, testResultStrings[i])==0){
log_verbose("PASS: MessagFormat successful on testcase : %d\n", i);
if(U_FAILURE(status)){
log_err("Error: failure in message format on test#1: %s\n", myErrorName(status));
}
- if(u_strcmp(result, expected)==0)
+ else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#1\n");
else{
log_err("FAIL: Error in MessageFormat on test#1 \n GOT: %s EXPECTED: %s\n",
if(U_FAILURE(status)){
log_err("Error: failure in message format on test#2 : %s\n", myErrorName(status));
}
- if(u_strcmp(result, expected)==0)
+ else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#2\n");
else{
log_err("FAIL: Error in MessageFormat on test#2\n GOT: %s EXPECTED: %s\n",
if(U_FAILURE(status)){
log_err("Error: failure in message format on test#3 : %s\n", myErrorName(status));
}
- if(u_strcmp(result, expected)==0)
+ else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#3\n");
else{
log_err("FAIL: Error in MessageFormat on test#3\n GOT: %s EXPECTED %s\n", austrdup(result),
static void TestNewFormatAndParseAPI(void)
{
- UChar *result, *tzID, *str;
+ UChar *result, tzID[4], str[25];
UChar pattern[100];
UChar expected[100];
int32_t resultLengthOut, resultlength;
log_verbose("Testing format and parse with parse error\n");
- str=(UChar*)malloc(sizeof(UChar) * 25);
u_uastrcpy(str, "disturbance in force");
- tzID=(UChar*)malloc(sizeof(UChar) * 4);
u_uastrcpy(tzID, "PST");
cal=ucal_open(tzID, u_strlen(tzID), "en_US", UCAL_TRADITIONAL, &status);
if(U_FAILURE(status)){
ucal_close(cal);
free(result);
- free(str);
- free(tzID);
ctest_resetTimeZone();
}
if(U_FAILURE(status)){
log_err("ERROR: failure in message format test#4: %s\n", myErrorName(status));
}
- if(u_strcmp(result, expected)==0)
+ else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#4\n");
else{
log_err("FAIL: Error in MessageFormat on test#4\n GOT: %s EXPECTED: %s\n", austrdup(result),
if(U_FAILURE(status)){
log_err("ERROR: error in parsing: test#5: %s\n", myErrorName(status));
}
- if(value!=7 && u_strcmp(str,ret)!=0)
+ else if(value!=7 && u_strcmp(str,ret)!=0)
log_err("FAIL: Error in parseMessage on test#5 \n");
else
log_verbose("PASS: parseMessage successful on test#5\n");
if(U_FAILURE(status)){
log_err("ERROR: failure in message format test#4: %s\n", myErrorName(status));
}
- if(u_strcmp(result, expected)==0)
+ else if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#4\n");
else{
log_err("FAIL: Error in MessageFormat on test#4\n GOT: %s EXPECTED: %s\n", austrdup(result),
if(U_FAILURE(status)){
log_err("ERROR: error in parsing: test#5: %s\n", myErrorName(status));
}
- if(value!=7 && u_strcmp(str,ret)!=0)
+ else if(value!=7 && u_strcmp(str,ret)!=0)
log_err("FAIL: Error in parseMessage on test#5 \n");
else
log_verbose("PASS: parseMessage successful on test#5\n");
if(U_FAILURE(status)){
log_err("ERROR: failure in parse Message on test#9: %s\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");
if(U_FAILURE(status)){
log_err("ERROR: failure in parse Message on test#10: %s\n", myErrorName(status));
}
- if(value==123.00 && u_strcmp(str,res)==0)
+ 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");
if(U_FAILURE(status)){
log_err("ERROR: failure in message format on testcase %d: %s\n", i, myErrorName(status) );
}
- if(u_strcmp(result, testResultStrings[i])==0){
+ else if(u_strcmp(result, testResultStrings[i])==0){
log_verbose("PASS: MessagFormat successful on testcase : %d\n", i);
}
else{
if(U_FAILURE(status)){
log_err("ERROR: failure in parse Message on test#10: %s\n", myErrorName(status));
}
- if(value==123.00 && u_strcmp(str,res)==0)
+ 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");
umsg_open(NULL, 0, NULL, NULL, &status);
umsg_applyPattern(NULL, NULL, 0, NULL, &status);
+ umsg_toPattern(NULL, NULL, 0, &status);
umsg_clone(NULL, &status);
+ umsg_format(NULL, NULL, 0, &status);
+ umsg_parse(NULL, NULL, 0, NULL, &status);
umsg_close(NULL);
/* All of this code should have done nothing. */
if (status != U_USELESS_COLLATOR_ERROR) {
log_err("Status got changed to %s\n", u_errorName(status));
}
+
+ status = U_ZERO_ERROR;
+ umsg_open(NULL, 0, NULL, NULL, &status);
+ if (status != U_ILLEGAL_ARGUMENT_ERROR) {
+ log_err("Status should be U_ILLEGAL_ARGUMENT_ERROR instead of %s\n", u_errorName(status));
+ }
+ status = U_ZERO_ERROR;
+ umsg_applyPattern(NULL, NULL, 0, NULL, &status);
+ if (status != U_ILLEGAL_ARGUMENT_ERROR) {
+ log_err("Status should be U_ILLEGAL_ARGUMENT_ERROR instead of %s\n", u_errorName(status));
+ }
+ status = U_ZERO_ERROR;
+ umsg_toPattern(NULL, NULL, 0, &status);
+ if (status != U_ILLEGAL_ARGUMENT_ERROR) {
+ log_err("Status should be U_ILLEGAL_ARGUMENT_ERROR instead of %s\n", u_errorName(status));
+ }
+ status = U_ZERO_ERROR;
+ umsg_clone(NULL, &status);
+ if (status != U_ILLEGAL_ARGUMENT_ERROR) {
+ log_err("Status should be U_ILLEGAL_ARGUMENT_ERROR instead of %s\n", u_errorName(status));
+ }
}
void addMsgForTest(TestNode** root);