1 /********************************************************************
3 * Copyright (c) 1997-2008, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************/
8 * IntlTestFormat is the medium level test class for everything in the directory "format".
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
22 #include "tsdcfmsy.h" // DecimalFormatSymbols
24 #include "tsdtfmsy.h" // DateFormatSymbols
25 #include "dcfmapts.h" // DecimalFormatAPI
26 #include "tfsmalls.h" // Format Small Classes
27 #include "nmfmapts.h" // NumberFormatAPI
28 #include "numfmtst.h" // NumberFormatTest
29 #include "sdtfmtts.h" // SimpleDateFormatAPI
30 #include "dtfmapts.h" // DateFormatAPI
31 #include "dtfmttst.h" // DateFormatTest
32 #include "tmsgfmt.h" // TestMessageFormat
33 #include "dtfmrgts.h" // DateFormatRegressionTest
34 #include "msfmrgts.h" // MessageFormatRegressionTest
35 #include "miscdtfm.h" // DateFormatMiscTests
36 #include "nmfmtrt.h" // NumberFormatRoundTripTest
37 #include "numrgts.h" // NumberFormatRegressionTest
38 #include "dtfmtrtts.h" // DateFormatRoundTripTest
39 #include "pptest.h" // ParsePositionTest
40 #include "calregts.h" // CalendarRegressionTest
41 #include "tzregts.h" // TimeZoneRegressionTest
42 #include "astrotst.h" // AstroTest
43 #include "incaltst.h" // IntlCalendarTest
44 #include "calcasts.h" // CalendarCaseTest
45 #include "tzrulets.h" // TimeZoneRuleTest
46 #include "dadrcal.h" // DataDrivenCalendarTest
47 #include "dadrfmt.h" // DataDrivenFormatTest
48 #include "dtptngts.h" // IntlTestDateTimePatternGeneratorAPI
49 #include "tzoffloc.h" // TimeZoneOffsetLocalTest
50 #include "tzfmttst.h" // TimeZoneFormatTest
51 #include "plurults.h" // PluralRulesTest
52 #include "plurfmts.h" // PluralFormatTest
53 #include "dtifmtts.h" // DateIntervalFormatTest
55 #define TESTCLASS(id, TestClass) \
59 logln(#TestClass " test---"); \
60 logln((UnicodeString)""); \
62 callTest(test, par); \
66 void IntlTestFormat::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
)
68 // for all format tests, always set default Locale and TimeZone to ENGLISH and PST.
69 TimeZone
* saveDefaultTimeZone
= NULL
;
70 Locale saveDefaultLocale
= Locale::getDefault();
72 saveDefaultTimeZone
= TimeZone::createDefault();
73 TimeZone
*tz
= TimeZone::createTimeZone("PST");
74 TimeZone::setDefault(*tz
);
76 UErrorCode status
= U_ZERO_ERROR
;
77 Locale::setDefault( Locale::getEnglish(), status
);
78 if (U_FAILURE(status
)) {
79 errln("itformat: couldn't set default Locale to ENGLISH!");
82 if (exec
) logln("TestSuite Format: ");
84 TESTCLASS(0,IntlTestDateFormat
);
85 TESTCLASS(1,IntlTestNumberFormat
);
86 TESTCLASS(2,CalendarTest
);
87 TESTCLASS(3,CalendarLimitTest
);
88 TESTCLASS(4,TimeZoneTest
);
89 TESTCLASS(5,TimeZoneBoundaryTest
);
90 TESTCLASS(6,TestChoiceFormat
);
91 TESTCLASS(7,IntlTestDecimalFormatSymbols
);
92 TESTCLASS(8,IntlTestDateFormatSymbols
);
93 TESTCLASS(9,IntlTestDecimalFormatAPI
);
94 TESTCLASS(10,TestFormatSmallClasses
);
95 TESTCLASS(11,IntlTestNumberFormatAPI
);
96 TESTCLASS(12,IntlTestSimpleDateFormatAPI
);
97 TESTCLASS(13,IntlTestDateFormatAPI
);
98 TESTCLASS(14,DateFormatTest
);
99 TESTCLASS(15,TestMessageFormat
);
100 TESTCLASS(16,NumberFormatTest
);
101 TESTCLASS(17,DateFormatRegressionTest
);
102 TESTCLASS(18,MessageFormatRegressionTest
);
103 TESTCLASS(19,DateFormatMiscTests
);
104 TESTCLASS(20,NumberFormatRoundTripTest
);
105 TESTCLASS(21,NumberFormatRegressionTest
);
106 TESTCLASS(22,DateFormatRoundTripTest
);
107 TESTCLASS(23,ParsePositionTest
);
108 TESTCLASS(24,CalendarRegressionTest
);
109 TESTCLASS(25,TimeZoneRegressionTest
);
110 TESTCLASS(26,IntlCalendarTest
);
111 TESTCLASS(27,AstroTest
);
112 TESTCLASS(28,CalendarCaseTest
);
113 TESTCLASS(29,TimeZoneRuleTest
);
114 TESTCLASS(30,DataDrivenCalendarTest
);
115 TESTCLASS(31,DataDrivenFormatTest
);
116 TESTCLASS(32,IntlTestDateTimePatternGeneratorAPI
);
117 TESTCLASS(33,TimeZoneOffsetLocalTest
);
118 TESTCLASS(34,TimeZoneFormatTest
);
119 TESTCLASS(35,PluralRulesTest
);
120 TESTCLASS(36,PluralFormatTest
);
121 TESTCLASS(37,DateIntervalFormatTest
);
123 default: name
= ""; break; //needed to end loop
126 // restore saved Locale and TimeZone
127 TimeZone::adoptDefault(saveDefaultTimeZone
);
128 UErrorCode status
= U_ZERO_ERROR
;
129 Locale::setDefault( saveDefaultLocale
, status
);
130 if (U_FAILURE(status
)) {
131 errln("itformat: couldn't re-set default Locale!");
136 #endif /* #if !UCONFIG_NO_FORMATTING */