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