tscoll.h revision 51cfa1a9a96cad34675a6415fe86dfdf3f525bb6
1/********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1997-2003, 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
23class IntlTestCollator: public IntlTest {
24    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL );
25protected:
26    // These two should probably go down in IntlTest
27    void doTest(Collator* col, const UChar *source, const UChar *target, Collator::EComparisonResult result);
28
29    void doTest(Collator* col, const UnicodeString &source, const UnicodeString &target, Collator::EComparisonResult result);
30    void doTestVariant(Collator* col, const UnicodeString &source, const UnicodeString &target, Collator::EComparisonResult result);
31    virtual void reportCResult( const UnicodeString &source, const UnicodeString &target,
32                                CollationKey &sourceKey, CollationKey &targetKey,
33                                Collator::EComparisonResult compareResult,
34                                Collator::EComparisonResult keyResult,
35                                Collator::EComparisonResult incResult,
36                                Collator::EComparisonResult expectedResult );
37
38    static UnicodeString &prettify(const CollationKey &source, UnicodeString &target);
39    static UnicodeString &appendCompareResult(Collator::EComparisonResult result, UnicodeString &target);
40    void backAndForth(CollationElementIterator &iter);
41    /**
42     * Return an integer array containing all of the collation orders
43     * returned by calls to next on the specified iterator
44     */
45    int32_t *getOrders(CollationElementIterator &iter, int32_t &orderLength);
46    UCollationResult compareUsingPartials(UCollator *coll, const UChar source[], int32_t sLen, const UChar target[], int32_t tLen, int32_t pieceSize, UErrorCode &status);
47
48};
49
50#endif /* #if !UCONFIG_NO_COLLATION */
51
52#endif
53