]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/perf/charperf/charperf.h
2 **********************************************************************
3 * Copyright (c) 2002, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 **********************************************************************
12 #include "unicode/uchar.h"
17 typedef void (*CharPerfFn
)(UChar32 ch
);
18 typedef void (*StdLibCharPerfFn
)(wchar_t ch
);
20 class CharPerfFunction
: public UPerfFunction
23 virtual void call(UErrorCode
* status
)
25 for (UChar32 i
= MIN_
; i
< MAX_
; i
++) {
30 virtual long getOperationsPerIteration()
34 CharPerfFunction(CharPerfFn func
, UChar32 min
, UChar32 max
)
47 class StdLibCharPerfFunction
: public UPerfFunction
50 virtual void call(UErrorCode
* status
)
52 // note wchar_t is unsigned, it will revert to 0 once it reaches
54 for (wchar_t i
= MIN_
; i
< MAX_
; i
++) {
59 virtual long getOperationsPerIteration()
64 StdLibCharPerfFunction(StdLibCharPerfFn func
, wchar_t min
, wchar_t max
)
71 ~StdLibCharPerfFunction()
76 StdLibCharPerfFn m_fn_
;
81 class CharPerformanceTest
: public UPerfTest
84 CharPerformanceTest(int32_t argc
, const char *argv
[], UErrorCode
&status
);
85 ~CharPerformanceTest();
86 virtual UPerfFunction
* runIndexedTest(int32_t index
, UBool exec
,
89 UPerfFunction
* TestIsAlpha();
90 UPerfFunction
* TestIsUpper();
91 UPerfFunction
* TestIsLower();
92 UPerfFunction
* TestIsDigit();
93 UPerfFunction
* TestIsSpace();
94 UPerfFunction
* TestIsAlphaNumeric();
95 UPerfFunction
* TestIsPrint();
96 UPerfFunction
* TestIsControl();
97 UPerfFunction
* TestToLower();
98 UPerfFunction
* TestToUpper();
99 UPerfFunction
* TestIsWhiteSpace();
100 UPerfFunction
* TestStdLibIsAlpha();
101 UPerfFunction
* TestStdLibIsUpper();
102 UPerfFunction
* TestStdLibIsLower();
103 UPerfFunction
* TestStdLibIsDigit();
104 UPerfFunction
* TestStdLibIsSpace();
105 UPerfFunction
* TestStdLibIsAlphaNumeric();
106 UPerfFunction
* TestStdLibIsPrint();
107 UPerfFunction
* TestStdLibIsControl();
108 UPerfFunction
* TestStdLibToLower();
109 UPerfFunction
* TestStdLibToUpper();
110 UPerfFunction
* TestStdLibIsWhiteSpace();
117 inline void isAlpha(UChar32 ch
)
122 inline void isUpper(UChar32 ch
)
127 inline void isLower(UChar32 ch
)
132 inline void isDigit(UChar32 ch
)
137 inline void isSpace(UChar32 ch
)
142 inline void isAlphaNumeric(UChar32 ch
)
148 * This test may be different since c lib has a type PUNCT and it is printable.
149 * iswgraph is not used for testing since it is a subset of iswprint with the
150 * exception of returning true for white spaces. no match found in icu4c.
152 inline void isPrint(UChar32 ch
)
157 inline void isControl(UChar32 ch
)
162 inline void toLower(UChar32 ch
)
167 inline void toUpper(UChar32 ch
)
172 inline void isWhiteSpace(UChar32 ch
)
177 inline void StdLibIsAlpha(wchar_t ch
)
182 inline void StdLibIsUpper(wchar_t ch
)
187 inline void StdLibIsLower(wchar_t ch
)
192 inline void StdLibIsDigit(wchar_t ch
)
197 inline void StdLibIsSpace(wchar_t ch
)
202 inline void StdLibIsAlphaNumeric(wchar_t ch
)
208 * This test may be different since c lib has a type PUNCT and it is printable.
209 * iswgraph is not used for testing since it is a subset of iswprint with the
210 * exception of returning true for white spaces. no match found in icu4c.
212 inline void StdLibIsPrint(wchar_t ch
)
217 inline void StdLibIsControl(wchar_t ch
)
222 inline void StdLibToLower(wchar_t ch
)
227 inline void StdLibToUpper(wchar_t ch
)
232 inline void StdLibIsWhiteSpace(wchar_t ch
)