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