]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tscoll.h
ICU-511.25.tar.gz
[apple/icu.git] / icuSources / test / intltest / tscoll.h
1 /********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1997-2008, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7 /**
8 * MajorTestLevel is the top level test class for everything in the directory "IntlWork".
9 */
10
11 #ifndef _INTLTESTCOLLATOR
12 #define _INTLTESTCOLLATOR
13
14 #include "unicode/utypes.h"
15
16 #if !UCONFIG_NO_COLLATION
17
18 #include "intltest.h"
19 #include "unicode/coll.h"
20 #include "unicode/coleitr.h"
21
22
23 class IntlTestCollator: public IntlTest {
24 void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL );
25 protected:
26 struct Order
27 {
28 int32_t order;
29 int32_t offset;
30 };
31
32 // These two should probably go down in IntlTest
33 void doTest(Collator* col, const UChar *source, const UChar *target, Collator::EComparisonResult result);
34
35 void doTest(Collator* col, const UnicodeString &source, const UnicodeString &target, Collator::EComparisonResult result);
36 void doTestVariant(Collator* col, const UnicodeString &source, const UnicodeString &target, Collator::EComparisonResult result);
37 virtual void reportCResult( const UnicodeString &source, const UnicodeString &target,
38 CollationKey &sourceKey, CollationKey &targetKey,
39 Collator::EComparisonResult compareResult,
40 Collator::EComparisonResult keyResult,
41 Collator::EComparisonResult incResult,
42 Collator::EComparisonResult expectedResult );
43
44 static UnicodeString &prettify(const CollationKey &source, UnicodeString &target);
45 static UnicodeString &appendCompareResult(Collator::EComparisonResult result, UnicodeString &target);
46 void backAndForth(CollationElementIterator &iter);
47 /**
48 * Return an integer array containing all of the collation orders
49 * returned by calls to next on the specified iterator
50 */
51 Order *getOrders(CollationElementIterator &iter, int32_t &orderLength);
52 UCollationResult compareUsingPartials(UCollator *coll, const UChar source[], int32_t sLen, const UChar target[], int32_t tLen, int32_t pieceSize, UErrorCode &status);
53
54 };
55
56 #endif /* #if !UCONFIG_NO_COLLATION */
57
58 #endif