1/********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1999-2011 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 */
26class RBBIAPITest: public IntlTest {
27public:
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    void TestRefreshInputText();
90
91    /**
92     *Internal subroutines
93     **/
94    /* Internal subroutine used by TestIsBoundary() */
95    void doBoundaryTest(RuleBasedBreakIterator& bi, UnicodeString& text, int32_t *boundaries);
96
97    /*Internal subroutine used for comparision of expected and acquired results */
98    void doTest(UnicodeString& testString, int32_t start, int32_t gotoffset, int32_t expectedOffset, const char* expected);
99
100
101};
102
103/**
104 * Special class to enable testing of protected functions in RuleBasedBreakIterator
105 */
106class RBBIWithProtectedFunctions: public RuleBasedBreakIterator {
107public:
108    enum EDontAdopt {
109        kDontAdopt
110    };
111    RBBIWithProtectedFunctions(RBBIDataHeader* data, UErrorCode &status);
112    RBBIWithProtectedFunctions(const RBBIDataHeader* data, enum EDontAdopt dontAdopt, UErrorCode &status);
113};
114
115#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
116
117#endif
118