1 /******************************************************************** 2 * COPYRIGHT: 3 * Copyright (c) 2002-2005, International Business Machines Corporation and 4 * others. All Rights Reserved. 5 ********************************************************************/ 6 7 /** 8 * DataDrivenCollatorTest is a test class that uses data stored in resource 9 * bundles to perform testing. For more details on data structure, see 10 * source/test/testdata/DataDrivenCollationTest.txt 11 */ 12 13 #ifndef _INTLTESTDATADRIVENCOLLATOR 14 #define _INTLTESTDATADRIVENCOLLATOR 15 16 #include "unicode/utypes.h" 17 18 #if !UCONFIG_NO_COLLATION 19 20 #include "tscoll.h" 21 #include "uvector.h" 22 #include "unicode/coll.h" 23 #include "unicode/tblcoll.h" 24 #include "unicode/sortkey.h" 25 #include "unicode/schriter.h" 26 27 class TestDataModule; 28 class TestData; 29 30 class SeqElement { 31 public: 32 UnicodeString source; 33 Collator::EComparisonResult relation; 34 }; 35 36 class DataDrivenCollatorTest: public IntlTestCollator { 37 void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ); 38 public: 39 DataDrivenCollatorTest(); 40 virtual ~DataDrivenCollatorTest(); 41 protected: 42 43 void DataDrivenTest(char *par); 44 void processSequence(Collator* col, const UnicodeString &sequence); 45 void processTest(TestData *testData); 46 void processArguments(Collator *col, const UChar *start, int32_t optLen); 47 UBool setTestSequence(const UnicodeString &setSequence, SeqElement &el); 48 UBool getNextInSequence(SeqElement &el); 49 private: 50 StringCharacterIterator seq; 51 TestDataModule *driver; 52 UErrorCode status; 53 UVector sequences; 54 RuleBasedCollator *UCA; // needed for opening collators from binary images 55 }; 56 57 #endif /* #if !UCONFIG_NO_COLLATION */ 58 59 #endif 60