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