]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
b75a7d8f A |
3 | /******************************************************************** |
4 | * COPYRIGHT: | |
729e4ab9 | 5 | * Copyright (c) 1997-2010, International Business Machines Corporation and |
b75a7d8f A |
6 | * others. All Rights Reserved. |
7 | ********************************************************************/ | |
8 | ||
9 | /** | |
10 | * Normalizer basic tests | |
11 | */ | |
12 | ||
13 | #ifndef _TSTNORM | |
14 | #define _TSTNORM | |
15 | ||
16 | #include "unicode/utypes.h" | |
17 | ||
18 | #if !UCONFIG_NO_NORMALIZATION | |
19 | ||
20 | #include "unicode/normlzr.h" | |
21 | #include "intltest.h" | |
22 | ||
23 | class BasicNormalizerTest : public IntlTest { | |
24 | public: | |
25 | BasicNormalizerTest(); | |
26 | virtual ~BasicNormalizerTest(); | |
27 | ||
28 | void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); | |
29 | ||
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(); | |
46 | void TestSkippable(); | |
729e4ab9 A |
47 | void TestCustomComp(); |
48 | void TestCustomFCC(); | |
49 | void TestFilteredNormalizer2Coverage(); | |
0f5d89e8 A |
50 | void TestNormalizeUTF8WithEdits(); |
51 | void TestLowMappingToEmpty_D(); | |
52 | void TestLowMappingToEmpty_FCD(); | |
53 | void TestNormalizeIllFormedText(); | |
54 | void TestComposeJamoTBase(); | |
55 | void TestComposeBoundaryAfter(); | |
b75a7d8f A |
56 | |
57 | private: | |
58 | UnicodeString canonTests[24][3]; | |
59 | UnicodeString compatTests[11][3]; | |
60 | UnicodeString hangulCanon[2][3]; | |
61 | ||
62 | void | |
63 | TestPreviousNext(const UChar *src, int32_t srcLength, | |
64 | const UChar32 *expext, int32_t expectLength, | |
65 | const int32_t *expectIndex, // its length=expectLength+1 | |
66 | int32_t srcMiddle, int32_t expectMiddle, | |
67 | const char *moves, | |
68 | UNormalizationMode mode, | |
69 | const char *name); | |
70 | ||
71 | int32_t countFoldFCDExceptions(uint32_t foldingOptions); | |
72 | ||
73 | //------------------------------------------------------------------------ | |
74 | // Internal utilities | |
75 | // | |
76 | void backAndForth(Normalizer* iter, const UnicodeString& input); | |
77 | ||
78 | void staticTest(UNormalizationMode mode, int options, | |
79 | UnicodeString tests[][3], int length, int outCol); | |
80 | ||
81 | void iterateTest(Normalizer* iter, UnicodeString tests[][3], int length, int outCol); | |
82 | ||
83 | void assertEqual(const UnicodeString& input, | |
84 | const UnicodeString& expected, | |
85 | Normalizer* result, | |
86 | const UnicodeString& errPrefix); | |
87 | ||
88 | static UnicodeString hex(UChar ch); | |
89 | static UnicodeString hex(const UnicodeString& str); | |
90 | ||
0f5d89e8 | 91 | void checkLowMappingToEmpty(const Normalizer2 &n2); |
b75a7d8f A |
92 | }; |
93 | ||
94 | #endif /* #if !UCONFIG_NO_NORMALIZATION */ | |
95 | ||
96 | #endif // _TSTNORM |