]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/rbbitst.h
ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / rbbitst.h
CommitLineData
46f4442e 1/*************************************************************************
2ca993e8 2 * Copyright (c) 1999-2016, International Business Machines
46f4442e
A
3 * Corporation and others. All Rights Reserved.
4 *************************************************************************
5 * Date Name Description
6 * 12/15/99 Madhu Creation.
7 * 01/12/2000 Madhu Updated for changed API and added new tests
8 ************************************************************************/
b75a7d8f
A
9
10
11#ifndef RBBITEST_H
12#define RBBITEST_H
13
14#include "unicode/utypes.h"
15
16#if !UCONFIG_NO_BREAK_ITERATION
17
18#include "intltest.h"
19#include "unicode/brkiter.h"
2ca993e8 20#include "unicode/rbbi.h"
46f4442e 21
b75a7d8f
A
22class Enumeration;
23class BITestData;
24struct TestParams;
25class RBBIMonkeyKind;
26
46f4442e
A
27U_NAMESPACE_BEGIN
28class UVector32;
29U_NAMESPACE_END
30
b75a7d8f
A
31/**
32 * Test the RuleBasedBreakIterator class giving different rules
33 */
34class RBBITest: public IntlTest {
35public:
73c04bcf 36
b75a7d8f
A
37 RBBITest();
38 virtual ~RBBITest();
39
40 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
73c04bcf 41
b75a7d8f
A
42 /**
43 * Tests rule status return values
73c04bcf 44 **/
b75a7d8f
A
45 void TestStatusReturn();
46
b75a7d8f
A
47 void TestEmptyString();
48 void TestGetAvailableLocales();
49 void TestGetDisplayName();
50 void TestEndBehaviour();
51 void TestBug4153072();
52 void TestJapaneseLineBreak();
53 void TestThaiLineBreak();
73c04bcf
A
54 void TestMixedThaiLineBreak();
55 void TestMaiyamok();
b75a7d8f
A
56 void TestMonkey(char *params);
57
58 void TestExtended();
46f4442e 59 UChar *ReadAndConvertFile(const char *fileName, int &ulen, const char *encoding, UErrorCode &status);
b331163b 60 void executeTest(TestParams *, UErrorCode &status);
b75a7d8f 61
374ca955
A
62 void TestWordBreaks();
63 void TestWordBoundary();
64 void TestLineBreaks();
65 void TestSentBreaks();
66 void TestBug3818();
67 void TestJapaneseWordBreak();
73c04bcf 68 void TestTrieDict();
46f4442e
A
69 void TestUnicodeFiles();
70 void TestBug5775();
729e4ab9
A
71 void TestTailoredBreaks();
72 void TestDictRules();
73 void TestBug5532();
51004dcb 74 void TestBug9983();
46f4442e 75
73c04bcf 76 void TestDebug();
4388f060 77 void TestProperties();
73c04bcf 78
b75a7d8f
A
79/***********************/
80private:
81 /**
82 * internal methods to prepare test data
83 **/
73c04bcf 84
b75a7d8f 85 /**
73c04bcf 86 * Perform tests of BreakIterator forward and backward functionality
b75a7d8f
A
87 * on different kinds of iterators (word, sentence, line and character).
88 * It tests the methods first(), next(), current(), preceding(), following()
89 * previous() and isBoundary().
90 * It makes use of internal functions to achieve this.
91 **/
92 void generalIteratorTest(RuleBasedBreakIterator& bi, BITestData &td);
93 /**
94 * Internal method to perform iteration and test the first() and next() functions
95 **/
96 void testFirstAndNext(RuleBasedBreakIterator& bi, BITestData &td);
97 /**
98 * Internal method to perform iteration and test the last() and previous() functions
99 **/
100 void testLastAndPrevious(RuleBasedBreakIterator& bi, BITestData &td);
101 /**
102 * Internal method to perform iteration and test the following() function
103 **/
104 void testFollowing(RuleBasedBreakIterator& bi, BITestData &td);
105 /**
106 * Internal method to perform iteration and test the preceding() function
107 **/
108 void testPreceding(RuleBasedBreakIterator& bi, BITestData &td);
109 /**
110 * Internal method to perform iteration and test the isBoundary() function
111 **/
112 void testIsBoundary(RuleBasedBreakIterator& bi, BITestData &td);
113 /**
73c04bcf 114 * Internal method to perform tests of BreakIterator multiple selection functionality
b75a7d8f
A
115 * on different kinds of iterators (word, sentence, line and character)
116 **/
117 void doMultipleSelectionTest(RuleBasedBreakIterator& iterator, BITestData &td);
118
73c04bcf
A
119 void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name, uint32_t seed,
120 int32_t loopCount, UBool useUText);
b75a7d8f 121
46f4442e
A
122 // Run one of the Unicode Consortium boundary test data files.
123 void runUnicodeTestData(const char *fileName, RuleBasedBreakIterator *bi);
124
125 // Run a single test case from one of the Unicode Consortium test files.
126 void checkUnicodeTestCase(const char *testFileName, int lineNumber,
127 const UnicodeString &testString,
128 UVector32 *breakPositions,
129 RuleBasedBreakIterator *bi);
729e4ab9
A
130
131 // Run the actual tests for TestTailoredBreaks()
132 void TBTest(BreakIterator* brkitr, int type, const char *locale, const char* escapedText,
133 const int32_t *expectOffsets, int32_t expectOffsetsCount);
b331163b
A
134
135 /** Filter for test cases from the Unicode test data files.
136 * Some need to be skipped because ICU is unable to fully implement the
137 * Unicode boundary specifications.
138 * @param testCase the test data string.
139 * @param fileName the Unicode test data file name.
140 * @return FALSE if the test case should be run, TRUE if it should be skipped.
141 */
142 UBool testCaseIsKnownIssue(const UnicodeString &testCase, const char *fileName);
b75a7d8f
A
143};
144
145#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
146
147#endif