2000-03-10 00:42:27 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2001-03-21 20:09:56 +00:00
|
|
|
* Copyright (c) 1999-2001, International Business Machines Corporation and
|
2000-03-10 00:42:27 +00:00
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
|
|
|
/************************************************************************
|
2000-01-17 20:59:08 +00:00
|
|
|
* Date Name Description
|
|
|
|
* 12/15/99 Madhu Creation.
|
|
|
|
* 01/12/2000 Madhu Updated for changed API and added new tests
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef RBBITEST_H
|
|
|
|
#define RBBITEST_H
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#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 Vector;
|
|
|
|
class Enumeration;
|
2002-07-22 22:02:08 +00:00
|
|
|
class BITestData;
|
2003-05-16 22:05:35 +00:00
|
|
|
struct TestParams;
|
2000-01-17 20:59:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the RuleBasedBreakIterator class giving different rules
|
|
|
|
*/
|
|
|
|
class RBBITest: public IntlTest {
|
|
|
|
public:
|
|
|
|
|
2002-08-27 19:10:11 +00:00
|
|
|
RBBITest();
|
2002-08-28 15:55:37 +00:00
|
|
|
virtual ~RBBITest();
|
2002-08-27 19:10:11 +00:00
|
|
|
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
2003-05-21 06:07:18 +00:00
|
|
|
|
2002-06-27 01:50:22 +00:00
|
|
|
/**
|
|
|
|
* Tests rule status return values
|
|
|
|
**/
|
|
|
|
void TestStatusReturn();
|
|
|
|
|
2002-07-31 19:05:33 +00:00
|
|
|
/**
|
|
|
|
* Run the Unicode Line Break test data.
|
|
|
|
**/
|
|
|
|
void TestLineBreakData();
|
|
|
|
|
2003-05-16 22:05:35 +00:00
|
|
|
/**
|
|
|
|
* Run tests from external test data file.
|
|
|
|
*/
|
|
|
|
|
2002-08-27 19:10:11 +00:00
|
|
|
void TestSentenceInvariants();
|
|
|
|
void TestCharacterInvariants();
|
|
|
|
void TestWordInvariants();
|
|
|
|
void TestEmptyString();
|
|
|
|
void TestGetAvailableLocales();
|
|
|
|
void TestGetDisplayName();
|
|
|
|
void TestEndBehaviour();
|
|
|
|
void TestBug4153072();
|
|
|
|
void TestJapaneseLineBreak();
|
|
|
|
void TestThaiLineBreak();
|
|
|
|
void TestMixedThaiLineBreak();
|
|
|
|
void TestMaiyamok();
|
|
|
|
void TestThaiWordBreak();
|
2000-01-17 20:59:08 +00:00
|
|
|
|
2003-05-16 22:05:35 +00:00
|
|
|
void TestExtended();
|
|
|
|
UChar *ReadAndConvertFile(const char *fileName, int &ulen, UErrorCode &status);
|
|
|
|
void executeTest(TestParams *);
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-17 20:59:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/***********************/
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* internal methods to prepare test data
|
|
|
|
**/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform tests of BreakIterator forward and backward functionality
|
|
|
|
* on different kinds of iterators (word, sentence, line and character).
|
2000-08-14 21:42:36 +00:00
|
|
|
* 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
|
|
|
**/
|
2002-07-22 22:02:08 +00:00
|
|
|
void generalIteratorTest(RuleBasedBreakIterator& bi, BITestData &td);
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
2000-08-14 21:42:36 +00:00
|
|
|
* Internal method to perform iteration and test the first() and next() functions
|
|
|
|
**/
|
2002-07-22 22:02:08 +00:00
|
|
|
void testFirstAndNext(RuleBasedBreakIterator& bi, BITestData &td);
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
2000-08-14 21:42:36 +00:00
|
|
|
* Internal method to perform iteration and test the last() and previous() functions
|
|
|
|
**/
|
2002-07-22 22:02:08 +00:00
|
|
|
void testLastAndPrevious(RuleBasedBreakIterator& bi, BITestData &td);
|
2000-08-14 21:42:36 +00:00
|
|
|
/**
|
|
|
|
* Internal method to perform iteration and test the following() function
|
|
|
|
**/
|
2002-07-22 22:02:08 +00:00
|
|
|
void testFollowing(RuleBasedBreakIterator& bi, BITestData &td);
|
2000-08-14 21:42:36 +00:00
|
|
|
/**
|
|
|
|
* Internal method to perform iteration and test the preceding() function
|
|
|
|
**/
|
2002-07-22 22:02:08 +00:00
|
|
|
void testPreceding(RuleBasedBreakIterator& bi, BITestData &td);
|
2000-08-14 21:42:36 +00:00
|
|
|
/**
|
|
|
|
* Internal method to perform iteration and test the isBoundary() function
|
|
|
|
**/
|
2002-07-22 22:02:08 +00:00
|
|
|
void testIsBoundary(RuleBasedBreakIterator& bi, BITestData &td);
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
|
|
|
* Internal method to perform tests of BreakIterator multiple selection functionality
|
|
|
|
* on different kinds of iterators (word, sentence, line and character)
|
|
|
|
**/
|
2002-07-22 22:02:08 +00:00
|
|
|
void doMultipleSelectionTest(RuleBasedBreakIterator& iterator, BITestData &td);
|
2000-08-14 21:42:36 +00:00
|
|
|
|
2002-08-27 19:10:11 +00:00
|
|
|
void doBreakInvariantTest(BreakIterator& tb, UnicodeString& testChars);
|
|
|
|
void doOtherInvariantTest(BreakIterator& tb, UnicodeString& testChars);
|
|
|
|
|
2000-01-17 20:59:08 +00:00
|
|
|
};
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
|
2000-01-17 20:59:08 +00:00
|
|
|
|
|
|
|
#endif
|