/******************************************************************** * COPYRIGHT: * Copyright (c) 1997-2006, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING #include "tsdtfmsy.h" #include "unicode/dtfmtsym.h" void IntlTestDateFormatSymbols::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) { if (exec) logln("TestSuite DateFormatSymbols"); switch (index) { TESTCASE(0,TestSymbols); TESTCASE(1,TestGetMonths); TESTCASE(2,TestGetMonths2); TESTCASE(3,TestGetWeekdays2); TESTCASE(4,TestGetEraNames); default: name = ""; break; } } /** * Test getMonths. */ void IntlTestDateFormatSymbols::TestGetMonths() { UErrorCode status = U_ZERO_ERROR; int32_t cnt; const UnicodeString* month; DateFormatSymbols *symbol; symbol=new DateFormatSymbols(Locale::getDefault(), status); month=symbol->getMonths(cnt); logln((UnicodeString)"size = " + cnt); for (int32_t i=0; igetMonths(cnt,context[i],width[j]); logln((UnicodeString)"size = " + cnt); for (int32_t k = 0; k < cnt; k++) { logln(month[k]); } } } delete symbol; } void IntlTestDateFormatSymbols::TestGetWeekdays2() { UErrorCode status = U_ZERO_ERROR; DateFormatSymbols *symbol; symbol=new DateFormatSymbols(Locale::getDefault(), status); DateFormatSymbols::DtContextType context[] = {DateFormatSymbols::STANDALONE, DateFormatSymbols::FORMAT}; DateFormatSymbols::DtWidthType width[] = {DateFormatSymbols::WIDE, DateFormatSymbols::ABBREVIATED, DateFormatSymbols::NARROW}; for (int32_t i = 0; i < 2; i++) { for (int32_t j = 0; j < 3; j++) { int32_t cnt; const UnicodeString * wd = symbol->getWeekdays(cnt,context[i],width[j]); logln((UnicodeString)"size = " + cnt); for (int32_t k = 0; k < cnt; k++) { logln(wd[k]); } } } delete symbol; } void IntlTestDateFormatSymbols::TestGetEraNames() { UErrorCode status = U_ZERO_ERROR; int32_t cnt; const UnicodeString* name; DateFormatSymbols *symbol; symbol=new DateFormatSymbols(Locale::getDefault(), status); name=symbol->getEraNames(cnt); logln((UnicodeString)"size = " + cnt); for (int32_t i=0; i