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