1 /*
2 **********************************************************************
3 * Copyright (c) 2010,International Business Machines
4 * Corporation and others.  All Rights Reserved.
5 **********************************************************************
6 **********************************************************************
7 */
8 
9 #include "dtfmtrtperf.h"
10 #include "uoptions.h"
11 #include <stdio.h>
12 
13 #include <iostream>
14 using namespace std;
15 
DateTimeRoundTripPerfTest(int32_t argc,const char * argv[],UErrorCode & status)16 DateTimeRoundTripPerfTest::DateTimeRoundTripPerfTest(int32_t argc, const char* argv[], UErrorCode& status)
17 : UPerfTest(argc,argv,status) { }
18 
~DateTimeRoundTripPerfTest()19 DateTimeRoundTripPerfTest::~DateTimeRoundTripPerfTest() { }
20 
runIndexedTest(int32_t index,UBool exec,const char * & name,char * par)21 UPerfFunction* DateTimeRoundTripPerfTest::runIndexedTest(int32_t index, UBool exec,const char* &name, char* par) {
22 
23     switch (index)
24     {
25         TESTCASE(0,RoundTripLocale1);     // 1 locale
26         TESTCASE(1,RoundTripLocale10);    // 10 locales
27         TESTCASE(2,RoundTripLocale11);    // 11 locales
28         TESTCASE(3,RoundTripLocale21);    // 21 locales w/ reverse order
29         default:
30             name = "";
31             return NULL;
32     }
33     return NULL;
34 
35 }
36 
RoundTripLocale1()37 UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale1(){
38     DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(1);
39     return func;
40 }
41 
RoundTripLocale10()42 UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale10(){
43     DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(10);
44     return func;
45 }
46 
RoundTripLocale11()47 UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale11(){
48     DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(11);
49     return func;
50 }
51 
RoundTripLocale21()52 UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale21(){
53     DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(21);
54     return func;
55 }
56 
main(int argc,const char * argv[])57 int main(int argc, const char* argv[]){
58 
59 	cout << "ICU version - " << U_ICU_VERSION << endl;
60 
61     UErrorCode status = U_ZERO_ERROR;
62     DateTimeRoundTripPerfTest test(argc, argv, status);
63     if(U_FAILURE(status)){
64 		cout << "initialization failed! " << status << endl;
65         return status;
66     }
67 
68     if(test.run()==FALSE){
69 		cout << "run failed!" << endl;
70         fprintf(stderr,"FAILED: Tests could not be run please check the arguments.\n");
71         return -1;
72     }
73 
74 	cout << "done!" << endl;
75     return 0;
76 }