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