]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/rbbitst.h
ICU-6.2.4.tar.gz
[apple/icu.git] / icuSources / test / intltest / rbbitst.h
1 /********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1999-2004, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6 /************************************************************************
7 * Date Name Description
8 * 12/15/99 Madhu Creation.
9 * 01/12/2000 Madhu Updated for changed API and added new tests
10 ************************************************************************/
11
12
13 #ifndef RBBITEST_H
14 #define RBBITEST_H
15
16 #include "unicode/utypes.h"
17
18 #if !UCONFIG_NO_BREAK_ITERATION
19
20 #include "intltest.h"
21 #include "unicode/brkiter.h"
22
23 class Vector;
24 class Enumeration;
25 class BITestData;
26 struct TestParams;
27 class RBBIMonkeyKind;
28
29 /**
30 * Test the RuleBasedBreakIterator class giving different rules
31 */
32 class RBBITest: public IntlTest {
33 public:
34
35 RBBITest();
36 virtual ~RBBITest();
37
38 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
39
40 /**
41 * Tests rule status return values
42 **/
43 void TestStatusReturn();
44
45 /**
46 * Run the Unicode Line Break test data.
47 **/
48 void TestLineBreakData();
49
50 /**
51 * Run tests from external test data file.
52 */
53
54 void TestSentenceInvariants();
55 void TestCharacterInvariants();
56 void TestWordInvariants();
57 void TestEmptyString();
58 void TestGetAvailableLocales();
59 void TestGetDisplayName();
60 void TestEndBehaviour();
61 void TestBug4153072();
62 void TestJapaneseLineBreak();
63 void TestThaiLineBreak();
64 void TestMixedThaiLineBreak();
65 void TestMaiyamok();
66 void TestThaiWordBreak();
67 void TestMonkey(char *params);
68
69 void TestExtended();
70 UChar *ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode &status);
71 void executeTest(TestParams *);
72
73 void TestWordBreaks();
74 void TestWordBoundary();
75 void TestLineBreaks();
76 void TestSentBreaks();
77 void TestBug3818();
78 void TestJapaneseWordBreak();
79
80
81 /***********************/
82 private:
83 /**
84 * internal methods to prepare test data
85 **/
86
87 /**
88 * Perform tests of BreakIterator forward and backward functionality
89 * on different kinds of iterators (word, sentence, line and character).
90 * It tests the methods first(), next(), current(), preceding(), following()
91 * previous() and isBoundary().
92 * It makes use of internal functions to achieve this.
93 **/
94 void generalIteratorTest(RuleBasedBreakIterator& bi, BITestData &td);
95 /**
96 * Internal method to perform iteration and test the first() and next() functions
97 **/
98 void testFirstAndNext(RuleBasedBreakIterator& bi, BITestData &td);
99 /**
100 * Internal method to perform iteration and test the last() and previous() functions
101 **/
102 void testLastAndPrevious(RuleBasedBreakIterator& bi, BITestData &td);
103 /**
104 * Internal method to perform iteration and test the following() function
105 **/
106 void testFollowing(RuleBasedBreakIterator& bi, BITestData &td);
107 /**
108 * Internal method to perform iteration and test the preceding() function
109 **/
110 void testPreceding(RuleBasedBreakIterator& bi, BITestData &td);
111 /**
112 * Internal method to perform iteration and test the isBoundary() function
113 **/
114 void testIsBoundary(RuleBasedBreakIterator& bi, BITestData &td);
115 /**
116 * Internal method to perform tests of BreakIterator multiple selection functionality
117 * on different kinds of iterators (word, sentence, line and character)
118 **/
119 void doMultipleSelectionTest(RuleBasedBreakIterator& iterator, BITestData &td);
120
121 void doBreakInvariantTest(BreakIterator& tb, UnicodeString& testChars);
122 void doOtherInvariantTest(BreakIterator& tb, UnicodeString& testChars);
123
124 void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name, uint32_t seed, int32_t loopCount);
125
126 };
127
128 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */
129
130 #endif