ICUTest: style and output formatting fixes

This commit is contained in:
Adrien Destugues 2014-09-29 14:33:00 +02:00
parent 9d1cbc67a6
commit 27a2d2c7ef

View File

@ -23,9 +23,9 @@ void TestLocale(const Locale& loc)
assert(!loc.isBogus());
printf("-- basic info\n");
printf("Default locale:\nLanguage: %s\nScript: %s\nVariant: %s\n"
"Country: %s\nName: %s\nBaseName: %s\n", loc.getLanguage(),
loc.getScript(), loc.getVariant(),
loc.getCountry(), loc.getName(),
"Country: %s\nName: %s\nBaseName: %s\n", loc.getLanguage(),
loc.getScript(), loc.getVariant(),
loc.getCountry(), loc.getName(),
loc.getBaseName());
UErrorCode err = U_ZERO_ERROR;
@ -36,13 +36,13 @@ void TestLocale(const Locale& loc)
if (keywords == NULL)
printf("FAILED: getting keywords list returned NULL\n");
else {
printf("Keywords: %d available\n",keywords->count(err));
printf("Keywords: %d available\n", keywords->count(err));
assert(err == U_ZERO_ERROR);
char keyvalue[256];
while (const char* keyname = keywords->next(NULL,err)) {
loc.getKeywordValue(keyname,keyvalue,256,err);
printf("%s > %s\n",keyname,keyvalue);
while (const char* keyname = keywords->next(NULL, err)) {
loc.getKeywordValue(keyname, keyvalue, 256, err);
printf("%s > %s\n", keyname, keyvalue);
}
delete keywords;
@ -53,7 +53,7 @@ void TestLocale(const Locale& loc)
int
main(int argc, char **argv)
{
printf("--------\niDefault Locale\n--------\n");
printf("--------\nDefault Locale\n--------\n");
Locale defaultLocale;
TestLocale(defaultLocale);
printf("--------\nFrench Locale\n--------\n");
@ -66,18 +66,20 @@ main(int argc, char **argv)
printf("--------\nLocale listing\n--------\n");
int32_t count;
const Locale* localeList = Locale::getAvailableLocales(count);
printf("%d locales found\n",count);
printf("%d locales found\n", count);
for (int i=0; i<count; i++) {
printf("Locale number %d\n",i);
printf("Locale number %d\n", i);
TestLocale(localeList[i]);
}
printf("--------\nLocale country codes\n--------\n");
const char* const* countryTable = Locale::getISOCountries();
for (int i=0; countryTable[i] != NULL; i++)
printf("%s\t",countryTable[i]);
for (int i=0; countryTable[i] != NULL; i++) {
if (i % 10 == 0) puts("");
printf("%s\t", countryTable[i]);
}
printf("\n--------\nNumberFormat\n--------\n");
printf("--------\nDateFormat\n--------\n");