]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/tstnorm.h
ICU-511.34.tar.gz
[apple/icu.git] / icuSources / test / intltest / tstnorm.h
CommitLineData
b75a7d8f
A
1/********************************************************************
2 * COPYRIGHT:
729e4ab9 3 * Copyright (c) 1997-2010, International Business Machines Corporation and
b75a7d8f
A
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
21class BasicNormalizerTest : public IntlTest {
22public:
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();
729e4ab9
A
45 void TestCustomComp();
46 void TestCustomFCC();
47 void TestFilteredNormalizer2Coverage();
b75a7d8f
A
48
49private:
50 UnicodeString canonTests[24][3];
51 UnicodeString compatTests[11][3];
52 UnicodeString hangulCanon[2][3];
53
54 void
55 TestPreviousNext(const UChar *src, int32_t srcLength,
56 const UChar32 *expext, int32_t expectLength,
57 const int32_t *expectIndex, // its length=expectLength+1
58 int32_t srcMiddle, int32_t expectMiddle,
59 const char *moves,
60 UNormalizationMode mode,
61 const char *name);
62
63 int32_t countFoldFCDExceptions(uint32_t foldingOptions);
64
65 //------------------------------------------------------------------------
66 // Internal utilities
67 //
68 void backAndForth(Normalizer* iter, const UnicodeString& input);
69
70 void staticTest(UNormalizationMode mode, int options,
71 UnicodeString tests[][3], int length, int outCol);
72
73 void iterateTest(Normalizer* iter, UnicodeString tests[][3], int length, int outCol);
74
75 void assertEqual(const UnicodeString& input,
76 const UnicodeString& expected,
77 Normalizer* result,
78 const UnicodeString& errPrefix);
79
80 static UnicodeString hex(UChar ch);
81 static UnicodeString hex(const UnicodeString& str);
82
83};
84
85#endif /* #if !UCONFIG_NO_NORMALIZATION */
86
87#endif // _TSTNORM