home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / itercoll.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  3.1 KB  |  124 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.  * Collation Iterator tests.
  16.  * (Let me reiterate my position...)
  17.  */
  18.  
  19. #ifndef _ITERCOLL
  20. #define _ITERCOLL
  21.  
  22. #ifndef _UTYPES
  23. #include "utypes.h"
  24. #endif
  25.  
  26. #ifndef _COLL
  27. #include "coll.h"
  28. #endif
  29.  
  30. #ifndef _TBLCOLL
  31. #include "tblcoll.h"
  32. #endif
  33.  
  34. #ifndef _COLEITR
  35. #include "coleitr.h"
  36. #endif
  37.  
  38. #ifndef _INTLTEST
  39. #include "intltest.h"
  40. #endif
  41.  
  42. #ifndef _UNISTR
  43. #include "unistr.h"
  44. #endif
  45.  
  46. class CollationIteratorTest: public IntlTest
  47. {
  48. public:
  49.  
  50.     enum EToken_Len { MAX_TOKEN_LEN = 128 };
  51.  
  52.     CollationIteratorTest();
  53.     ~CollationIteratorTest();
  54.  
  55.     void runIndexedTest(int32_t index, bool_t exec, char* &name, char* par = NULL);
  56.  
  57.     /**
  58.      * Test for CollationElementIterator.previous()
  59.      *
  60.      * @bug 4108758 - Make sure it works with contracting characters
  61.      * 
  62.      */
  63.     void TestPrevious(char *par);
  64.     
  65.     /**
  66.      * Test for getOffset() and setOffset()
  67.      */
  68.     void TestOffset(char *par);
  69.  
  70.     /**
  71.      * Test for setText()
  72.      */
  73.     void TestSetText(char *par);
  74.     
  75.     /** @bug 4108762
  76.      * Test for getMaxExpansion()
  77.      */
  78.     void TestMaxExpansion(char *par);
  79.  
  80.     /*
  81.      * @bug 4157299
  82.      */
  83.     void TestClearBuffers(char *par);
  84.     
  85.     //------------------------------------------------------------------------
  86.     // Internal utilities
  87.     //
  88.  
  89. private:
  90.     void backAndForth(CollationElementIterator &iter);
  91.  
  92.     struct ExpansionRecord
  93.     {
  94.         UChar character;
  95.         int32_t count;
  96.     };
  97.  
  98.     /**
  99.      * Verify that getMaxExpansion works on a given set of collation rules
  100.      */
  101.     void verifyExpansion(UnicodeString rules, ExpansionRecord tests[], int32_t testCount);
  102.     
  103.     /**
  104.      * Return an integer array containing all of the collation orders
  105.      * returned by calls to next on the specified iterator
  106.      */
  107.     int32_t *getOrders(CollationElementIterator &iter, int32_t &orderLength);
  108.  
  109.     /**
  110.      * Return a string containing all of the collation orders
  111.      * returned by calls to next on the specified iterator
  112.      */
  113.     UnicodeString &orderString(CollationElementIterator &iter, UnicodeString &target);
  114.  
  115.     void assertEqual(CollationElementIterator &i1, CollationElementIterator &i2);
  116.  
  117.     RuleBasedCollator *en_us;
  118.     static const UnicodeString test1;
  119.     static const UnicodeString test2;
  120.  
  121. };
  122.  
  123. #endif
  124.