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