]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/rbbitst.h
1 /*************************************************************************
2 * Copyright (c) 1999-2011, International Business Machines
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 ************************************************************************/
14 #include "unicode/utypes.h"
16 #if !UCONFIG_NO_BREAK_ITERATION
19 #include "unicode/brkiter.h"
32 * Test the RuleBasedBreakIterator class giving different rules
34 class RBBITest
: public IntlTest
{
40 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
= NULL
);
43 * Tests rule status return values
45 void TestStatusReturn();
47 void TestEmptyString();
48 void TestGetAvailableLocales();
49 void TestGetDisplayName();
50 void TestEndBehaviour();
51 void TestBug4153072();
52 void TestJapaneseLineBreak();
53 void TestThaiLineBreak();
54 void TestMixedThaiLineBreak();
56 void TestMonkey(char *params
);
59 UChar
*ReadAndConvertFile(const char *fileName
, int &ulen
, const char *encoding
, UErrorCode
&status
);
60 void executeTest(TestParams
*);
62 void TestWordBreaks();
63 void TestWordBoundary();
64 void TestLineBreaks();
65 void TestSentBreaks();
67 void TestJapaneseWordBreak();
69 void TestUnicodeFiles();
71 void TestTailoredBreaks();
76 void TestProperties();
78 /***********************/
81 * internal methods to prepare test data
85 * Perform tests of BreakIterator forward and backward functionality
86 * on different kinds of iterators (word, sentence, line and character).
87 * It tests the methods first(), next(), current(), preceding(), following()
88 * previous() and isBoundary().
89 * It makes use of internal functions to achieve this.
91 void generalIteratorTest(RuleBasedBreakIterator
& bi
, BITestData
&td
);
93 * Internal method to perform iteration and test the first() and next() functions
95 void testFirstAndNext(RuleBasedBreakIterator
& bi
, BITestData
&td
);
97 * Internal method to perform iteration and test the last() and previous() functions
99 void testLastAndPrevious(RuleBasedBreakIterator
& bi
, BITestData
&td
);
101 * Internal method to perform iteration and test the following() function
103 void testFollowing(RuleBasedBreakIterator
& bi
, BITestData
&td
);
105 * Internal method to perform iteration and test the preceding() function
107 void testPreceding(RuleBasedBreakIterator
& bi
, BITestData
&td
);
109 * Internal method to perform iteration and test the isBoundary() function
111 void testIsBoundary(RuleBasedBreakIterator
& bi
, BITestData
&td
);
113 * Internal method to perform tests of BreakIterator multiple selection functionality
114 * on different kinds of iterators (word, sentence, line and character)
116 void doMultipleSelectionTest(RuleBasedBreakIterator
& iterator
, BITestData
&td
);
118 void RunMonkey(BreakIterator
*bi
, RBBIMonkeyKind
&mk
, const char *name
, uint32_t seed
,
119 int32_t loopCount
, UBool useUText
);
121 // Run one of the Unicode Consortium boundary test data files.
122 void runUnicodeTestData(const char *fileName
, RuleBasedBreakIterator
*bi
);
124 // Run a single test case from one of the Unicode Consortium test files.
125 void checkUnicodeTestCase(const char *testFileName
, int lineNumber
,
126 const UnicodeString
&testString
,
127 UVector32
*breakPositions
,
128 RuleBasedBreakIterator
*bi
);
130 // Run the actual tests for TestTailoredBreaks()
131 void TBTest(BreakIterator
* brkitr
, int type
, const char *locale
, const char* escapedText
,
132 const int32_t *expectOffsets
, int32_t expectOffsetsCount
);
135 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */