2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 1997-2003, International Business Machines Corporation and
|
|
|
|
* others. All Rights Reserved.
|
2000-01-15 02:00:06 +00:00
|
|
|
********************************************************************/
|
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
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_COLLATION
|
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
#include "tscoll.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
class CollationMonkeyTest: public IntlTestCollator {
|
1999-08-16 21:50:52 +00:00
|
|
|
public:
|
2001-03-30 01:22:03 +00:00
|
|
|
// If this is too small for the test data, just increase it.
|
|
|
|
// Just don't make it too large, otherwise the executable will get too big
|
|
|
|
enum EToken_Len { MAX_TOKEN_LEN = 16 };
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
CollationMonkeyTest();
|
2000-12-09 03:17:45 +00:00
|
|
|
virtual ~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);
|
|
|
|
|
2001-07-11 21:03:51 +00:00
|
|
|
const UnicodeString source;
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
Collator *myCollator;
|
|
|
|
};
|
2002-09-21 00:43:14 +00:00
|
|
|
|
|
|
|
#endif /* #if !UCONFIG_NO_COLLATION */
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|