1
/********************************************************************
3
* Copyright (c) 1997-2001, International Business Machines Corporation and
4
* others. All Rights Reserved.
5
********************************************************************/
8
* G7CollationTest is a third level test class. This test performs the examples
9
* mentioned on the Taligent international demos web site.
10
* Sample Rules: & Z < p , P
11
* Effect : Making P sort after Z.
13
* Sample Rules: & c < ch , cH, Ch, CH
14
* Effect : As well as adding sequences of characters that act as a single character (this is
15
* known as contraction), you can also add characters that act like a sequence of
16
* characters (this is known as expansion).
18
* Sample Rules: & Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'
19
* Effect : Expansion and contraction can actually be combined.
21
* Sample Rules: & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-'
22
* Effect : sorted sequence as the following,
34
#include "unicode/tblcoll.h"
37
class G7CollationTest: public IntlTestCollator {
39
// If this is too small for the test data, just increase it.
40
// Just don't make it too large, otherwise the executable will get too big
41
enum EToken_Len { MAX_TOKEN_LEN = 16 };
43
enum ETotal_Locales { TESTLOCALES = 12 };
44
enum ETotal_Fixed { FIXEDTESTSET = 15 };
45
enum ETotal_Test { TOTALTESTSET = 30 };
48
virtual ~G7CollationTest() {}
49
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
51
// main test routine, tests comparisons for a set of strings against sets of expected results
52
void doTest( Collator* col, UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
54
// perform test for G7 locales
55
void TestG7Locales(/* char* par */);
57
// perform test with added rules " & Z < p, P"
58
void TestDemo1(/* char* par */);
60
// perorm test with added rules "& C < ch , cH, Ch, CH"
61
void TestDemo2(/* char* par */);
63
// perform test with added rules
64
// "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'"
65
void TestDemo3(/* char* par */);
67
// perform test with added rules
68
// " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' "
69
void TestDemo4(/* char* par */);
72
static const UChar testCases[][MAX_TOKEN_LEN];
73
static const int32_t results[TESTLOCALES][TOTALTESTSET];