Home | History | Annotate | Download | only in intltest
      1 /********************************************************************
      2  * COPYRIGHT:
      3  * Copyright (c) 1999-2004,2008 International Business Machines Corporation and
      4  * others. All Rights Reserved.
      5  ********************************************************************/
      6 /************************************************************************
      7 *   Date        Name        Description
      8 *   12/14/99    Madhu        Creation.
      9 ************************************************************************/
     10 
     11 
     12 
     13 #ifndef RBBIAPITEST_H
     14 #define RBBIAPITEST_H
     15 
     16 #include "unicode/utypes.h"
     17 
     18 #if !UCONFIG_NO_BREAK_ITERATION
     19 
     20 #include "intltest.h"
     21 #include "unicode/rbbi.h"
     22 
     23 /**
     24  * API Test the RuleBasedBreakIterator class
     25  */
     26 class RBBIAPITest: public IntlTest {
     27 public:
     28 
     29 
     30     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
     31     /**
     32      * Tests Constructor behaviour of RuleBasedBreakIterator
     33      **/
     34    // void TestConstruction(void);
     35     /**
     36      * Tests clone() and equals() methods of RuleBasedBreakIterator
     37      **/
     38     void TestCloneEquals();
     39     /**
     40      * Tests toString() method of RuleBasedBreakIterator
     41      **/
     42     void TestgetRules();
     43     /**
     44      * Tests the method hashCode() of RuleBasedBreakIterator
     45      **/
     46     void TestHashCode();
     47      /**
     48       * Tests the methods getText() and setText() of RuleBasedBreakIterator
     49       **/
     50     void TestGetSetAdoptText();
     51      /**
     52       * Testing the iteration methods of RuleBasedBreakIterator
     53       **/
     54     void TestIteration(void);
     55 
     56 
     57     /**
     58      * Tests creating RuleBasedBreakIterator from rules strings.
     59      **/
     60     void TestBuilder(void);
     61 
     62     void TestRoundtripRules(void);
     63 
     64     void RoundtripRule(const char *dataFile);
     65 
     66     /**
     67      * Test creating RuleBasedBreakIterator from RBBIData.
     68      **/
     69 
     70     void TestCreateFromRBBIData(void);
     71 
     72     /**
     73      * Tests grouping effect of 'single quotes' in rules.
     74      **/
     75     void TestQuoteGrouping();
     76 
     77     /**
     78      *  Tests word break status returns.
     79      */
     80     void TestRuleStatus();
     81     void TestRuleStatusVec();
     82 
     83     void TestBug2190();
     84 
     85     void TestBoilerPlate();
     86 
     87     void TestRegistration();
     88 
     89     /**
     90      *Internal subroutines
     91      **/
     92     /* Internal subroutine used by TestIsBoundary() */
     93     void doBoundaryTest(RuleBasedBreakIterator& bi, UnicodeString& text, int32_t *boundaries);
     94 
     95     /*Internal subroutine used for comparision of expected and acquired results */
     96     void doTest(UnicodeString& testString, int32_t start, int32_t gotoffset, int32_t expectedOffset, const char* expected);
     97 
     98 
     99 };
    100 
    101 /**
    102  * Special class to enable testing of protected functions in RuleBasedBreakIterator
    103  */
    104 class RBBIWithProtectedFunctions: public RuleBasedBreakIterator {
    105 public:
    106     enum EDontAdopt {
    107         kDontAdopt
    108     };
    109     RBBIWithProtectedFunctions(RBBIDataHeader* data, UErrorCode &status);
    110     RBBIWithProtectedFunctions(const RBBIDataHeader* data, enum EDontAdopt dontAdopt, UErrorCode &status);
    111 };
    112 
    113 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */
    114 
    115 #endif
    116