2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
|
|
|
* Copyright (c) 1997-1999, International Business Machines Corporation and
|
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CollationMonkeyTest is a third level test class. This tests the random
|
|
|
|
* substrings of the default test strings to verify if the compare and
|
|
|
|
* sort key algorithm works correctly. For example, any string is always
|
|
|
|
* less than the string itself appended with any character.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MNKYTST
|
|
|
|
#define _MNKYTST
|
|
|
|
|
|
|
|
#ifndef _UTYPES
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/utypes.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COLL
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/coll.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _INTLTEST
|
|
|
|
#include "intltest.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class CollationMonkeyTest: public IntlTest {
|
|
|
|
public:
|
|
|
|
// static constants
|
|
|
|
enum EToken_Len { MAX_TOKEN_LEN = 128 };
|
|
|
|
|
|
|
|
CollationMonkeyTest();
|
|
|
|
~CollationMonkeyTest();
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// utility function used in tests, returns absolute value
|
|
|
|
int32_t checkValue(int32_t value);
|
|
|
|
|
|
|
|
// perform monkey tests using Collator::compare
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestCompare(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// perform monkey tests using CollationKey::compareTo
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestCollationKey(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestRules(/* char* par */);
|
2000-08-04 19:57:18 +00:00
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
private:
|
|
|
|
void report(UnicodeString& s, UnicodeString& t, int32_t result, int32_t revResult);
|
|
|
|
|
2000-08-04 19:57:18 +00:00
|
|
|
void doTest(RuleBasedCollator *myCollation, UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
static const UnicodeString source;
|
|
|
|
|
|
|
|
Collator *myCollator;
|
|
|
|
};
|
|
|
|
#endif
|