]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tstnorm.h
ICU-6.2.4.tar.gz
[apple/icu.git] / icuSources / test / intltest / tstnorm.h
1 /********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1997-2003, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7 /**
8 * Normalizer basic tests
9 */
10
11 #ifndef _TSTNORM
12 #define _TSTNORM
13
14 #include "unicode/utypes.h"
15
16 #if !UCONFIG_NO_NORMALIZATION
17
18 #include "unicode/normlzr.h"
19 #include "intltest.h"
20
21 class BasicNormalizerTest : public IntlTest {
22 public:
23 BasicNormalizerTest();
24 virtual ~BasicNormalizerTest();
25
26 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
27
28 void TestHangulCompose(void);
29 void TestHangulDecomp(void);
30 void TestPrevious(void);
31 void TestDecomp(void);
32 void TestCompatDecomp(void);
33 void TestCanonCompose(void);
34 void TestCompatCompose(void);
35 void TestTibetan(void);
36 void TestCompositionExclusion(void);
37 void TestZeroIndex(void);
38 void TestVerisign(void);
39 void TestPreviousNext(void);
40 void TestNormalizerAPI(void);
41 void TestConcatenate(void);
42 void TestCompare(void);
43 void FindFoldFCDExceptions();
44 void TestSkippable();
45
46 private:
47 UnicodeString canonTests[24][3];
48 UnicodeString compatTests[11][3];
49 UnicodeString hangulCanon[2][3];
50
51 void
52 TestPreviousNext(const UChar *src, int32_t srcLength,
53 const UChar32 *expext, int32_t expectLength,
54 const int32_t *expectIndex, // its length=expectLength+1
55 int32_t srcMiddle, int32_t expectMiddle,
56 const char *moves,
57 UNormalizationMode mode,
58 const char *name);
59
60 int32_t countFoldFCDExceptions(uint32_t foldingOptions);
61
62 //------------------------------------------------------------------------
63 // Internal utilities
64 //
65 void backAndForth(Normalizer* iter, const UnicodeString& input);
66
67 void staticTest(UNormalizationMode mode, int options,
68 UnicodeString tests[][3], int length, int outCol);
69
70 void iterateTest(Normalizer* iter, UnicodeString tests[][3], int length, int outCol);
71
72 void assertEqual(const UnicodeString& input,
73 const UnicodeString& expected,
74 Normalizer* result,
75 const UnicodeString& errPrefix);
76
77 static UnicodeString hex(UChar ch);
78 static UnicodeString hex(const UnicodeString& str);
79
80 };
81
82 #endif /* #if !UCONFIG_NO_NORMALIZATION */
83
84 #endif // _TSTNORM