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