• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /********************************************************************
2  * COPYRIGHT:
3  * Copyright (c) 1997-2003, International Business Machines Corporation and
4  * others. All Rights Reserved.
5  ********************************************************************/
6 
7 /**
8  * CollationMonkeyTest is a third level test class.  This tests the random
9  * substrings of the default test strings to verify if the compare and
10  * sort key algorithm works correctly.  For example, any string is always
11  * less than the string itself appended with any character.
12  */
13 
14 #ifndef _MNKYTST
15 #define _MNKYTST
16 
17 #include "unicode/utypes.h"
18 
19 #if !UCONFIG_NO_COLLATION
20 
21 #include "tscoll.h"
22 
23 class CollationMonkeyTest: public IntlTestCollator {
24 public:
25     // If this is too small for the test data, just increase it.
26     // Just don't make it too large, otherwise the executable will get too big
27     enum EToken_Len { MAX_TOKEN_LEN = 16 };
28 
29     CollationMonkeyTest();
30     virtual ~CollationMonkeyTest();
31     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
32 
33     // utility function used in tests, returns absolute value
34     int32_t checkValue(int32_t value);
35 
36     // perform monkey tests using Collator::compare
37     void TestCompare(/* char* par */);
38 
39     // perform monkey tests using CollationKey::compareTo
40     void TestCollationKey(/* char* par */);
41 
42     void TestRules(/* char* par */);
43 
44 private:
45     void report(UnicodeString& s, UnicodeString& t, int32_t result, int32_t revResult);
46 
47     const UnicodeString source;
48 
49     Collator *myCollator;
50 };
51 
52 #endif /* #if !UCONFIG_NO_COLLATION */
53 
54 #endif
55