File: dtfmtrtperf.cpp

package info (click to toggle)
icu 78.2-1
  • links: PTS
  • area: main
  • in suites: experimental
  • size: 123,992 kB
  • sloc: cpp: 527,891; ansic: 112,789; sh: 4,983; makefile: 4,657; perl: 3,199; python: 2,933; xml: 749; sed: 36; lisp: 12
file content (80 lines) | stat: -rw-r--r-- 2,508 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
***********************************************************************
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
***********************************************************************
***********************************************************************
* Copyright (c) 2010,International Business Machines
* Corporation and others.  All Rights Reserved.
***********************************************************************
***********************************************************************
*/

#include "dtfmtrtperf.h"
#include "uoptions.h"
#include <stdio.h>

#include <iostream>
using namespace std;

DateTimeRoundTripPerfTest::DateTimeRoundTripPerfTest(int32_t argc, const char* argv[], UErrorCode& status)
: UPerfTest(argc,argv,status) { }

DateTimeRoundTripPerfTest::~DateTimeRoundTripPerfTest() { }

UPerfFunction* DateTimeRoundTripPerfTest::runIndexedTest(int32_t index, UBool exec,const char* &name, char* par) {

    switch (index) 
    {
        TESTCASE(0,RoundTripLocale1);     // 1 locale
        TESTCASE(1,RoundTripLocale10);    // 10 locales  
        TESTCASE(2,RoundTripLocale11);    // 11 locales
        TESTCASE(3,RoundTripLocale21);    // 21 locales w/ reverse order
        default: 
            name = ""; 
            return nullptr;
    }
    return nullptr;

}

UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale1(){
    DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(1);
    return func;
}

UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale10(){
    DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(10);
    return func;
}

UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale11(){
    DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(11);
    return func;
}

UPerfFunction* DateTimeRoundTripPerfTest::RoundTripLocale21(){
    DateTimeRoundTripFunction* func= new DateTimeRoundTripFunction(21);
    return func;
}

int main(int argc, const char* argv[]){

	cout << "ICU version - " << U_ICU_VERSION << endl;

    UErrorCode status = U_ZERO_ERROR;
    DateTimeRoundTripPerfTest test(argc, argv, status);
    if(U_FAILURE(status)){
		cout << "initialization failed! " << status << endl;
        return status;
    }

    if(test.run()==false){
		cout << "run failed!" << endl;
        fprintf(stderr,"FAILED: Tests could not be run please check the arguments.\n");
        return -1;
    }

	cout << "done!" << endl;
    return 0;
}