]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /******************************************************************** |
2 | * COPYRIGHT: | |
3 | * Copyright (c) 1997-2001, International Business Machines Corporation and | |
4 | * others. All Rights Reserved. | |
5 | ********************************************************************/ | |
6 | ||
7 | /** | |
8 | * Collation Iterator tests. | |
9 | * (Let me reiterate my position...) | |
10 | */ | |
11 | ||
12 | #ifndef _ITERCOLL | |
13 | #define _ITERCOLL | |
14 | ||
15 | #include "unicode/utypes.h" | |
16 | ||
17 | #if !UCONFIG_NO_COLLATION | |
18 | ||
19 | #include "unicode/tblcoll.h" | |
20 | #include "unicode/coleitr.h" | |
21 | #include "tscoll.h" | |
22 | ||
23 | class CollationIteratorTest: public IntlTestCollator | |
24 | { | |
25 | public: | |
26 | ||
27 | // If this is too small for the test data, just increase it. | |
28 | // Just don't make it too large, otherwise the executable will get too big | |
29 | enum EToken_Len { MAX_TOKEN_LEN = 16 }; | |
30 | ||
31 | CollationIteratorTest(); | |
32 | virtual ~CollationIteratorTest(); | |
33 | ||
34 | void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL); | |
35 | ||
36 | /** | |
37 | * Test that results from CollationElementIterator.next is equivalent to | |
38 | * the reversed results from CollationElementIterator.previous, for the set | |
39 | * of BMP characters. | |
40 | */ | |
41 | void TestUnicodeChar(); | |
42 | ||
43 | /** | |
44 | * Test for CollationElementIterator.previous() | |
45 | * | |
46 | * @bug 4108758 - Make sure it works with contracting characters | |
47 | * | |
48 | */ | |
49 | void TestPrevious(/* char* par */); | |
50 | ||
51 | /** | |
52 | * Test for getOffset() and setOffset() | |
53 | */ | |
54 | void TestOffset(/* char* par */); | |
55 | ||
56 | /** | |
57 | * Test for setText() | |
58 | */ | |
59 | void TestSetText(/* char* par */); | |
60 | ||
61 | /** @bug 4108762 | |
62 | * Test for getMaxExpansion() | |
63 | */ | |
64 | void TestMaxExpansion(/* char* par */); | |
65 | ||
66 | /* | |
67 | * @bug 4157299 | |
68 | */ | |
69 | void TestClearBuffers(/* char* par */); | |
70 | ||
71 | /** | |
72 | * Testing the assignment operator | |
73 | */ | |
74 | void TestAssignment(); | |
75 | ||
76 | /** | |
77 | * Testing the constructors | |
78 | */ | |
79 | void TestConstructors(); | |
80 | ||
81 | /** | |
82 | * Testing the strength order functionality | |
83 | */ | |
84 | void TestStrengthOrder(); | |
85 | ||
86 | //------------------------------------------------------------------------ | |
87 | // Internal utilities | |
88 | // | |
89 | ||
90 | private: | |
91 | ||
92 | struct ExpansionRecord | |
93 | { | |
94 | UChar character; | |
95 | int32_t count; | |
96 | }; | |
97 | ||
98 | /** | |
99 | * Verify that getMaxExpansion works on a given set of collation rules | |
100 | */ | |
101 | void verifyExpansion(UnicodeString rules, ExpansionRecord tests[], int32_t testCount); | |
102 | ||
103 | /** | |
104 | * Return a string containing all of the collation orders | |
105 | * returned by calls to next on the specified iterator | |
106 | */ | |
107 | UnicodeString &orderString(CollationElementIterator &iter, UnicodeString &target); | |
108 | ||
109 | void assertEqual(CollationElementIterator &i1, CollationElementIterator &i2); | |
110 | ||
111 | RuleBasedCollator *en_us; | |
112 | const UnicodeString test1; | |
113 | const UnicodeString test2; | |
114 | ||
115 | }; | |
116 | ||
117 | #endif /* #if !UCONFIG_NO_COLLATION */ | |
118 | ||
119 | #endif |