]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/perf/charperf/charperf.h
2 **********************************************************************
3 * Copyright (c) 2002-2003, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 **********************************************************************
12 #include "unicode/uchar.h"
18 typedef void (*CharPerfFn
)(UChar32 ch
);
19 typedef void (*StdLibCharPerfFn
)(wchar_t ch
);
21 class CharPerfFunction
: public UPerfFunction
24 virtual void call(UErrorCode
* status
)
26 for (UChar32 i
= MIN_
; i
< MAX_
; i
++) {
31 virtual long getOperationsPerIteration()
35 CharPerfFunction(CharPerfFn func
, UChar32 min
, UChar32 max
)
48 class StdLibCharPerfFunction
: public UPerfFunction
51 virtual void call(UErrorCode
* status
)
53 // note wchar_t is unsigned, it will revert to 0 once it reaches
55 for (wchar_t i
= MIN_
; i
< MAX_
; i
++) {
60 virtual long getOperationsPerIteration()
65 StdLibCharPerfFunction(StdLibCharPerfFn func
, wchar_t min
, wchar_t max
)
72 ~StdLibCharPerfFunction()
77 StdLibCharPerfFn m_fn_
;
82 class CharPerformanceTest
: public UPerfTest
85 CharPerformanceTest(int32_t argc
, const char *argv
[], UErrorCode
&status
);
86 ~CharPerformanceTest();
87 virtual UPerfFunction
* runIndexedTest(int32_t index
, UBool exec
,
90 UPerfFunction
* TestIsAlpha();
91 UPerfFunction
* TestIsUpper();
92 UPerfFunction
* TestIsLower();
93 UPerfFunction
* TestIsDigit();
94 UPerfFunction
* TestIsSpace();
95 UPerfFunction
* TestIsAlphaNumeric();
96 UPerfFunction
* TestIsPrint();
97 UPerfFunction
* TestIsControl();
98 UPerfFunction
* TestToLower();
99 UPerfFunction
* TestToUpper();
100 UPerfFunction
* TestIsWhiteSpace();
101 UPerfFunction
* TestStdLibIsAlpha();
102 UPerfFunction
* TestStdLibIsUpper();
103 UPerfFunction
* TestStdLibIsLower();
104 UPerfFunction
* TestStdLibIsDigit();
105 UPerfFunction
* TestStdLibIsSpace();
106 UPerfFunction
* TestStdLibIsAlphaNumeric();
107 UPerfFunction
* TestStdLibIsPrint();
108 UPerfFunction
* TestStdLibIsControl();
109 UPerfFunction
* TestStdLibToLower();
110 UPerfFunction
* TestStdLibToUpper();
111 UPerfFunction
* TestStdLibIsWhiteSpace();
118 inline void isAlpha(UChar32 ch
)
123 inline void isUpper(UChar32 ch
)
128 inline void isLower(UChar32 ch
)
133 inline void isDigit(UChar32 ch
)
138 inline void isSpace(UChar32 ch
)
143 inline void isAlphaNumeric(UChar32 ch
)
149 * This test may be different since c lib has a type PUNCT and it is printable.
150 * iswgraph is not used for testing since it is a subset of iswprint with the
151 * exception of returning true for white spaces. no match found in icu4c.
153 inline void isPrint(UChar32 ch
)
158 inline void isControl(UChar32 ch
)
163 inline void toLower(UChar32 ch
)
168 inline void toUpper(UChar32 ch
)
173 inline void isWhiteSpace(UChar32 ch
)
178 inline void StdLibIsAlpha(wchar_t ch
)
183 inline void StdLibIsUpper(wchar_t ch
)
188 inline void StdLibIsLower(wchar_t ch
)
193 inline void StdLibIsDigit(wchar_t ch
)
198 inline void StdLibIsSpace(wchar_t ch
)
203 inline void StdLibIsAlphaNumeric(wchar_t ch
)
209 * This test may be different since c lib has a type PUNCT and it is printable.
210 * iswgraph is not used for testing since it is a subset of iswprint with the
211 * exception of returning true for white spaces. no match found in icu4c.
213 inline void StdLibIsPrint(wchar_t ch
)
218 inline void StdLibIsControl(wchar_t ch
)
223 inline void StdLibToLower(wchar_t ch
)
228 inline void StdLibToUpper(wchar_t ch
)
233 inline void StdLibIsWhiteSpace(wchar_t ch
)