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