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