1/********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1999-2014 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    void TestFilteredBreakIteratorBuilder(void);
57
58    /**
59     * Tests creating RuleBasedBreakIterator from rules strings.
60     **/
61    void TestBuilder(void);
62
63    void TestRoundtripRules(void);
64
65    void RoundtripRule(const char *dataFile);
66
67    /**
68     * Test creating RuleBasedBreakIterator from RBBIData.
69     **/
70
71    void TestCreateFromRBBIData(void);
72
73    /**
74     * Tests grouping effect of 'single quotes' in rules.
75     **/
76    void TestQuoteGrouping();
77
78    /**
79     *  Tests word break status returns.
80     */
81    void TestRuleStatus();
82    void TestRuleStatusVec();
83
84    void TestBug2190();
85
86    void TestBoilerPlate();
87
88    void TestRegistration();
89
90    void TestRefreshInputText();
91
92    /**
93     *Internal subroutines
94     **/
95    /* Internal subroutine used by TestIsBoundary() */
96    void doBoundaryTest(BreakIterator& bi, UnicodeString& text, int32_t *boundaries);
97
98    /*Internal subroutine used for comparision of expected and acquired results */
99    void doTest(UnicodeString& testString, int32_t start, int32_t gotoffset, int32_t expectedOffset, const char* expected);
100
101
102};
103
104/**
105 * Special class to enable testing of protected functions in RuleBasedBreakIterator
106 */
107class RBBIWithProtectedFunctions: public RuleBasedBreakIterator {
108public:
109    enum EDontAdopt {
110        kDontAdopt
111    };
112    RBBIWithProtectedFunctions(RBBIDataHeader* data, UErrorCode &status);
113    RBBIWithProtectedFunctions(const RBBIDataHeader* data, enum EDontAdopt dontAdopt, UErrorCode &status);
114};
115
116#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
117
118#endif
119