ICU-714 handle NONE date format properly [test]
X-SVN-Rev: 2903
This commit is contained in:
parent
917fc49029
commit
146231f675
@ -37,8 +37,7 @@ void addDateForRgrTest(TestNode** root)
|
||||
addTest(root, &Test4061287, "tsformat/cdtrgtst/Test4061287");
|
||||
addTest(root, &Test4073003, "tsformat/cdtrgtst/Test4073003");
|
||||
addTest(root, &Test4162071, "tsformat/cdtrgtst/Test4162071");
|
||||
|
||||
|
||||
addTest(root, &Test714, "tsformat/cdtrgtst/Test714");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -449,6 +448,33 @@ void Test4162071()
|
||||
udat_close(df);
|
||||
}
|
||||
|
||||
void Test714(void)
|
||||
{
|
||||
UDate d=978103543000.0;
|
||||
UChar temp[20];
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UDateFormat *fmt;
|
||||
UChar *result;
|
||||
const char* expect = "7:25:43 AM";
|
||||
|
||||
fmt= udat_open(UDAT_MEDIUM,UDAT_NONE ,"en_US_CA", NULL, -1, &status);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("FAIL: error in creating the dateformat using medium time style and NO date style: %s\n",
|
||||
myErrorName(status));
|
||||
}
|
||||
result =myFormatit(fmt, d);
|
||||
u_uastrcpy(temp, expect);
|
||||
if (u_strcmp(result, temp)!=0){
|
||||
log_err("Fail: %s != %s\n", austrdup(result), expect);
|
||||
}
|
||||
else{
|
||||
log_verbose("Ok: %s == %s\n", austrdup(result), expect );
|
||||
}
|
||||
|
||||
udat_close(fmt);
|
||||
}
|
||||
|
||||
/*INTERNAL FUNCTION USED */
|
||||
|
||||
UChar* myFormatit(UDateFormat* datdef, UDate d1)
|
||||
|
@ -29,6 +29,7 @@
|
||||
void Test4061287(void);
|
||||
void Test4073003(void);
|
||||
void Test4162071(void);
|
||||
void Test714(void);
|
||||
|
||||
/**
|
||||
* test subroutine
|
||||
|
@ -49,7 +49,7 @@ DateFormatRegressionTest::runIndexedTest( int32_t index, UBool exec, const char*
|
||||
CASE(21,Test4162071)
|
||||
CASE(22,Test4182066)
|
||||
CASE(23,Test4210209)
|
||||
|
||||
CASE(24,Test714)
|
||||
default: name = ""; break;
|
||||
}
|
||||
}
|
||||
@ -1141,4 +1141,34 @@ DateFormatRegressionTest::Test4210209(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void DateFormatRegressionTest::Test714(void)
|
||||
{
|
||||
//try {
|
||||
UDate d(978103543000.);
|
||||
DateFormat *fmt = DateFormat::createDateTimeInstance(DateFormat::NONE,
|
||||
DateFormat::MEDIUM,
|
||||
Locale::US);
|
||||
UnicodeString s;
|
||||
UnicodeString tests =
|
||||
(UnicodeString) "7:25:43 AM" ;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
fmt->format (d,s);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
errln((UnicodeString) "Fail, errmsg " + u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
if(s != tests)
|
||||
{
|
||||
errln((UnicodeString) "Fail: " + s + " != " + tests);
|
||||
}
|
||||
else
|
||||
{
|
||||
logln("OK: " + s + " == " + tests);
|
||||
}
|
||||
|
||||
delete fmt;
|
||||
}
|
||||
|
||||
//eof
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
void Test4162071(void);
|
||||
void Test4182066(void);
|
||||
void Test4210209(void);
|
||||
void Test714(void);
|
||||
};
|
||||
|
||||
#endif // _DATEFORMATREGRESSIONTEST_
|
||||
|
Loading…
Reference in New Issue
Block a user