ICU-738 Fix Windows error in strtst.c.
X-SVN-Rev: 22895
This commit is contained in:
parent
f018a43611
commit
ae68bce23b
@ -377,6 +377,7 @@ static void TestSprintfFormat(void) {
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
static const UChar abcUChars[] = {0x61,0x62,0x63,0};
|
||||
static const char abcChars[] = "abc";
|
||||
const char *format = "%2$d==>%1$-10.10s %4$-10.10s %3$#x\n%5$d"; /* reordering test*/
|
||||
UChar uBuffer[256];
|
||||
char buffer[256];
|
||||
char compBuffer[256];
|
||||
@ -491,22 +492,21 @@ static void TestSprintfFormat(void) {
|
||||
|
||||
/* Test reordering format */
|
||||
/* Reinitialize the buffer to verify null termination works. */
|
||||
char *uFormat = "%2$d==>%1$-10.10s %4$-10.10s %3$#x\n%5$d";
|
||||
u_memset(uBuffer, 0x2a, sizeof(uBuffer)/sizeof(*uBuffer));
|
||||
memset(buffer, '*', sizeof(buffer)/sizeof(*buffer));
|
||||
|
||||
cNumPrinted = sprintf(buffer, uFormat,"truncateiftoolong", 99, 990099, "12345678901234567890", 10);
|
||||
uNumPrinted = u_sprintf(uBuffer, uFormat,"truncateiftoolong", 99, 990099, "12345678901234567890", 10);
|
||||
cNumPrinted = sprintf(buffer, format,"truncateiftoolong", 99, 990099, "12345678901234567890", 10);
|
||||
uNumPrinted = u_sprintf(uBuffer, format,"truncateiftoolong", 99, 990099, "12345678901234567890", 10);
|
||||
u_austrncpy(compBuffer, uBuffer, sizeof(uBuffer)/sizeof(uBuffer[0]));
|
||||
|
||||
if (strcmp(buffer, compBuffer) != 0) {
|
||||
log_err("%s Got: \"%s\", Expected: \"%s\"\n", uFormat, compBuffer, buffer);
|
||||
log_err("%s Got: \"%s\", Expected: \"%s\"\n", format, compBuffer, buffer);
|
||||
}
|
||||
if (cNumPrinted != uNumPrinted) {
|
||||
log_err("%s number printed Got: %d, Expected: %d\n", uFormat, uNumPrinted, cNumPrinted);\
|
||||
log_err("%s number printed Got: %d, Expected: %d\n", format, uNumPrinted, cNumPrinted);\
|
||||
}
|
||||
if (buffer[uNumPrinted+1] != '*') {
|
||||
log_err("%s too much stored\n", uFormat);
|
||||
log_err("%s too much stored\n", format);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user