2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2001-03-21 20:09:56 +00:00
|
|
|
* Copyright (c) 1997-2001, International Business Machines Corporation and
|
2000-01-15 02:00:06 +00:00
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* G7CollationTest is a third level test class. This test performs the examples
|
|
|
|
* mentioned on the Taligent international demos web site.
|
|
|
|
* Sample Rules: & Z < p , P
|
|
|
|
* Effect : Making P sort after Z.
|
|
|
|
*
|
|
|
|
* Sample Rules: & c < ch , cH, Ch, CH
|
|
|
|
* Effect : As well as adding sequences of characters that act as a single character (this is
|
|
|
|
* known as contraction), you can also add characters that act like a sequence of
|
|
|
|
* characters (this is known as expansion).
|
|
|
|
*
|
|
|
|
* Sample Rules: & Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'
|
|
|
|
* Effect : Expansion and contraction can actually be combined.
|
|
|
|
*
|
|
|
|
* Sample Rules: & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-'
|
|
|
|
* Effect : sorted sequence as the following,
|
|
|
|
* aardvark
|
|
|
|
* a-rdvark
|
|
|
|
* abbot
|
|
|
|
* coop
|
|
|
|
* co-p
|
|
|
|
* cop
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _G7COLL
|
|
|
|
#define _G7COLL
|
|
|
|
|
|
|
|
#ifndef _UTYPES
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/utypes.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COLL
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/coll.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TBLCOLL
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/tblcoll.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _INTLTEST
|
|
|
|
#include "intltest.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class G7CollationTest: public IntlTest {
|
|
|
|
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
|
|
|
enum ETotal_Locales { TESTLOCALES = 12 };
|
|
|
|
enum ETotal_Fixed { FIXEDTESTSET = 15 };
|
|
|
|
enum ETotal_Test { TOTALTESTSET = 30 };
|
|
|
|
|
|
|
|
G7CollationTest() {}
|
2000-04-18 17:58:18 +00:00
|
|
|
virtual ~G7CollationTest() {}
|
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
|
|
|
|
|
|
|
// main test routine, tests comparisons for a set of strings against sets of expected results
|
|
|
|
void doTest( Collator* col, UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
|
|
|
|
|
|
|
|
// perform test for G7 locales
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestG7Locales(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// perform test with added rules " & Z < p, P"
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestDemo1(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// perorm test with added rules "& C < ch , cH, Ch, CH"
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestDemo2(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// perform test with added rules
|
|
|
|
// "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'"
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestDemo3(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// perform test with added rules
|
|
|
|
// " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' "
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestDemo4(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const UChar testCases[][MAX_TOKEN_LEN];
|
|
|
|
static const int32_t results[TESTLOCALES][TOTALTESTSET];
|
|
|
|
|
|
|
|
static const Locale locales[];
|
|
|
|
};
|
|
|
|
#endif
|