]>
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 | * File CREGRTST.H | |
9 | * | |
10 | * Modification History: | |
11 | * Name Description | |
12 | * Madhu Katragadda Converted to C, added extra functions and tests | |
13 | ********************************************************************************* | |
14 | */ | |
15 | ||
16 | /*C API functionality and regression test for BreakIterator*/ | |
17 | ||
18 | #ifndef _CBRKITREGTEST | |
19 | #define _CBRKITREGTEST | |
20 | ||
21 | #include "unicode/utypes.h" | |
22 | ||
23 | #if !UCONFIG_NO_BREAK_ITERATION | |
24 | ||
25 | #include "cintltst.h" | |
26 | ||
27 | ||
28 | struct Vector1; | |
29 | /* Internal functions used */ | |
30 | void addElement(struct Vector1*, const char*); | |
31 | UChar * addElement2(struct Vector1*, const UChar*); | |
32 | void cleanupVector(struct Vector1*); | |
33 | int32_t Count(struct Vector1*); | |
34 | UChar* elementAt(struct Vector1*, int32_t); | |
35 | /* Internal Functions used */ | |
36 | UChar* extractBetween(int32_t start, int32_t end, UChar* text); | |
37 | UChar* CharsToUCharArray(const char*); | |
38 | UChar* UCharToUCharArray(const UChar uchar); | |
39 | ||
40 | void AllocateTextBoundary(void); | |
41 | void FreeTextBoundary(void); | |
42 | ||
43 | /* The test functions */ | |
44 | ||
45 | /** | |
46 | * Test word break using doForwardSelectionTest | |
47 | **/ | |
48 | void TestForwardWordSelection(void); | |
49 | /** | |
50 | * Test word break using doFirstSelectionTest | |
51 | **/ | |
52 | void TestFirstWordSelection(void); | |
53 | /** | |
54 | * Test word break using doLastSelectionTest | |
55 | **/ | |
56 | void TestLastWordSelection(void); | |
57 | /** | |
58 | * Test word break using doBackwardSelectionTest | |
59 | **/ | |
60 | void TestBackwardWordSelection(void); | |
61 | /** | |
62 | * Test word break using doForwardIndexSelectionTest | |
63 | **/ | |
64 | void TestForwardWordIndexSelection(void); | |
65 | /** | |
66 | * Test word break using doBackwardIndexSelectionTest | |
67 | **/ | |
68 | void TestBackwardWordIndexSelection(void); | |
69 | ||
70 | /** | |
71 | * Test sentence break using doForwardSelectionTest | |
72 | **/ | |
73 | void TestForwardSentenceSelection(void); | |
74 | /** | |
75 | * Test sentence break using doBackwardSelectionTest | |
76 | **/ | |
77 | void TestBackwardSentenceSelection(void); | |
78 | /** | |
79 | * Test sentence break using doFirstSelectionTest | |
80 | **/ | |
81 | void TestFirstSentenceSelection(void); | |
82 | /** | |
83 | * Test sentence break using doLastSelectionTest | |
84 | **/ | |
85 | void TestLastSentenceSelection(void); | |
86 | /** | |
87 | * Test sentence break using doForwardIndexSelectionTest | |
88 | **/ | |
89 | void TestForwardSentenceIndexSelection(void); | |
90 | /** | |
91 | * Test sentence break using doBackwardIndexSelectionTest | |
92 | **/ | |
93 | void TestBackwardSentenceIndexSelection(void); | |
94 | ||
95 | /** | |
96 | * Test line break using doForwardSelectionTest | |
97 | **/ | |
98 | void TestForwardLineSelection(void); | |
99 | /** | |
100 | * Test line break using doBackwardSelectionTest | |
101 | **/ | |
102 | void TestBackwardLineSelection(void); | |
103 | /** | |
104 | * Test line break using doFirstSelectionTest | |
105 | **/ | |
106 | void TestFirstLineSelection(void); | |
107 | /** | |
108 | * Test line break using doLastSelectionTest | |
109 | **/ | |
110 | void TestLastLineSelection(void); | |
111 | /** | |
112 | * Test line break using doForwardIndexSelectionTest | |
113 | **/ | |
114 | void TestForwardLineIndexSelection(void); | |
115 | /** | |
116 | * Test line break using doBackwardIndexSelectionTest | |
117 | **/ | |
118 | void TestBackwardLineIndexSelection(void); | |
119 | ||
120 | /** | |
121 | * Test character break using doForwardSelectionTest | |
122 | **/ | |
123 | void TestForwardCharacterSelection(void); | |
124 | /** | |
125 | * Test character break using doBackwardSelectionTest | |
126 | **/ | |
127 | void TestBackwardCharacterSelection(void); | |
128 | /** | |
129 | * Test character break using doFirstSelectionTest | |
130 | **/ | |
131 | void TestFirstCharacterSelection(void); | |
132 | /** | |
133 | * Test character break using doLastSelectionTest | |
134 | **/ | |
135 | void TestLastCharacterSelection(void); | |
136 | /** | |
137 | * Test character break using doForwardIndexSelectionTest | |
138 | **/ | |
139 | void TestForwardCharacterIndexSelection(void); | |
140 | /** | |
141 | * Test character break using doBackwardIndexSelectionTest | |
142 | **/ | |
143 | void TestBackwardCharacterIndexSelection(void); | |
144 | ||
145 | ||
146 | /** | |
147 | * test methods ubrk_preceding(), ubrk_following() | |
148 | **/ | |
149 | void TestPreceding(void); | |
150 | void TestEndBehaviour(void); | |
151 | ||
152 | void TestWordInvariants(void); | |
153 | void TestSentenceInvariants(void); | |
154 | void TestCharacterInvariants(void); | |
155 | void TestLineInvariants(void); | |
156 | /*-----------------*/ | |
157 | /* Internal functions to prepare test data */ | |
158 | ||
159 | void addTestWordData(void); | |
160 | void addTestSentenceData(void); | |
161 | void addTestLineData(void); | |
162 | void addTestCharacterData(void); | |
163 | UChar* createTestData(struct Vector1*, int32_t); | |
164 | ||
165 | /* Test Implementation routines*/ | |
166 | ||
167 | /** | |
168 | * Perform tests of BreakIterator forward functionality | |
169 | * on different kinds of iterators (word, sentence, line and character) | |
170 | **/ | |
171 | void doForwardSelectionTest(UBreakIterator*, UChar* testText, struct Vector1* result); | |
172 | /** | |
173 | * Perform tests of BreakIterator backward functionality | |
174 | * on different kinds of iterators (word, sentence, line and character) | |
175 | **/ | |
176 | void doBackwardSelectionTest(UBreakIterator*, UChar* testText, struct Vector1* result); | |
177 | /** | |
178 | * Perform tests of BreakIterator first selection functionality | |
179 | * on different kinds of iterators (word, sentence, line and character) | |
180 | **/ | |
181 | void doFirstSelectionTest(UBreakIterator* iterator, UChar* testText, struct Vector1* result); | |
182 | /** | |
183 | * Perform tests of BreakIterator last selection functionality | |
184 | * on different kinds of iterators (word, sentence, line and character) | |
185 | **/ | |
186 | void doLastSelectionTest(UBreakIterator* iterator, UChar* testText, struct Vector1* result); | |
187 | /** | |
188 | * Perform tests of BreakIterator backward index functionality | |
189 | * on different kinds of iterators (word, sentence, line and character) | |
190 | **/ | |
191 | void doForwardIndexSelectionTest(UBreakIterator* iterator, UChar* testText, struct Vector1* result); | |
192 | /** | |
193 | * Perform tests of BreakIterator multiple selection functionality | |
194 | * on different kinds of iterators (word, sentence, line and character) | |
195 | **/ | |
196 | void doBackwardIndexSelectionTest(UBreakIterator* iterator, UChar* testText, struct Vector1* result); | |
197 | ||
198 | void doBreakInvariantTest(UBreakIteratorType type, UChar* testChars); | |
199 | ||
200 | void doOtherInvariantTest(UBreakIteratorType type , UChar* testChars); | |
201 | /** | |
202 | * Perform tests with short sample code | |
203 | **/ | |
204 | void sample(UBreakIterator* tb, UChar* text); | |
205 | ||
206 | ||
207 | struct Vector1* wordSelectionData; | |
208 | struct Vector1* sentenceSelectionData; | |
209 | struct Vector1* lineSelectionData; | |
210 | struct Vector1* characterSelectionData; | |
211 | ||
212 | UChar* testWordText; | |
213 | UChar* testSentenceText; | |
214 | UChar* testLineText; | |
215 | UChar* testCharacterText; | |
216 | ||
217 | ||
218 | static UChar *cannedTestChars; | |
219 | ||
220 | #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ | |
221 | ||
222 | #endif |