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