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
|
|
|
|
|
|
|
|
|
|
|
|
#include "intltest.h"
|
|
|
|
#include "unicode/brkiter.h"
|
|
|
|
|
|
|
|
class Vector;
|
|
|
|
class Enumeration;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the RuleBasedBreakIterator class giving different rules
|
|
|
|
*/
|
|
|
|
class RBBITest: public IntlTest {
|
|
|
|
public:
|
|
|
|
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
|
|
|
/**
|
2000-01-17 20:59:08 +00:00
|
|
|
* Tests default rules based character iteration
|
|
|
|
**/
|
2000-08-14 21:42:36 +00:00
|
|
|
void TestDefaultRuleBasedCharacterIteration(void);
|
|
|
|
/**
|
2000-01-17 20:59:08 +00:00
|
|
|
* Tests default rules based word iteration
|
|
|
|
**/
|
|
|
|
void TestDefaultRuleBasedWordIteration(void);
|
|
|
|
/**
|
|
|
|
* Tests default rules based word iteration
|
|
|
|
**/
|
|
|
|
void TestDefaultRuleBasedSentenceIteration(void);
|
|
|
|
/**
|
|
|
|
* Tests default rules based word iteration
|
|
|
|
**/
|
|
|
|
void TestDefaultRuleBasedLineIteration(void);
|
|
|
|
/**
|
|
|
|
* Tests Hindi(Devanagiri) character iteration
|
|
|
|
**/
|
2000-08-14 21:42:36 +00:00
|
|
|
void TestHindiCharacterBreak(void);
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
|
|
|
* Tests Hindi(Devanagiri) word iteration
|
|
|
|
**/
|
2000-08-14 21:42:36 +00:00
|
|
|
void TestHindiWordBreak(void);
|
|
|
|
/**
|
2000-01-17 20:59:08 +00:00
|
|
|
* Test Hindi Danda i.e make sure we have a break point before and after danda
|
|
|
|
**/
|
2000-08-14 21:42:36 +00:00
|
|
|
// void TestDanda(void);
|
|
|
|
/**
|
|
|
|
* Test Hindi Charactet Wrapping behaviour
|
|
|
|
**/
|
|
|
|
// void TestHindiCharacterWrapping(void);
|
2000-01-17 20:59:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds rules for telugu support and tests the behaviour of chracterIterator of RBBI
|
|
|
|
**/
|
2000-08-14 21:42:36 +00:00
|
|
|
// void TestTeluguRuleBasedCharacterIteration(void)
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
|
|
|
* Tests the behaviour of character iteration of RBBI with custom rules
|
|
|
|
**/
|
2000-08-14 21:42:36 +00:00
|
|
|
// void TestCustomRuleBasedCharacterIteration(void);
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
|
|
|
* Tests custom rules based word iteration
|
|
|
|
**/
|
2000-08-14 21:42:36 +00:00
|
|
|
// void TestCustomRuleBasedWordIteration(void);
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
|
|
|
* Adds extra rules to deal with abbrevations(limited) and test the word Iteration
|
|
|
|
**/
|
|
|
|
// void TestAbbrRuleBasedWordIteration(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************/
|
|
|
|
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
|
|
|
**/
|
|
|
|
void generalIteratorTest(RuleBasedBreakIterator& bi, Vector* expectedResult);
|
|
|
|
/**
|
2000-08-14 21:42:36 +00:00
|
|
|
* Internal method to perform iteration and test the first() and next() functions
|
|
|
|
**/
|
|
|
|
Vector* testFirstAndNext(RuleBasedBreakIterator& bi, UnicodeString& text);
|
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
|
|
|
|
**/
|
2000-01-17 20:59:08 +00:00
|
|
|
Vector* testLastAndPrevious(RuleBasedBreakIterator& bi, UnicodeString& text);
|
2000-08-14 21:42:36 +00:00
|
|
|
/**
|
|
|
|
* Internal method to perform iteration and test the following() function
|
|
|
|
**/
|
|
|
|
void testFollowing(RuleBasedBreakIterator& bi, UnicodeString& text, int32_t *boundaries);
|
|
|
|
/**
|
|
|
|
* Internal method to perform iteration and test the preceding() function
|
|
|
|
**/
|
|
|
|
void testPreceding(RuleBasedBreakIterator& bi, UnicodeString& text, int32_t *boundaries);
|
|
|
|
/**
|
|
|
|
* Internal method to perform iteration and test the isBoundary() function
|
|
|
|
**/
|
|
|
|
void testIsBoundary(RuleBasedBreakIterator& bi, UnicodeString& text, int32_t *boundaries);
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
2000-08-14 21:42:36 +00:00
|
|
|
* Internal method which does the comparision of expected and got results.
|
|
|
|
**/
|
|
|
|
void compareFragmentLists(UnicodeString& f1Name, UnicodeString& f2Name, Vector* f1, Vector* f2);
|
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)
|
|
|
|
**/
|
|
|
|
void doMultipleSelectionTest(RuleBasedBreakIterator& iterator, UnicodeString& testText);
|
2000-08-14 21:42:36 +00:00
|
|
|
/**
|
|
|
|
* Internal method to create test data string from an enumerator
|
|
|
|
**/
|
|
|
|
UnicodeString createTestData(Enumeration* e);
|
|
|
|
|
2000-01-17 20:59:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|