home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / g7coll.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  3.2 KB  |  96 lines

  1. /*
  2. *****************************************************************************************
  3. *                                                                                       *
  4. * COPYRIGHT:                                                                            *
  5. *   (C) Copyright Taligent, Inc.,  1997                                                 *
  6. *   (C) Copyright International Business Machines Corporation,  1997-1998               *
  7. *   Licensed Material - Program-Property of IBM - All Rights Reserved.                  *
  8. *   US Government Users Restricted Rights - Use, duplication, or disclosure             *
  9. *   restricted by GSA ADP Schedule Contract with IBM Corp.                              *
  10. *                                                                                       *
  11. *****************************************************************************************
  12. */
  13.  
  14. /**
  15.  * G7CollationTest is a third level test class.  This test performs the examples 
  16.  * mentioned on the Taligent international demos web site.  
  17.  * Sample Rules: & Z < p , P 
  18.  * Effect :  Making P sort after Z.
  19.  *
  20.  * Sample Rules: & c < ch , cH, Ch, CH 
  21.  * Effect : As well as adding sequences of characters that act as a single character (this is
  22.  * known as contraction), you can also add characters that act like a sequence of
  23.  * characters (this is known as expansion).  
  24.  * 
  25.  * Sample Rules: & Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&' 
  26.  * Effect : Expansion and contraction can actually be combined.  
  27.  * 
  28.  * Sample Rules: & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-'
  29.  * Effect : sorted sequence as the following,
  30.  * aardvark  
  31.  * a-rdvark  
  32.  * abbot  
  33.  * coop  
  34.  * co-p  
  35.  * cop 
  36.  */
  37.  
  38. #ifndef _G7COLL
  39. #define _G7COLL
  40.  
  41. #ifndef _UTYPES
  42. #include "utypes.h"
  43. #endif
  44.  
  45. #ifndef _COLL
  46. #include "coll.h"
  47. #endif
  48.  
  49. #ifndef _TBLCOLL
  50. #include "tblcoll.h"
  51. #endif
  52.  
  53. #ifndef _INTLTEST
  54. #include "intltest.h"
  55. #endif
  56.  
  57. class G7CollationTest: public IntlTest {
  58. public:
  59.     // static constants
  60.     enum EToken_Len { MAX_TOKEN_LEN = 128 };
  61.     enum ETotal_Locales { TESTLOCALES = 12 };
  62.     enum ETotal_Fixed { FIXEDTESTSET = 15 };
  63.     enum ETotal_Test { TOTALTESTSET = 30 };
  64.  
  65.     G7CollationTest() {}
  66.     ~G7CollationTest() {}
  67.     void runIndexedTest( int32_t index, bool_t exec, char* &name, char* par = NULL );
  68.  
  69.     // main test routine, tests comparisons for a set of strings against sets of expected results
  70.     void doTest( Collator* col, UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
  71.  
  72.     // perform test for G7 locales
  73.     void TestG7Locales( char* par );
  74.  
  75.     // perform test with added rules " & Z < p, P"
  76.     void TestDemo1( char* par );
  77.  
  78.     // perorm test with added rules "& C < ch , cH, Ch, CH"
  79.     void TestDemo2( char* par );
  80.  
  81.     // perform test with added rules 
  82.     // "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'"
  83.     void TestDemo3( char* par );
  84.  
  85.     // perform test with added rules 
  86.     // " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' "
  87.     void TestDemo4( char* par );
  88.  
  89. private:
  90.     static const UChar testCases[][MAX_TOKEN_LEN];
  91.     static const int32_t results[TESTLOCALES][TOTALTESTSET];
  92.  
  93.     static const Locale locales[];
  94. };
  95. #endif
  96.