1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2010, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
10 * Normalizer basic tests
16 #include "unicode/utypes.h"
18 #if !UCONFIG_NO_NORMALIZATION
20 #include "unicode/normlzr.h"
23 class BasicNormalizerTest
: public IntlTest
{
25 BasicNormalizerTest();
26 virtual ~BasicNormalizerTest();
28 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
= NULL
);
30 void TestHangulCompose(void);
31 void TestHangulDecomp(void);
32 void TestPrevious(void);
33 void TestDecomp(void);
34 void TestCompatDecomp(void);
35 void TestCanonCompose(void);
36 void TestCompatCompose(void);
37 void TestTibetan(void);
38 void TestCompositionExclusion(void);
39 void TestZeroIndex(void);
40 void TestVerisign(void);
41 void TestPreviousNext(void);
42 void TestNormalizerAPI(void);
43 void TestConcatenate(void);
44 void TestCompare(void);
45 void FindFoldFCDExceptions();
47 void TestCustomComp();
49 void TestFilteredNormalizer2Coverage();
52 UnicodeString canonTests
[24][3];
53 UnicodeString compatTests
[11][3];
54 UnicodeString hangulCanon
[2][3];
57 TestPreviousNext(const UChar
*src
, int32_t srcLength
,
58 const UChar32
*expext
, int32_t expectLength
,
59 const int32_t *expectIndex
, // its length=expectLength+1
60 int32_t srcMiddle
, int32_t expectMiddle
,
62 UNormalizationMode mode
,
65 int32_t countFoldFCDExceptions(uint32_t foldingOptions
);
67 //------------------------------------------------------------------------
70 void backAndForth(Normalizer
* iter
, const UnicodeString
& input
);
72 void staticTest(UNormalizationMode mode
, int options
,
73 UnicodeString tests
[][3], int length
, int outCol
);
75 void iterateTest(Normalizer
* iter
, UnicodeString tests
[][3], int length
, int outCol
);
77 void assertEqual(const UnicodeString
& input
,
78 const UnicodeString
& expected
,
80 const UnicodeString
& errPrefix
);
82 static UnicodeString
hex(UChar ch
);
83 static UnicodeString
hex(const UnicodeString
& str
);
87 #endif /* #if !UCONFIG_NO_NORMALIZATION */