]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /******************************************************************** |
2 | * COPYRIGHT: | |
3 | * Copyright (c) 1997-2003, International Business Machines Corporation and | |
4 | * others. All Rights Reserved. | |
5 | ********************************************************************/ | |
6 | ||
7 | /** | |
8 | * IntlTestFormat is the medium level test class for everything in the directory "format". | |
9 | */ | |
10 | ||
11 | #include "unicode/utypes.h" | |
12 | ||
13 | #if !UCONFIG_NO_FORMATTING | |
14 | ||
15 | #include "itformat.h" | |
16 | #include "tsdate.h" | |
17 | #include "tsnmfmt.h" | |
18 | #include "caltest.h" | |
19 | #include "callimts.h" | |
20 | #include "tztest.h" | |
21 | #include "tzbdtest.h" | |
22 | #include "tsdcfmsy.h" // DecimalFormatSymbols | |
23 | #include "tchcfmt.h" | |
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 "incaltst.h" // IntlCalendarTest | |
43 | ||
44 | #define TESTCLASS(id, TestClass) \ | |
45 | case id: \ | |
46 | name = #TestClass; \ | |
47 | if (exec) { \ | |
48 | logln(#TestClass " test---"); \ | |
49 | logln((UnicodeString)""); \ | |
50 | TestClass test; \ | |
51 | callTest(test, par); \ | |
52 | } \ | |
53 | break | |
54 | ||
55 | void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par ) | |
56 | { | |
57 | // for all format tests, always set default Locale and TimeZone to ENGLISH and PST. | |
58 | TimeZone* saveDefaultTimeZone = NULL; | |
59 | Locale saveDefaultLocale = Locale::getDefault(); | |
60 | if (exec) { | |
61 | saveDefaultTimeZone = TimeZone::createDefault(); | |
62 | TimeZone *tz = TimeZone::createTimeZone("PST"); | |
63 | TimeZone::setDefault(*tz); | |
64 | delete tz; | |
65 | UErrorCode status = U_ZERO_ERROR; | |
66 | Locale::setDefault( Locale::getEnglish(), status ); | |
67 | if (U_FAILURE(status)) { | |
68 | errln("itformat: couldn't set default Locale to ENGLISH!"); | |
69 | } | |
70 | } | |
71 | if (exec) logln("TestSuite Format: "); | |
72 | switch (index) { | |
73 | TESTCLASS(0,IntlTestDateFormat); | |
74 | TESTCLASS(1,IntlTestNumberFormat); | |
75 | TESTCLASS(2,CalendarTest); | |
76 | TESTCLASS(3,CalendarLimitTest); | |
77 | TESTCLASS(4,TimeZoneTest); | |
78 | TESTCLASS(5,TimeZoneBoundaryTest); | |
79 | TESTCLASS(6,TestChoiceFormat); | |
80 | TESTCLASS(7,IntlTestDecimalFormatSymbols); | |
81 | TESTCLASS(8,IntlTestDateFormatSymbols); | |
82 | TESTCLASS(9,IntlTestDecimalFormatAPI); | |
83 | TESTCLASS(10,TestFormatSmallClasses); | |
84 | TESTCLASS(11,IntlTestNumberFormatAPI); | |
85 | TESTCLASS(12,IntlTestSimpleDateFormatAPI); | |
86 | TESTCLASS(13,IntlTestDateFormatAPI); | |
87 | TESTCLASS(14,DateFormatTest); | |
88 | TESTCLASS(15,TestMessageFormat); | |
89 | TESTCLASS(16,NumberFormatTest); | |
90 | TESTCLASS(17,DateFormatRegressionTest); | |
91 | TESTCLASS(18,MessageFormatRegressionTest); | |
92 | TESTCLASS(19,DateFormatMiscTests); | |
93 | TESTCLASS(20,NumberFormatRoundTripTest); | |
94 | TESTCLASS(21,NumberFormatRegressionTest); | |
95 | TESTCLASS(22,DateFormatRoundTripTest); | |
96 | TESTCLASS(23,ParsePositionTest); | |
97 | TESTCLASS(24,CalendarRegressionTest); | |
98 | TESTCLASS(25,TimeZoneRegressionTest); | |
99 | TESTCLASS(26,IntlCalendarTest); | |
100 | ||
101 | //TESTCLASS(0,IntlTestDateFormatSymbolsC); | |
102 | //TESTCLASS(0,IntlTestDecimalFormatSymbolsC); | |
103 | //TESTCLASS(0,IntlTestSimpleDateFormatAPIC); | |
104 | //TESTCLASS(0,IntlTestDateFormatAPIC); | |
105 | //TESTCLASS(0,IntlTestDecimalFormatAPIC); | |
106 | //TESTCLASS(0,IntlTestNumberFormatAPIC); | |
107 | //TESTCLASS(0,CNumberSpelloutFormatTest); | |
108 | //TESTCLASS(0,CNumberSpelloutFormatRoundTripTest); | |
109 | //TESTCLASS(0,TestCwrapperFormatSmallClasses); | |
110 | //TESTCLASS(0,TestCwrapperMessageFormat); | |
111 | //TESTCLASS(0,TestCwrapperChoiceFormat); | |
112 | //TESTCLASS(0,TestCwrapperCalendar); | |
113 | //TESTCLASS(0,TestCwrapperTimeZone); | |
114 | default: name = ""; break; //needed to end loop | |
115 | } | |
116 | if (exec) { | |
117 | // restore saved Locale and TimeZone | |
118 | TimeZone::adoptDefault(saveDefaultTimeZone); | |
119 | UErrorCode status = U_ZERO_ERROR; | |
120 | Locale::setDefault( saveDefaultLocale, status ); | |
121 | if (U_FAILURE(status)) { | |
122 | errln("itformat: couldn't re-set default Locale!"); | |
123 | } | |
124 | } | |
125 | } | |
126 | ||
127 | #endif /* #if !UCONFIG_NO_FORMATTING */ |