1 /****************************************************************************
2  * COPYRIGHT:
3  * Copyright (c) 2001-2008, International Business Machines Corporation and others
4  * All Rights Reserved.
5  ***************************************************************************/
6 
7 #ifndef _STRSRCH_H
8 #define _STRSRCH_H
9 
10 #include "unicode/utypes.h"
11 
12 #if !UCONFIG_NO_COLLATION
13 
14 #include "unicode/tblcoll.h"
15 #include "unicode/brkiter.h"
16 #include "intltest.h"
17 #include "unicode/usearch.h"
18 
19 struct SearchData;
20 typedef struct SearchData SearchData;
21 
22 class StringSearchTest: public IntlTest
23 {
24 public:
25     StringSearchTest();
26     virtual ~StringSearchTest();
27 
28     void runIndexedTest(int32_t index, UBool exec, const char* &name,
29                         char* par = NULL);
30 #if !UCONFIG_NO_BREAK_ITERATION
31 private:
32     RuleBasedCollator *m_en_us_;
33     RuleBasedCollator *m_fr_fr_;
34     RuleBasedCollator *m_de_;
35     RuleBasedCollator *m_es_;
36     BreakIterator     *m_en_wordbreaker_;
37     BreakIterator     *m_en_characterbreaker_;
38 
39     RuleBasedCollator * getCollator(const char *collator);
40     BreakIterator     * getBreakIterator(const char *breaker);
41     char              * toCharString(const UnicodeString &text);
42     Collator::ECollationStrength getECollationStrength(
43                                    const UCollationStrength &strength) const;
44     UBool           assertEqualWithStringSearch(      StringSearch *strsrch,
45                                                 const SearchData   *search);
46     UBool           assertEqual(const SearchData *search);
47     UBool           assertCanonicalEqual(const SearchData *search);
48     UBool           assertEqualWithAttribute(const SearchData *search,
49                                             USearchAttributeValue canonical,
50                                             USearchAttributeValue overlap);
51     void TestOpenClose();
52     void TestInitialization();
53     void TestBasic();
54     void TestNormExact();
55     void TestStrength();
56 #if !UCONFIG_NO_BREAK_ITERATION
57     void TestBreakIterator();
58 #endif
59     void TestVariable();
60     void TestOverlap();
61     void TestCollator();
62     void TestPattern();
63     void TestText();
64     void TestCompositeBoundaries();
65     void TestGetSetOffset();
66     void TestGetSetAttribute();
67     void TestGetMatch();
68     void TestSetMatch();
69     void TestReset();
70     void TestSupplementary();
71     void TestContraction();
72     void TestIgnorable();
73     void TestCanonical();
74     void TestNormCanonical();
75     void TestStrengthCanonical();
76 #if !UCONFIG_NO_BREAK_ITERATION
77     void TestBreakIteratorCanonical();
78 #endif
79     void TestVariableCanonical();
80     void TestOverlapCanonical();
81     void TestCollatorCanonical();
82     void TestPatternCanonical();
83     void TestTextCanonical();
84     void TestCompositeBoundariesCanonical();
85     void TestGetSetOffsetCanonical();
86     void TestSupplementaryCanonical();
87     void TestContractionCanonical();
88     void TestUClassID();
89     void TestSubclass();
90     void TestCoverage();
91     void TestDiacriticMatch();
92 #endif
93 };
94 
95 #endif /* #if !UCONFIG_NO_COLLATION */
96 
97 #endif
98