1/*
2***********************************************************************
3* Copyright (C) 2016 and later: Unicode, Inc. and others.
4* License & terms of use: http://www.unicode.org/copyright.html#License
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>
18using namespace std;
19
20DateTimeRoundTripPerfTest::DateTimeRoundTripPerfTest(int32_t argc, const char* argv[], UErrorCode& status)
21: UPerfTest(argc,argv,status) { }
22
23DateTimeRoundTripPerfTest::~DateTimeRoundTripPerfTest() { }
24
25UPerfFunction* 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
41UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale1(){
42    DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(1);
43    return func;
44}
45
46UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale10(){
47    DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(10);
48    return func;
49}
50
51UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale11(){
52    DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(11);
53    return func;
54}
55
56UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale21(){
57    DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(21);
58    return func;
59}
60
61int 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