]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/itmajor.cpp
ICU-511.25.tar.gz
[apple/icu.git] / icuSources / test / intltest / itmajor.cpp
1 /********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1998-2009, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7 /**
8 * MajorTestLevel is the top level test class for everything in the directory "IntlWork".
9 */
10
11 /***********************************************************************
12 * Modification history
13 * Date Name Description
14 * 02/14/2001 synwee Release collation for testing.
15 ***********************************************************************/
16
17 #include "unicode/utypes.h"
18 #include "unicode/localpointer.h"
19 #include "itmajor.h"
20
21 #include "itutil.h"
22 #include "tscoll.h"
23 #include "itformat.h"
24 #include "ittrans.h"
25 #include "itrbbi.h"
26 #include "itrbnf.h"
27 #include "itrbnfp.h"
28 #include "itrbnfrt.h"
29 #include "itspoof.h"
30 #include "normconf.h"
31 #include "regextst.h"
32 #include "tstnorm.h"
33 #include "canittst.h"
34 #include "icusvtst.h"
35 #include "testidna.h"
36 #include "convtest.h"
37 #include "csdetest.h"
38
39 extern IntlTest *createBiDiConformanceTest();
40
41 #define CASE_SUITE(id, suite) case id: \
42 name = #suite; \
43 if(exec) { \
44 logln(#suite "---"); \
45 suite test; \
46 callTest(test, par); \
47 } \
48 break
49
50 void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
51 {
52 switch (index) {
53 case 0: name = "utility";
54 if (exec) {
55 logln("TestSuite Utilities---"); logln();
56 IntlTestUtilities test;
57 callTest( test, par );
58 }
59 break;
60
61 case 1: name = "normalize";
62 #if !UCONFIG_NO_NORMALIZATION
63 if (exec) {
64 logln("TestSuite Normalize---"); logln();
65 IntlTestNormalize test;
66 callTest( test, par );
67 }
68 #endif
69 break;
70
71 case 2: name = "collate";
72 #if !UCONFIG_NO_COLLATION
73 if (exec) {
74 logln("TestSuite Collator---"); logln();
75 IntlTestCollator test;
76 callTest( test, par );
77 }
78 #endif
79 break;
80
81 case 3: name = "regex";
82 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
83 if (exec) {
84 logln("TestSuite Regex---"); logln();
85 RegexTest test;
86 callTest( test, par );
87 }
88 #endif
89 break;
90
91 case 4: name = "format";
92 #if !UCONFIG_NO_FORMATTING
93 if (exec) {
94 logln("TestSuite Format---"); logln();
95 IntlTestFormat test;
96 callTest( test, par );
97 }
98 #endif
99 break;
100
101 case 5: name = "translit";
102 #if !UCONFIG_NO_TRANSLITERATION
103 if (exec) {
104 logln("TestSuite Transliterator---"); logln();
105 IntlTestTransliterator test;
106 callTest( test, par );
107 }
108 #endif
109 break;
110
111 case 6: name = "rbbi";
112 #if !UCONFIG_NO_BREAK_ITERATION
113 if (exec) {
114 logln("TestSuite RuleBasedBreakIterator---"); logln();
115 IntlTestRBBI test;
116 callTest( test, par );
117 }
118 #endif
119 break;
120 case 7: name = "rbnf";
121 #if !UCONFIG_NO_FORMATTING
122 if (exec) {
123 logln("TestSuite RuleBasedNumberFormat----"); logln();
124 IntlTestRBNF test;
125 callTest(test, par);
126 }
127 #endif
128 break;
129 case 8: name = "rbnfrt";
130 #if !UCONFIG_NO_FORMATTING
131 if (exec) {
132 logln("TestSuite RuleBasedNumberFormat RT----"); logln();
133 RbnfRoundTripTest test;
134 callTest(test, par);
135 }
136 #endif
137 break;
138
139 case 9: name = "icuserv";
140 #if !UCONFIG_NO_SERVICE
141 if (exec) {
142 logln("TestSuite ICUService---"); logln();
143 ICUServiceTest test;
144 callTest(test, par);
145 }
146 #endif
147 break;
148 case 10: name = "idna";
149 #if !UCONFIG_NO_IDNA && !UCONFIG_NO_TRANSLITERATION
150 if(exec){
151 logln("TestSuite IDNA----"); logln();
152 TestIDNA test;
153 callTest(test,par);
154 }
155 #endif
156 break;
157 case 11: name = "convert";
158 #if !UCONFIG_NO_LEGACY_CONVERSION
159 if (exec) {
160 logln("TestSuite Conversion---"); logln();
161 ConversionTest test;
162 callTest( test, par );
163 }
164 #endif
165 break;
166
167 case 12: name = "rbnfp";
168 #if !UCONFIG_NO_FORMATTING
169 if (exec) {
170 logln("TestSuite RuleBasedNumberParse ----"); logln();
171 IntlTestRBNFParse test;
172 callTest(test, par);
173 }
174 #endif
175 break;
176
177 case 13: name = "csdet";
178 if (exec) {
179 logln("TestSuite CharsetDetection---"); logln();
180 CharsetDetectionTest test;
181 callTest(test, par);
182 }
183
184 break;
185
186 case 14:
187 #if !UCONFIG_NO_REGULAR_EXPRESSIONS && !UCONFIG_NO_NORMALIZATION && !UCONFIG_NO_FILE_IO
188 name = "spoof";
189 if (exec) {
190 logln("TestSuite SpoofDetection---"); logln();
191 IntlTestSpoof test;
192 callTest(test, par);
193 }
194 #else
195 name = "skip";
196 #endif
197 break;
198
199 case 15: name = "bidi";
200 if (exec) {
201 logln("TestSuite bidi---"); logln();
202 LocalPointer<IntlTest> test(createBiDiConformanceTest());
203 callTest(*test, par);
204 }
205
206 break;
207
208 default: name = ""; break;
209 }
210
211
212 }
213
214 void IntlTestNormalize::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
215 {
216 if(exec) logln("TestSuite Normalize:");
217 #if UCONFIG_NO_NORMALIZATION
218 name="";
219 #else
220 switch (index) {
221 CASE_SUITE(0, BasicNormalizerTest);
222 CASE_SUITE(1, NormalizerConformanceTest); // this takes a long time
223 CASE_SUITE(2, CanonicalIteratorTest);
224 default:
225 name="";
226 break;
227 }
228 #endif
229 }