scuffed-code/icu4c/source/test/intltest/rbbitst.h

138 lines
4.4 KiB
C
Raw Normal View History

/*************************************************************************
* Copyright (c) 1999-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*************************************************************************
* Date Name Description
* 12/15/99 Madhu Creation.
* 01/12/2000 Madhu Updated for changed API and added new tests
************************************************************************/
2000-01-17 20:59:08 +00:00
#ifndef RBBITEST_H
#define RBBITEST_H
#include "unicode/utypes.h"
#if !UCONFIG_NO_BREAK_ITERATION
2000-01-17 20:59:08 +00:00
#include "intltest.h"
#include "unicode/brkiter.h"
class Enumeration;
class BITestData;
struct TestParams;
class RBBIMonkeyKind;
2000-01-17 20:59:08 +00:00
U_NAMESPACE_BEGIN
class UVector32;
U_NAMESPACE_END
2000-01-17 20:59:08 +00:00
/**
* Test the RuleBasedBreakIterator class giving different rules
*/
class RBBITest: public IntlTest {
public:
RBBITest();
virtual ~RBBITest();
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
/**
* Tests rule status return values
**/
void TestStatusReturn();
void TestEmptyString();
void TestGetAvailableLocales();
void TestGetDisplayName();
void TestEndBehaviour();
void TestBug4153072();
void TestJapaneseLineBreak();
void TestThaiLineBreak();
void TestMixedThaiLineBreak();
void TestMaiyamok();
void TestMonkey(char *params);
2000-01-17 20:59:08 +00:00
void TestExtended();
UChar *ReadAndConvertFile(const char *fileName, int &ulen, const char *encoding, UErrorCode &status);
void executeTest(TestParams *);
void TestWordBreaks();
void TestWordBoundary();
void TestLineBreaks();
void TestSentBreaks();
void TestBug3818();
void TestJapaneseWordBreak();
void TestTrieDict();
void TestUnicodeFiles();
void TestBug5775();
void TestTailoredBreaks();
void TestDictRules();
void TestBug5532();
void TestDebug();
void TestProperties();
2000-01-17 20:59:08 +00:00
/***********************/
private:
/**
* internal methods to prepare test data
**/
2000-01-17 20:59:08 +00:00
/**
* Perform tests of BreakIterator forward and backward functionality
2000-01-17 20:59:08 +00:00
* on different kinds of iterators (word, sentence, line and character).
* It tests the methods first(), next(), current(), preceding(), following()
* previous() and isBoundary().
* It makes use of internal functions to achieve this.
2000-01-17 20:59:08 +00:00
**/
void generalIteratorTest(RuleBasedBreakIterator& bi, BITestData &td);
2000-01-17 20:59:08 +00:00
/**
* Internal method to perform iteration and test the first() and next() functions
**/
void testFirstAndNext(RuleBasedBreakIterator& bi, BITestData &td);
2000-01-17 20:59:08 +00:00
/**
* Internal method to perform iteration and test the last() and previous() functions
**/
void testLastAndPrevious(RuleBasedBreakIterator& bi, BITestData &td);
/**
* Internal method to perform iteration and test the following() function
**/
void testFollowing(RuleBasedBreakIterator& bi, BITestData &td);
/**
* Internal method to perform iteration and test the preceding() function
**/
void testPreceding(RuleBasedBreakIterator& bi, BITestData &td);
/**
* Internal method to perform iteration and test the isBoundary() function
**/
void testIsBoundary(RuleBasedBreakIterator& bi, BITestData &td);
2000-01-17 20:59:08 +00:00
/**
* Internal method to perform tests of BreakIterator multiple selection functionality
2000-01-17 20:59:08 +00:00
* on different kinds of iterators (word, sentence, line and character)
**/
void doMultipleSelectionTest(RuleBasedBreakIterator& iterator, BITestData &td);
void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name, uint32_t seed,
int32_t loopCount, UBool useUText);
// Run one of the Unicode Consortium boundary test data files.
void runUnicodeTestData(const char *fileName, RuleBasedBreakIterator *bi);
// Run a single test case from one of the Unicode Consortium test files.
void checkUnicodeTestCase(const char *testFileName, int lineNumber,
const UnicodeString &testString,
UVector32 *breakPositions,
RuleBasedBreakIterator *bi);
// Run the actual tests for TestTailoredBreaks()
void TBTest(BreakIterator* brkitr, int type, const char *locale, const char* escapedText,
const int32_t *expectOffsets, int32_t expectOffsetsCount);
2000-01-17 20:59:08 +00:00
};
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
2000-01-17 20:59:08 +00:00
#endif