1 /********************************************************************
3 * Copyright (c) 1997-2010, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
8 * Normalizer basic tests
14 #include "unicode/utypes.h"
16 #if !UCONFIG_NO_NORMALIZATION
18 #include "unicode/normlzr.h"
21 class BasicNormalizerTest
: public IntlTest
{
23 BasicNormalizerTest();
24 virtual ~BasicNormalizerTest();
26 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
= NULL
);
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();
45 void TestCustomComp();
47 void TestFilteredNormalizer2Coverage();
50 UnicodeString canonTests
[24][3];
51 UnicodeString compatTests
[11][3];
52 UnicodeString hangulCanon
[2][3];
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
,
60 UNormalizationMode mode
,
63 int32_t countFoldFCDExceptions(uint32_t foldingOptions
);
65 //------------------------------------------------------------------------
68 void backAndForth(Normalizer
* iter
, const UnicodeString
& input
);
70 void staticTest(UNormalizationMode mode
, int options
,
71 UnicodeString tests
[][3], int length
, int outCol
);
73 void iterateTest(Normalizer
* iter
, UnicodeString tests
[][3], int length
, int outCol
);
75 void assertEqual(const UnicodeString
& input
,
76 const UnicodeString
& expected
,
78 const UnicodeString
& errPrefix
);
80 static UnicodeString
hex(UChar ch
);
81 static UnicodeString
hex(const UnicodeString
& str
);
85 #endif /* #if !UCONFIG_NO_NORMALIZATION */