2000-03-10 00:42:27 +00:00
|
|
|
/********************************************************************
|
2005-03-23 02:13:53 +00:00
|
|
|
* COPYRIGHT:
|
2006-03-29 23:33:02 +00:00
|
|
|
* Copyright (c) 1999-2006, 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"
|
|
|
|
|
2003-05-27 16:29:25 +00:00
|
|
|
class Vector;
|
|
|
|
class Enumeration;
|
|
|
|
class BITestData;
|
2003-05-16 22:05:35 +00:00
|
|
|
struct TestParams;
|
2003-05-27 16:29:25 +00:00
|
|
|
class RBBIMonkeyKind;
|
2000-01-17 20:59:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the RuleBasedBreakIterator class giving different rules
|
|
|
|
*/
|
|
|
|
class RBBITest: public IntlTest {
|
|
|
|
public:
|
2005-03-23 02:13:53 +00:00
|
|
|
|
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 );
|
2005-03-23 02:13:53 +00:00
|
|
|
|
2002-06-27 01:50:22 +00:00
|
|
|
/**
|
|
|
|
* Tests rule status return values
|
2005-03-23 02:13:53 +00:00
|
|
|
**/
|
2002-06-27 01:50:22 +00:00
|
|
|
void TestStatusReturn();
|
|
|
|
|
2002-07-31 19:05:33 +00:00
|
|
|
/**
|
|
|
|
* Run the Unicode Line Break test data.
|
2005-03-23 02:13:53 +00:00
|
|
|
**/
|
2002-07-31 19:05:33 +00:00
|
|
|
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 TestEmptyString();
|
|
|
|
void TestGetAvailableLocales();
|
|
|
|
void TestGetDisplayName();
|
|
|
|
void TestEndBehaviour();
|
|
|
|
void TestBug4153072();
|
|
|
|
void TestJapaneseLineBreak();
|
|
|
|
void TestThaiLineBreak();
|
2005-03-23 02:13:53 +00:00
|
|
|
void TestMixedThaiLineBreak();
|
|
|
|
void TestMaiyamok();
|
2003-05-27 16:29:25 +00:00
|
|
|
void TestMonkey(char *params);
|
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 *);
|
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
void TestWordBreaks();
|
|
|
|
void TestWordBoundary();
|
|
|
|
void TestLineBreaks();
|
|
|
|
void TestSentBreaks();
|
2004-06-09 18:12:01 +00:00
|
|
|
void TestBug3818();
|
2004-10-21 01:03:01 +00:00
|
|
|
void TestJapaneseWordBreak();
|
2006-03-29 23:33:02 +00:00
|
|
|
void TestTrieDict();
|
2005-03-23 02:13:53 +00:00
|
|
|
void TestDebug();
|
|
|
|
|
|
|
|
|
2000-01-17 20:59:08 +00:00
|
|
|
/***********************/
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* internal methods to prepare test data
|
|
|
|
**/
|
2005-03-23 02:13:53 +00:00
|
|
|
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
2005-03-23 02:13:53 +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).
|
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
|
|
|
/**
|
2005-03-23 02:13:53 +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)
|
|
|
|
**/
|
2002-07-22 22:02:08 +00:00
|
|
|
void doMultipleSelectionTest(RuleBasedBreakIterator& iterator, BITestData &td);
|
2000-08-14 21:42:36 +00:00
|
|
|
|
2005-07-08 01:57:58 +00:00
|
|
|
void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name, uint32_t seed,
|
|
|
|
int32_t loopCount, UBool useUText);
|
2003-05-27 16:29:25 +00:00
|
|
|
|
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
|