]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/rbbitst.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*************************************************************************
4 * Copyright (c) 1999-2016, International Business Machines
5 * Corporation and others. All Rights Reserved.
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 ************************************************************************/
16 #include "unicode/utypes.h"
18 #if !UCONFIG_NO_BREAK_ITERATION
23 #include "unicode/brkiter.h"
24 #include "unicode/rbbi.h"
36 * Test the RuleBasedBreakIterator class giving different rules
38 class RBBITest
: public IntlTest
{
44 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
= NULL
);
46 void TestGetAvailableLocales();
47 void TestGetDisplayName();
48 void TestEndBehaviour();
49 void TestBug4153072();
50 void TestJapaneseLineBreak();
51 void TestThaiLineBreak();
52 void TestMixedThaiLineBreak();
57 UChar
*ReadAndConvertFile(const char *fileName
, int &ulen
, const char *encoding
, UErrorCode
&status
);
58 void executeTest(TestParams
*, UErrorCode
&status
);
60 void TestWordBreaks();
61 void TestWordBoundary();
62 void TestLineBreaks();
63 void TestSentBreaks();
65 void TestJapaneseWordBreak();
67 void TestUnicodeFiles();
69 void TestTailoredBreaks();
80 void TestTableRedundancies();
83 void TestReverse(std::unique_ptr
<RuleBasedBreakIterator
>bi
);
87 void TestProperties();
89 /***********************/
92 * internal methods to prepare test data
95 void RunMonkey(BreakIterator
*bi
, RBBIMonkeyKind
&mk
, const char *name
, uint32_t seed
,
96 int32_t loopCount
, UBool useUText
);
98 // Run one of the Unicode Consortium boundary test data files.
99 void runUnicodeTestData(const char *fileName
, RuleBasedBreakIterator
*bi
);
101 // Run a single test case from one of the Unicode Consortium test files.
102 void checkUnicodeTestCase(const char *testFileName
, int lineNumber
,
103 const UnicodeString
&testString
,
104 UVector32
*breakPositions
,
105 RuleBasedBreakIterator
*bi
);
107 // Run the actual tests for TestTailoredBreaks()
108 void TBTest(BreakIterator
* brkitr
, int type
, const char *locale
, const char* escapedText
,
109 const int32_t *expectOffsets
, int32_t expectOffsetsCount
);
111 /** Filter for test cases from the Unicode test data files.
112 * Some need to be skipped because ICU is unable to fully implement the
113 * Unicode boundary specifications.
114 * @param testCase the test data string.
115 * @param fileName the Unicode test data file name.
116 * @return FALSE if the test case should be run, TRUE if it should be skipped.
118 UBool
testCaseIsKnownIssue(const UnicodeString
&testCase
, const char *fileName
);
120 // Test parameters, from the test framework and test invocation.
121 const char* fTestParams
;
124 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */