]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/perf/convperf/convperf.cpp
ICU-57166.0.1.tar.gz
[apple/icu.git] / icuSources / test / perf / convperf / convperf.cpp
1 /*
2 **********************************************************************
3 * Copyright (c) 2002-2014, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 **********************************************************************
7 */
8 /**
9 * This Program tests the performance of ICU's Normalization engine against Windows
10 * to run it use the command like
11 *
12 * c:\normperf.exe -s C:\work\ICUCupertinoRep\icu4c\collation-perf-data -i 10 -p 15 -f TestNames_Asian.txt -u -e UTF-8 -l
13 */
14 #include "convperf.h"
15 #include "data.h"
16 #include <stdio.h>
17 #include "cmemory.h" // for UPRV_LENGTHOF
18
19 int main(int argc, const char* argv[]){
20 UErrorCode status = U_ZERO_ERROR;
21 ConverterPerformanceTest test(argc, argv, status);
22 if(U_FAILURE(status)){
23 return status;
24 }
25 if(test.run()==FALSE){
26 fprintf(stderr,"FAILED: Tests could not be run please check the arguments.\n");
27 return -1;
28 }
29 return 0;
30 }
31
32
33 ConverterPerformanceTest::ConverterPerformanceTest(int32_t argc, const char* argv[], UErrorCode& status)
34 : UPerfTest(argc,argv,status){
35
36 }
37
38 ConverterPerformanceTest::~ConverterPerformanceTest(){
39
40 }
41
42 UPerfFunction* ConverterPerformanceTest::runIndexedTest(int32_t index, UBool exec,const char* &name, char* par) {
43 switch (index) {
44 TESTCASE(0,TestICU_CleanOpenAllConverters);// This calls u_cleanup()
45 TESTCASE(1,TestICU_OpenAllConverters);// This doesn't call u_cleanup()
46
47 TESTCASE(2,TestICU_UTF8_ToUnicode);
48 TESTCASE(3,TestICU_UTF8_FromUnicode);
49 TESTCASE(4,TestWinANSI_UTF8_ToUnicode);
50 TESTCASE(5,TestWinANSI_UTF8_FromUnicode);
51 TESTCASE(6,TestWinIML2_UTF8_ToUnicode);
52 TESTCASE(7,TestWinIML2_UTF8_FromUnicode);
53
54 TESTCASE(8,TestICU_Latin1_ToUnicode);
55 TESTCASE(9,TestICU_Latin1_FromUnicode);
56 TESTCASE(10,TestWinIML2_Latin1_ToUnicode);
57 TESTCASE(11,TestWinIML2_Latin1_FromUnicode);
58
59 TESTCASE(12,TestICU_Latin8_ToUnicode);
60 TESTCASE(13,TestICU_Latin8_FromUnicode);
61 TESTCASE(14,TestWinIML2_Latin8_ToUnicode);
62 TESTCASE(15,TestWinIML2_Latin8_FromUnicode);
63
64 TESTCASE(16,TestICU_EBCDIC_Arabic_ToUnicode);
65 TESTCASE(17,TestICU_EBCDIC_Arabic_FromUnicode);
66 TESTCASE(18,TestWinIML2_EBCDIC_Arabic_ToUnicode);
67 TESTCASE(19,TestWinIML2_EBCDIC_Arabic_FromUnicode);
68
69 TESTCASE(20,TestICU_SJIS_ToUnicode);
70 TESTCASE(21,TestICU_SJIS_FromUnicode);
71 TESTCASE(22,TestWinIML2_SJIS_ToUnicode);
72 TESTCASE(23,TestWinIML2_SJIS_FromUnicode);
73
74 TESTCASE(24,TestICU_EUCJP_ToUnicode);
75 TESTCASE(25,TestICU_EUCJP_FromUnicode);
76 TESTCASE(26,TestWinIML2_EUCJP_ToUnicode);
77 TESTCASE(27,TestWinIML2_EUCJP_FromUnicode);
78
79 TESTCASE(28,TestICU_GB2312_FromUnicode);
80 TESTCASE(29,TestICU_GB2312_ToUnicode);
81 TESTCASE(30,TestWinIML2_GB2312_ToUnicode);
82 TESTCASE(31,TestWinIML2_GB2312_FromUnicode);
83
84 TESTCASE(32,TestICU_ISO2022KR_ToUnicode);
85 TESTCASE(33,TestICU_ISO2022KR_FromUnicode);
86 TESTCASE(34,TestWinIML2_ISO2022KR_ToUnicode);
87 TESTCASE(35,TestWinIML2_ISO2022KR_FromUnicode);
88
89 TESTCASE(36,TestICU_ISO2022JP_ToUnicode);
90 TESTCASE(37,TestICU_ISO2022JP_FromUnicode);
91 TESTCASE(38,TestWinIML2_ISO2022JP_ToUnicode);
92 TESTCASE(39,TestWinIML2_ISO2022JP_FromUnicode);
93
94 TESTCASE(40,TestWinANSI_Latin1_ToUnicode);
95 TESTCASE(41,TestWinANSI_Latin1_FromUnicode);
96
97 TESTCASE(42,TestWinANSI_Latin8_ToUnicode);
98 TESTCASE(43,TestWinANSI_Latin8_FromUnicode);
99
100 TESTCASE(44,TestWinANSI_SJIS_ToUnicode);
101 TESTCASE(45,TestWinANSI_SJIS_FromUnicode);
102
103 TESTCASE(46,TestWinANSI_EUCJP_ToUnicode);
104 TESTCASE(47,TestWinANSI_EUCJP_FromUnicode);
105
106 TESTCASE(48,TestWinANSI_GB2312_ToUnicode);
107 TESTCASE(49,TestWinANSI_GB2312_FromUnicode);
108
109 TESTCASE(50,TestWinANSI_ISO2022KR_ToUnicode);
110 TESTCASE(51,TestWinANSI_ISO2022KR_FromUnicode);
111
112 TESTCASE(52,TestWinANSI_ISO2022JP_ToUnicode);
113 TESTCASE(53,TestWinANSI_ISO2022JP_FromUnicode);
114
115 default:
116 name = "";
117 return NULL;
118 }
119 return NULL;
120
121 }
122
123 UPerfFunction* ConverterPerformanceTest::TestICU_CleanOpenAllConverters() {
124 UErrorCode status = U_ZERO_ERROR;
125 UPerfFunction* pf = new ICUOpenAllConvertersFunction(TRUE, status);
126 if(U_FAILURE(status)){
127 return NULL;
128 }
129 return pf;
130 }
131
132 UPerfFunction* ConverterPerformanceTest::TestICU_OpenAllConverters() {
133 UErrorCode status = U_ZERO_ERROR;
134 UPerfFunction* pf = new ICUOpenAllConvertersFunction(FALSE, status);
135 if(U_FAILURE(status)){
136 return NULL;
137 }
138 return pf;
139 }
140
141 UPerfFunction* ConverterPerformanceTest::TestICU_UTF8_FromUnicode(){
142 UErrorCode status = U_ZERO_ERROR;
143 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("utf-8",utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
144 if(U_FAILURE(status)){
145 return NULL;
146 }
147 return pf;
148 }
149
150 UPerfFunction* ConverterPerformanceTest::TestICU_UTF8_ToUnicode(){
151 UErrorCode status = U_ZERO_ERROR;
152 UPerfFunction* pf = new ICUToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
153 if(U_FAILURE(status)){
154 return NULL;
155 }
156 return pf;
157 }
158
159
160 UPerfFunction* ConverterPerformanceTest::TestWinIML2_UTF8_FromUnicode(){
161 UErrorCode status = U_ZERO_ERROR;
162 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("utf-8",utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
163 if(U_FAILURE(status)){
164 return NULL;
165 }
166 return pf;
167 }
168
169 UPerfFunction* ConverterPerformanceTest::TestWinIML2_UTF8_ToUnicode(){
170 UErrorCode status = U_ZERO_ERROR;
171 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
172 if(U_FAILURE(status)){
173 return NULL;
174 }
175 return pf;
176 }
177
178 UPerfFunction* ConverterPerformanceTest::TestWinANSI_UTF8_FromUnicode(){
179 UErrorCode status = U_ZERO_ERROR;
180 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("utf-8",utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
181 if(U_FAILURE(status)){
182 return NULL;
183 }
184 return pf;
185 }
186
187 UPerfFunction* ConverterPerformanceTest::TestWinANSI_UTF8_ToUnicode(){
188 UErrorCode status = U_ZERO_ERROR;
189 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
190 if(U_FAILURE(status)){
191 return NULL;
192 }
193 return pf;
194 }
195
196 //################
197
198 UPerfFunction* ConverterPerformanceTest::TestICU_Latin1_FromUnicode(){
199 UErrorCode status = U_ZERO_ERROR;
200 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-8859-1",latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
201 if(U_FAILURE(status)){
202 return NULL;
203 }
204 return pf;
205 }
206
207 UPerfFunction* ConverterPerformanceTest::TestICU_Latin1_ToUnicode(){
208 UErrorCode status = U_ZERO_ERROR;
209 UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
210 if(U_FAILURE(status)){
211 return NULL;
212 }
213 return pf;
214 }
215
216
217 UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin1_FromUnicode(){
218 UErrorCode status = U_ZERO_ERROR;
219 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-8859-1",latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
220 if(U_FAILURE(status)){
221 return NULL;
222 }
223 return pf;
224 }
225
226 UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin1_ToUnicode(){
227 UErrorCode status = U_ZERO_ERROR;
228 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
229 if(U_FAILURE(status)){
230 return NULL;
231 }
232 return pf;
233 }
234
235 UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin1_FromUnicode(){
236 UErrorCode status = U_ZERO_ERROR;
237 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-8859-1",latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
238 if(U_FAILURE(status)){
239 return NULL;
240 }
241 return pf;
242 }
243
244 UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin1_ToUnicode(){
245 UErrorCode status = U_ZERO_ERROR;
246 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
247 if(U_FAILURE(status)){
248 return NULL;
249 }
250 return pf;
251 }
252
253 //##################
254
255 UPerfFunction* ConverterPerformanceTest::TestICU_Latin8_FromUnicode(){
256 UErrorCode status = U_ZERO_ERROR;
257 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-8859-8",latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
258 if(U_FAILURE(status)){
259 return NULL;
260 }
261 return pf;
262 }
263
264 UPerfFunction* ConverterPerformanceTest::TestICU_Latin8_ToUnicode(){
265 UErrorCode status = U_ZERO_ERROR;
266 UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
267 if(U_FAILURE(status)){
268 return NULL;
269 }
270 return pf;
271 }
272
273
274 UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin8_FromUnicode(){
275 UErrorCode status = U_ZERO_ERROR;
276 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-8859-8",latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
277 if(U_FAILURE(status)){
278 return NULL;
279 }
280 return pf;
281 }
282
283 UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin8_ToUnicode(){
284 UErrorCode status = U_ZERO_ERROR;
285 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
286 if(U_FAILURE(status)){
287 return NULL;
288 }
289 return pf;
290 }
291 UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin8_FromUnicode(){
292 UErrorCode status = U_ZERO_ERROR;
293 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-8859-8",latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
294 if(U_FAILURE(status)){
295 return NULL;
296 }
297 return pf;
298 }
299
300 UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin8_ToUnicode(){
301 UErrorCode status = U_ZERO_ERROR;
302 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
303 if(U_FAILURE(status)){
304 return NULL;
305 }
306 return pf;
307 }
308
309 //#################
310
311
312 UPerfFunction* ConverterPerformanceTest::TestICU_EBCDIC_Arabic_FromUnicode(){
313 UErrorCode status = U_ZERO_ERROR;
314 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
315 if(U_FAILURE(status)){
316 return NULL;
317 }
318 return pf;
319 }
320
321 UPerfFunction* ConverterPerformanceTest::TestICU_EBCDIC_Arabic_ToUnicode(){
322 UErrorCode status = U_ZERO_ERROR;
323 UPerfFunction* pf = new ICUToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
324 if(U_FAILURE(status)){
325 return NULL;
326 }
327 return pf;
328 }
329
330
331 UPerfFunction* ConverterPerformanceTest::TestWinIML2_EBCDIC_Arabic_FromUnicode(){
332 UErrorCode status = U_ZERO_ERROR;
333 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
334 if(U_FAILURE(status)){
335 return NULL;
336 }
337 return pf;
338 }
339
340 UPerfFunction* ConverterPerformanceTest::TestWinIML2_EBCDIC_Arabic_ToUnicode(){
341 UErrorCode status = U_ZERO_ERROR;
342 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
343 if(U_FAILURE(status)){
344 return NULL;
345 }
346 return pf;
347 }
348
349 UPerfFunction* ConverterPerformanceTest::TestWinANSI_EBCDIC_Arabic_FromUnicode(){
350 UErrorCode status = U_ZERO_ERROR;
351 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
352 if(U_FAILURE(status)){
353 return NULL;
354 }
355 return pf;
356 }
357
358 UPerfFunction* ConverterPerformanceTest::TestWinANSI_EBCDIC_Arabic_ToUnicode(){
359 UErrorCode status = U_ZERO_ERROR;
360 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
361 if(U_FAILURE(status)){
362 return NULL;
363 }
364 return pf;
365 }
366 //#################
367
368
369 UPerfFunction* ConverterPerformanceTest::TestICU_SJIS_FromUnicode(){
370 UErrorCode status = U_ZERO_ERROR;
371 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("sjis",sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
372 if(U_FAILURE(status)){
373 return NULL;
374 }
375 return pf;
376 }
377
378 UPerfFunction* ConverterPerformanceTest::TestICU_SJIS_ToUnicode(){
379 UErrorCode status = U_ZERO_ERROR;
380 UPerfFunction* pf = new ICUToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
381 if(U_FAILURE(status)){
382 return NULL;
383 }
384 return pf;
385 }
386
387
388 UPerfFunction* ConverterPerformanceTest::TestWinIML2_SJIS_FromUnicode(){
389 UErrorCode status = U_ZERO_ERROR;
390 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("sjis",sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
391 if(U_FAILURE(status)){
392 return NULL;
393 }
394 return pf;
395 }
396
397 UPerfFunction* ConverterPerformanceTest::TestWinIML2_SJIS_ToUnicode(){
398 UErrorCode status = U_ZERO_ERROR;
399 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
400 if(U_FAILURE(status)){
401 return NULL;
402 }
403 return pf;
404 }
405
406 UPerfFunction* ConverterPerformanceTest::TestWinANSI_SJIS_FromUnicode(){
407 UErrorCode status = U_ZERO_ERROR;
408 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("sjis",sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
409 if(U_FAILURE(status)){
410 return NULL;
411 }
412 return pf;
413 }
414
415 UPerfFunction* ConverterPerformanceTest::TestWinANSI_SJIS_ToUnicode(){
416 UErrorCode status = U_ZERO_ERROR;
417 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
418 if(U_FAILURE(status)){
419 return NULL;
420 }
421 return pf;
422 }
423
424
425 //#################
426
427
428 UPerfFunction* ConverterPerformanceTest::TestICU_EUCJP_FromUnicode(){
429 UErrorCode status = U_ZERO_ERROR;
430 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("euc-jp",eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
431 if(U_FAILURE(status)){
432 return NULL;
433 }
434 return pf;
435 }
436
437 UPerfFunction* ConverterPerformanceTest::TestICU_EUCJP_ToUnicode(){
438 UErrorCode status = U_ZERO_ERROR;
439 UPerfFunction* pf = new ICUToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
440 if(U_FAILURE(status)){
441 return NULL;
442 }
443 return pf;
444 }
445
446
447 UPerfFunction* ConverterPerformanceTest::TestWinIML2_EUCJP_FromUnicode(){
448 UErrorCode status = U_ZERO_ERROR;
449 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("euc-jp",eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
450 if(U_FAILURE(status)){
451 return NULL;
452 }
453 return pf;
454 }
455
456 UPerfFunction* ConverterPerformanceTest::TestWinIML2_EUCJP_ToUnicode(){
457 UErrorCode status = U_ZERO_ERROR;
458 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
459 if(U_FAILURE(status)){
460 return NULL;
461 }
462 return pf;
463 }
464
465 UPerfFunction* ConverterPerformanceTest::TestWinANSI_EUCJP_FromUnicode(){
466 UErrorCode status = U_ZERO_ERROR;
467 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("euc-jp",eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
468 if(U_FAILURE(status)){
469 return NULL;
470 }
471 return pf;
472 }
473
474 UPerfFunction* ConverterPerformanceTest::TestWinANSI_EUCJP_ToUnicode(){
475 UErrorCode status = U_ZERO_ERROR;
476 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
477 if(U_FAILURE(status)){
478 return NULL;
479 }
480 return pf;
481 }
482
483
484 //#################
485
486
487 UPerfFunction* ConverterPerformanceTest::TestICU_GB2312_FromUnicode(){
488 UErrorCode status = U_ZERO_ERROR;
489 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("gb2312",gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
490 if(U_FAILURE(status)){
491 return NULL;
492 }
493 return pf;
494 }
495
496 UPerfFunction* ConverterPerformanceTest::TestICU_GB2312_ToUnicode(){
497 UErrorCode status = U_ZERO_ERROR;
498 UPerfFunction* pf = new ICUToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
499 if(U_FAILURE(status)){
500 return NULL;
501 }
502 return pf;
503 }
504
505
506 UPerfFunction* ConverterPerformanceTest::TestWinIML2_GB2312_FromUnicode(){
507 UErrorCode status = U_ZERO_ERROR;
508 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("gb2312",gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
509 if(U_FAILURE(status)){
510 return NULL;
511 }
512 return pf;
513 }
514
515 UPerfFunction* ConverterPerformanceTest::TestWinIML2_GB2312_ToUnicode(){
516 UErrorCode status = U_ZERO_ERROR;
517 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
518 if(U_FAILURE(status)){
519 return NULL;
520 }
521 return pf;
522 }
523
524 UPerfFunction* ConverterPerformanceTest::TestWinANSI_GB2312_FromUnicode(){
525 UErrorCode status = U_ZERO_ERROR;
526 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("gb2312",gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
527 if(U_FAILURE(status)){
528 return NULL;
529 }
530 return pf;
531 }
532
533 UPerfFunction* ConverterPerformanceTest::TestWinANSI_GB2312_ToUnicode(){
534 UErrorCode status = U_ZERO_ERROR;
535 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
536 if(U_FAILURE(status)){
537 return NULL;
538 }
539 return pf;
540 }
541
542 //#################
543
544
545 UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022KR_FromUnicode(){
546 UErrorCode status = U_ZERO_ERROR;
547 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
548 if(U_FAILURE(status)){
549 return NULL;
550 }
551 return pf;
552 }
553
554 UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022KR_ToUnicode(){
555 UErrorCode status = U_ZERO_ERROR;
556 UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
557 if(U_FAILURE(status)){
558 return NULL;
559 }
560 return pf;
561 }
562
563
564 UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022KR_FromUnicode(){
565 UErrorCode status = U_ZERO_ERROR;
566 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
567 if(U_FAILURE(status)){
568 return NULL;
569 }
570 return pf;
571 }
572
573 UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022KR_ToUnicode(){
574 UErrorCode status = U_ZERO_ERROR;
575 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
576 if(U_FAILURE(status)){
577 return NULL;
578 }
579 return pf;
580 }
581
582 UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022KR_FromUnicode(){
583 UErrorCode status = U_ZERO_ERROR;
584 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
585 if(U_FAILURE(status)){
586 return NULL;
587 }
588 return pf;
589 }
590
591 UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022KR_ToUnicode(){
592 UErrorCode status = U_ZERO_ERROR;
593 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
594 if(U_FAILURE(status)){
595 return NULL;
596 }
597 return pf;
598 }
599 //#################
600
601
602 UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022JP_FromUnicode(){
603 UErrorCode status = U_ZERO_ERROR;
604 ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
605 if(U_FAILURE(status)){
606 return NULL;
607 }
608 return pf;
609 }
610
611 UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022JP_ToUnicode(){
612 UErrorCode status = U_ZERO_ERROR;
613 UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
614 if(U_FAILURE(status)){
615 return NULL;
616 }
617 return pf;
618 }
619
620
621 UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022JP_FromUnicode(){
622 UErrorCode status = U_ZERO_ERROR;
623 UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
624 if(U_FAILURE(status)){
625 return NULL;
626 }
627 return pf;
628 }
629
630 UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022JP_ToUnicode(){
631 UErrorCode status = U_ZERO_ERROR;
632 UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
633 if(U_FAILURE(status)){
634 return NULL;
635 }
636 return pf;
637 }
638
639 UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022JP_FromUnicode(){
640 UErrorCode status = U_ZERO_ERROR;
641 UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
642 if(U_FAILURE(status)){
643 return NULL;
644 }
645 return pf;
646 }
647
648 UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022JP_ToUnicode(){
649 UErrorCode status = U_ZERO_ERROR;
650 UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
651 if(U_FAILURE(status)){
652 return NULL;
653 }
654 return pf;
655 }