• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /********************************************************************
2  * COPYRIGHT:
3  * Copyright (c) 1997-2010, International Business Machines Corporation and
4  * others. All Rights Reserved.
5  ********************************************************************/
6 
7 #ifndef UNICODESTRINGTEST_H
8 #define UNICODESTRINGTEST_H
9 
10 #include "unicode/unistr.h"
11 #include "intltest.h"
12 
13 /**
14  * Perform API and functionality tests for class UnicodeString
15  **/
16 class UnicodeStringTest: public IntlTest {
17 public:
UnicodeStringTest()18     UnicodeStringTest() {}
19     virtual ~UnicodeStringTest();
20 
21     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
22 
23     /**
24      * Test some basic methods (insert, remove, replace, ...)
25      **/
26     void TestBasicManipulation(void);
27     /**
28      * Test the methods for comparison
29      **/
30     void TestCompare(void);
31     /**
32      * Test the methods for extracting
33      **/
34     void TestExtract(void);
35     /**
36      * More extensively test methods for removing and replacing
37      **/
38     void TestRemoveReplace(void);
39     /**
40      * Test language specific case conversions
41      **/
42     void TestSearching(void);
43     /**
44      * Test methods for padding, trimmimg and truncating
45      **/
46     void TestSpacePadding(void);
47     /**
48      * Test methods startsWith and endsWith
49      **/
50     void TestPrefixAndSuffix(void);
51     /**
52      * Test method findAndReplace
53      **/
54     void TestFindAndReplace(void);
55     /**
56      * Test method reverse
57      **/
58     void TestReverse(void);
59     /**
60      * Test a few miscellaneous methods (isBogus, hashCode,...)
61      **/
62     void TestMiscellaneous(void);
63     /**
64      * Test the functionality of allocating UnicodeStrings on the stack
65      **/
66     void TestStackAllocation(void);
67     /**
68      * Test the unescape() function.
69      */
70     void TestUnescape(void);
71 
72     void _testUnicodeStringHasMoreChar32Than(const UnicodeString &s, int32_t start, int32_t length, int32_t number);
73     void TestCountChar32(void);
74     void TestBogus();
75     void TestStringEnumeration();
76     void TestNameSpace(void);
77     void TestUTF32(void);
78     void TestUTF8(void);
79     void TestReadOnlyAlias(void);
80 };
81 
82 class StringCaseTest: public IntlTest {
83 public:
StringCaseTest()84     StringCaseTest() {}
85     virtual ~StringCaseTest();
86 
87     void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=0);
88 
89     void TestCaseConversion();
90 
91     void TestCasingImpl(const UnicodeString &input,
92                         const UnicodeString &output,
93                         int32_t whichCase,
94                         void *iter, const char *localeID, uint32_t options);
95     void TestCasing();
96 };
97 
98 #endif
99