mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
ICU-7635 Reintroduce testcase in platform neutral fashion
X-SVN-Rev: 30875
This commit is contained in:
parent
eefa1cd982
commit
2dc5656d64
1 changed files with 54 additions and 48 deletions
|
@ -1966,58 +1966,64 @@ static void TestNBSPInPattern(void) {
|
|||
|
||||
|
||||
}
|
||||
static void TestCloneWithRBNF(void) {
|
||||
/* const wchar_t* pattern = L"\
|
||||
//%main:0.x: >%%millis-only>;\n\
|
||||
//x.0: <%%duration<;\n\
|
||||
//x.x: <%%durationwithmillis<>%%millis-added>;\n\
|
||||
//-x: ->>;%%millis-only:\n\
|
||||
//1000: 00:00.<%%millis<;\n\
|
||||
//%%millis-added:\n\
|
||||
//1000: .<%%millis<;\n\
|
||||
//%%millis:\n\
|
||||
//0: =000=;\n\
|
||||
//%%duration:\n\
|
||||
//0: =%%seconds-only=;\n\
|
||||
//60: =%%min-sec=;\n\
|
||||
//3600: =%%hr-min-sec=;\n\
|
||||
//86400/86400: <%%ddaayyss<[, >>];\n\
|
||||
//%%durationwithmillis:\n\
|
||||
//0: =%%seconds-only=;\n\
|
||||
//60: =%%min-sec=;\n\
|
||||
//3600: =%%hr-min-sec=;\n\
|
||||
//86400/86400: <%%ddaayyss<, >>;\n\
|
||||
//%%seconds-only:\n\
|
||||
//0: 0:00:=00=;\n\
|
||||
//%%min-sec:\n\
|
||||
//0: :=00=;\n\
|
||||
//0/60: 0:<00<>>;\n\
|
||||
//%%hr-min-sec:\n\
|
||||
//0: :=00=;\n\
|
||||
//60/60: <00<>>;\n\
|
||||
//3600/60: <0<:>>>;\n\
|
||||
//%%ddaayyss:\n\
|
||||
//0 days;\n\
|
||||
//1 day;\n\
|
||||
//=0= days;";
|
||||
static void TestCloneWithRBNF(void) {
|
||||
UChar pattern[1024];
|
||||
UChar pat2[512];
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UChar buffer[256];
|
||||
UChar buffer_cloned[256];
|
||||
char temp1[256];
|
||||
char temp2[256];
|
||||
UNumberFormat *pform_cloned;
|
||||
UNumberFormat *pform;
|
||||
|
||||
// UErrorCode status = U_ZERO_ERROR;
|
||||
// UChar buffer[256];
|
||||
// UChar buffer_cloned[256];
|
||||
// char temp1[256];
|
||||
// char temp2[256];
|
||||
u_uastrcpy(pattern,
|
||||
"%main:\n"
|
||||
"0.x: >%%millis-only>;\n"
|
||||
"x.0: <%%duration<;\n"
|
||||
"x.x: <%%durationwithmillis<>%%millis-added>;\n"
|
||||
"-x: ->>;%%millis-only:\n"
|
||||
"1000: 00:00.<%%millis<;\n"
|
||||
"%%millis-added:\n"
|
||||
"1000: .<%%millis<;\n"
|
||||
"%%millis:\n"
|
||||
"0: =000=;\n"
|
||||
"%%duration:\n"
|
||||
"0: =%%seconds-only=;\n"
|
||||
"60: =%%min-sec=;\n"
|
||||
"3600: =%%hr-min-sec=;\n"
|
||||
"86400/86400: <%%ddaayyss<[, >>];\n"
|
||||
"%%durationwithmillis:\n"
|
||||
"0: =%%seconds-only=;\n"
|
||||
"60: =%%min-sec=;\n"
|
||||
"3600: =%%hr-min-sec=;\n"
|
||||
"86400/86400: <%%ddaayyss<, >>;\n");
|
||||
u_uastrcpy(pat2,
|
||||
"%%seconds-only:\n"
|
||||
"0: 0:00:=00=;\n"
|
||||
"%%min-sec:\n"
|
||||
"0: :=00=;\n"
|
||||
"0/60: 0:<00<>>;\n"
|
||||
"%%hr-min-sec:\n"
|
||||
"0: :=00=;\n"
|
||||
"60/60: <00<>>;\n"
|
||||
"3600/60: <0<:>>>;\n"
|
||||
"%%ddaayyss:\n"
|
||||
"0 days;\n"
|
||||
"1 day;\n"
|
||||
"=0= days;");
|
||||
|
||||
// UNumberFormat *pform_cloned;
|
||||
// UNumberFormat *pform = unum_open(UNUM_PATTERN_RULEBASED, pattern, -1, "en_US", NULL, &status);
|
||||
/* This is to get around some compiler warnings about char * string length. */
|
||||
u_strcat(pattern, pat2);
|
||||
|
||||
// unum_formatDouble(pform, 3600, buffer, 256, NULL, &status);
|
||||
pform = unum_open(UNUM_PATTERN_RULEBASED, pattern, -1, "en_US", NULL, &status);
|
||||
unum_formatDouble(pform, 3600, buffer, 256, NULL, &status);
|
||||
|
||||
// pform_cloned = unum_clone(pform,&status);
|
||||
// unum_formatDouble(pform_cloned, 3600, buffer_cloned, 256, NULL, &status);
|
||||
pform_cloned = unum_clone(pform,&status);
|
||||
unum_formatDouble(pform_cloned, 3600, buffer_cloned, 256, NULL, &status);
|
||||
|
||||
// if (u_strcmp(buffer,buffer_cloned)) {
|
||||
// log_err("Result from cloned formatter not identical to the original. Original: %s Cloned: %s",u_austrcpy(temp1, buffer),u_austrcpy(temp2,buffer_cloned));
|
||||
// }
|
||||
*/
|
||||
if (u_strcmp(buffer,buffer_cloned)) {
|
||||
log_err("Result from cloned formatter not identical to the original. Original: %s Cloned: %s",u_austrcpy(temp1, buffer),u_austrcpy(temp2,buffer_cloned));
|
||||
}
|
||||
}
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
|
Loading…
Add table
Reference in a new issue