home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / allcoll.cpp next >
Encoding:
C/C++ Source or Header  |  1999-10-19  |  20.5 KB  |  463 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. #ifndef _COLL
  15. #include "coll.h"
  16. #endif
  17.  
  18. #ifndef _TBLCOLL
  19. #include "tblcoll.h"
  20. #endif
  21.  
  22. #ifndef _UNISTR
  23. #include "unistr.h"
  24. #endif
  25.  
  26. #ifndef _SORTKEY
  27. #include "sortkey.h"
  28. #endif
  29.  
  30. #ifndef _ALLCOLL
  31. #include "allcoll.h"
  32. #endif
  33.  
  34. static const UChar DEFAULTRULEARRAY[] =
  35. {
  36.           '=', '\'', (UChar)0x200B, '\'', '=', (UChar)0x200C, '=', (UChar)0x200D, '=', (UChar)0x200E, '=', (UChar)0x200F
  37.         , '=', (UChar)0x0001, '=', (UChar)0x0002, '=', (UChar)0x0003, '=', (UChar)0x0004
  38.         , '=', (UChar)0x0005, '=', (UChar)0x0006, '=', (UChar)0x0007, '=', (UChar)0x0008, '=', '\'', (UChar)0x0009, '\''
  39.         , '=', '\'', (UChar)0x000b, '\'',  '=', (UChar)0x000e       //vt,, so
  40.         , '=', (UChar)0x000f, '=', '\'', (UChar)0x0010, '\'',  '=', (UChar)0x0011, '=', (UChar)0x0012, '=', (UChar)0x0013 //si, dle, dc1, dc2, dc3
  41.         , '=', (UChar)0x0014, '=', (UChar)0x0015, '=', (UChar)0x0016, '=', (UChar)0x0017, '=', (UChar)0x0018 //dc4, nak, syn, etb, can
  42.         , '=', (UChar)0x0019, '=', (UChar)0x001a, '=', (UChar)0x001b, '=', (UChar)0x001c, '=', (UChar)0x001d //em, sub, esc, fs, gs
  43.         , '=', (UChar)0x001e, '=', (UChar)0x001f, '=', (UChar)0x007f                   //rs, us, del
  44.         //....then the C1 Latin 1 reserved control codes
  45.         , '=', (UChar)0x0080, '=', (UChar)0x0081, '=', (UChar)0x0082, '=', (UChar)0x0083, '=', (UChar)0x0084, '=', (UChar)0x0085
  46.         , '=', (UChar)0x0086, '=', (UChar)0x0087, '=', (UChar)0x0088, '=', (UChar)0x0089, '=', (UChar)0x008a, '=', (UChar)0x008b
  47.         , '=', (UChar)0x008c, '=', (UChar)0x008d, '=', (UChar)0x008e, '=', (UChar)0x008f, '=', (UChar)0x0090, '=', (UChar)0x0091
  48.         , '=', (UChar)0x0092, '=', (UChar)0x0093, '=', (UChar)0x0094, '=', (UChar)0x0095, '=', (UChar)0x0096, '=', (UChar)0x0097
  49.         , '=', (UChar)0x0098, '=', (UChar)0x0099, '=', (UChar)0x009a, '=', (UChar)0x009b, '=', (UChar)0x009c, '=', (UChar)0x009d
  50.         , '=', (UChar)0x009e, '=', (UChar)0x009f
  51.         // IGNORE except for secondary, tertiary difference
  52.         // Spaces
  53.         , ';', '\'', (UChar)0x0020, '\'', ';', '\'', (UChar)0x00A0, '\''                   // spaces
  54.         , ';', '\'', (UChar)0x2000, '\'', ';', '\'', (UChar)0x2001, '\'', ';', '\'', (UChar)0x2002, '\'', ';', '\'', (UChar)0x2003, '\'', ';', '\'', (UChar)0x2004, '\''   // spaces
  55.         , ';', '\'', (UChar)0x2005, '\'', ';', '\'', (UChar)0x2006, '\'', ';', '\'', (UChar)0x2007, '\'', ';', '\'', (UChar)0x2008, '\'', ';', '\'', (UChar)0x2009, '\''   // spaces
  56.         , ';', '\'', (UChar)0x200A, '\'', ';', '\'', (UChar)0x3000, '\'', ';', '\'', (UChar)0xFEFF, '\''                 // spaces
  57.         , ';', '\'', '\r', '\'',  ';', '\'', '\t', '\'',  ';', '\'', '\n', '\'', ';', '\'', '\f', '\'', ';', '\'', (UChar)0x000b, '\''   // whitespace
  58.  
  59.         // Non-spacing accents
  60.  
  61.         , ';', (UChar)0x0301          // non-spacing acute accent
  62.         , ';', (UChar)0x0300          // non-spacing grave accent
  63.         , ';', (UChar)0x0306          // non-spacing breve accent
  64.         , ';', (UChar)0x0302          // non-spacing circumflex accent
  65.         , ';', (UChar)0x030c          // non-spacing caron/hacek accent
  66.         , ';', (UChar)0x030a          // non-spacing ring above accent
  67.         , ';', (UChar)0x030d          // non-spacing vertical line above
  68.         , ';', (UChar)0x0308          // non-spacing diaeresis accent
  69.         , ';', (UChar)0x030b          // non-spacing double acute accent
  70.         , ';', (UChar)0x0303          // non-spacing tilde accent
  71.         , ';', (UChar)0x0307          // non-spacing dot above/overdot accent
  72.         , ';', (UChar)0x0304          // non-spacing macron accent
  73.         , ';', (UChar)0x0337          // non-spacing short slash overlay (overstruck diacritic)
  74.         , ';', (UChar)0x0327          // non-spacing cedilla accent
  75.         , ';', (UChar)0x0328          // non-spacing ogonek accent
  76.         , ';', (UChar)0x0323          // non-spacing dot-below/underdot accent
  77.         , ';', (UChar)0x0332          // non-spacing underscore/underline accent
  78.         // with the rest of the general diacritical marks in binary order
  79.         , ';', (UChar)0x0305          // non-spacing overscore/overline
  80.         , ';', (UChar)0x0309          // non-spacing hook above
  81.         , ';', (UChar)0x030e          // non-spacing double vertical line above
  82.         , ';', (UChar)0x030f          // non-spacing double grave
  83.         , ';', (UChar)0x0310          // non-spacing chandrabindu
  84.         , ';', (UChar)0x0311          // non-spacing inverted breve
  85.         , ';', (UChar)0x0312          // non-spacing turned comma above/cedilla above
  86.         , ';', (UChar)0x0313          // non-spacing comma above
  87.         , ';', (UChar)0x0314          // non-spacing reversed comma above
  88.         , ';', (UChar)0x0315          // non-spacing comma above right
  89.         , ';', (UChar)0x0316          // non-spacing grave below
  90.         , ';', (UChar)0x0317          // non-spacing acute below
  91.         , ';', (UChar)0x0318          // non-spacing left tack below
  92.         , ';', (UChar)0x0319          // non-spacing tack below
  93.         , ';', (UChar)0x031a          // non-spacing left angle above
  94.         , ';', (UChar)0x031b          // non-spacing horn
  95.         , ';', (UChar)0x031c          // non-spacing left half ring below
  96.         , ';', (UChar)0x031d          // non-spacing up tack below
  97.         , ';', (UChar)0x031e          // non-spacing down tack below
  98.         , ';', (UChar)0x031f          // non-spacing plus sign below
  99.         , ';', (UChar)0x0320          // non-spacing minus sign below
  100.         , ';', (UChar)0x0321          // non-spacing palatalized hook below
  101.         , ';', (UChar)0x0322          // non-spacing retroflex hook below
  102.         , ';', (UChar)0x0324          // non-spacing double dot below
  103.         , ';', (UChar)0x0325          // non-spacing ring below
  104.         , ';', (UChar)0x0326          // non-spacing comma below
  105.         , ';', (UChar)0x0329          // non-spacing vertical line below
  106.         , ';', (UChar)0x032a          // non-spacing bridge below
  107.         , ';', (UChar)0x032b          // non-spacing inverted double arch below
  108.         , ';', (UChar)0x032c          // non-spacing hacek below
  109.         , ';', (UChar)0x032d          // non-spacing circumflex below
  110.         , ';', (UChar)0x032e          // non-spacing breve below
  111.         , ';', (UChar)0x032f          // non-spacing inverted breve below
  112.         , ';', (UChar)0x0330          // non-spacing tilde below
  113.         , ';', (UChar)0x0331          // non-spacing macron below
  114.         , ';', (UChar)0x0333          // non-spacing double underscore
  115.         , ';', (UChar)0x0334          // non-spacing tilde overlay
  116.         , ';', (UChar)0x0335          // non-spacing short bar overlay
  117.         , ';', (UChar)0x0336          // non-spacing long bar overlay
  118.         , ';', (UChar)0x0338          // non-spacing long slash overlay
  119.         , ';', (UChar)0x0339          // non-spacing right half ring below
  120.         , ';', (UChar)0x033a          // non-spacing inverted bridge below
  121.         , ';', (UChar)0x033b          // non-spacing square below
  122.         , ';', (UChar)0x033c          // non-spacing seagull below
  123.         , ';', (UChar)0x033d          // non-spacing x above
  124.         , ';', (UChar)0x033e          // non-spacing vertical tilde
  125.         , ';', (UChar)0x033f          // non-spacing double overscore
  126.         , ';', (UChar)0x0340          // non-spacing grave tone mark
  127.         , ';', (UChar)0x0341          // non-spacing acute tone mark
  128.         , ';', (UChar)0x0342, ';', (UChar)0x0343, ';', (UChar)0x0344, ';', (UChar)0x0345, ';', (UChar)0x0360, ';', (UChar)0x0361    // newer
  129.         , ';', (UChar)0x0483, ';', (UChar)0x0484, ';', (UChar)0x0485, ';', (UChar)0x0486    // Cyrillic accents
  130.  
  131.         , ';', (UChar)0x20D0, ';', (UChar)0x20D1, ';', (UChar)0x20D2           // symbol accents
  132.         , ';', (UChar)0x20D3, ';', (UChar)0x20D4, ';', (UChar)0x20D5           // symbol accents
  133.         , ';', (UChar)0x20D6, ';', (UChar)0x20D7, ';', (UChar)0x20D8           // symbol accents
  134.         , ';', (UChar)0x20D9, ';', (UChar)0x20DA, ';', (UChar)0x20DB           // symbol accents
  135.         , ';', (UChar)0x20DC, ';', (UChar)0x20DD, ';', (UChar)0x20DE           // symbol accents
  136.         , ';', (UChar)0x20DF, ';', (UChar)0x20E0, ';', (UChar)0x20E1           // symbol accents
  137.  
  138.         , ',', '\'', (UChar)0x002D, '\'', ';', (UChar)0x00AD                     // dashes
  139.         , ';', (UChar)0x2010, ';', (UChar)0x2011, ';', (UChar)0x2012           // dashes
  140.         , ';', (UChar)0x2013, ';', (UChar)0x2014, ';', (UChar)0x2015           // dashes
  141.         , ';', (UChar)0x2212                                                       // dashes
  142.  
  143.         // other punctuation
  144.  
  145.         , '<', '\'', (UChar)0x005f, '\'' // underline/underscore (spacing)
  146.         , '<', (UChar)0x00af          // overline or macron (spacing)
  147. //        , '<', (UChar)0x00ad          // syllable hyphen (SHY) or soft hyphen
  148.         , '<', '\'', (UChar)0x002c, '\''           // comma (spacing)
  149.         , '<', '\'', (UChar)0x003b, '\''           // semicolon
  150.         , '<', '\'', (UChar)0x003a, '\''           // colon
  151.         , '<', '\'', (UChar)0x0021, '\''           // exclamation point
  152.         , '<', (UChar)0x00a1                       // inverted exclamation point
  153.         , '<', '\'', (UChar)0x003f, '\''           // question mark
  154.         , '<', (UChar)0x00bf                       // inverted question mark
  155.         , '<', '\'', (UChar)0x002f, '\''           // slash
  156.         , '<', '\'', (UChar)0x002e, '\''           // period/full stop
  157.         , '<', (UChar)0x00b4                       // acute accent (spacing)
  158.         , '<', '\'', (UChar)0x0060, '\''           // grave accent (spacing)
  159.         , '<', '\'', (UChar)0x005e, '\''           // circumflex accent (spacing)
  160.         , '<', (UChar)0x00a8                       // diaresis/umlaut accent (spacing)
  161.         , '<', '\'', (UChar)0x007e, '\''           // tilde accent (spacing)
  162.         , '<', (UChar)0x00b7                       // middle dot (spacing)
  163.         , '<', (UChar)0x00b8                       // cedilla accent (spacing)
  164.         , '<', '\'', (UChar)0x0027, '\''           // apostrophe
  165.         , '<', '\'', '"', '\''                       // quotation marks
  166.         , '<', (UChar)0x00ab                       // left angle quotes
  167.         , '<', (UChar)0x00bb                       // right angle quotes
  168.         , '<', '\'', (UChar)0x0028, '\''           // left parenthesis
  169.         , '<', '\'', (UChar)0x0029, '\''           // right parenthesis
  170.         , '<', '\'', (UChar)0x005b, '\''           // left bracket
  171.         , '<', '\'', (UChar)0x005d, '\''           // right bracket
  172.         , '<', '\'', (UChar)0x007b, '\''           // left brace
  173.         , '<', '\'', (UChar)0x007d, '\''           // right brace
  174.         , '<', (UChar)0x00a7                       // section symbol
  175.         , '<', (UChar)0x00b6                       // paragraph symbol
  176.         , '<', (UChar)0x00a9                       // copyright symbol
  177.         , '<', (UChar)0x00ae                       // registered trademark symbol
  178.         , '<', '\'', (UChar)0x0040, '\''           // at sign
  179.         , '<', (UChar)0x00a4                       // international currency symbol
  180.         , '<', (UChar)0x00a2                       // cent sign
  181.         , '<', '\'', (UChar)0x0024, '\''           // dollar sign
  182.         , '<', (UChar)0x00a3                       // pound-sterling sign
  183.         , '<', (UChar)0x00a5                       // yen sign
  184.         , '<', '\'', (UChar)0x002a, '\''           // asterisk
  185.         , '<', '\'', (UChar)0x005c, '\''           // backslash
  186.         , '<', '\'', (UChar)0x0026, '\''           // ampersand
  187.         , '<', '\'', (UChar)0x0023, '\''           // number sign
  188.         , '<', '\'', (UChar)0x0025, '\''           // percent sign
  189.         , '<', '\'', (UChar)0x002b, '\''           // plus sign
  190. //        , '<', (UChar)0x002d                     // hyphen or minus sign
  191.         , '<', (UChar)0x00b1                       // plus-or-minus sign
  192.         , '<', (UChar)0x00f7                       // divide sign
  193.         , '<', (UChar)0x00d7                       // multiply sign
  194.         , '<', '\'', (UChar)0x003c, '\''           // less-than sign
  195.         , '<', '\'', (UChar)0x003d, '\''           // equal sign
  196.         , '<', '\'', (UChar)0x003e, '\''           // greater-than sign
  197.         , '<', (UChar)0x00ac                       // end of line symbol/logical NOT symbol
  198.         , '<', '\'', (UChar)0x007c, '\''           // vertical line/logical OR symbol
  199.         , '<', (UChar)0x00a6                       // broken vertical line
  200.         , '<', (UChar)0x00b0                       // degree symbol
  201.         , '<', (UChar)0x00b5                       // micro symbol
  202.  
  203.         // NUMERICS
  204.  
  205.         , '<', '0', '<', '1', '<', '2', '<', '3', '<', '4', '<', '5', '<', '6', '<', '7', '<', '8', '<', '9' 
  206.         , '<', (UChar)0x00bc, '<', (UChar)0x00bd, '<', (UChar)0x00be    // 1/4,1/2,3/4 fractions
  207.  
  208.         // NON-IGNORABLES
  209.         , '<', 'a', ',', 'A'
  210.         , '<', 'b', ',', 'B'
  211.         , '<', 'c', ',', 'C'
  212.         , '<', 'd', ',', 'D'
  213.         , '<', (UChar)0x00F0, ',', (UChar)0x00D0              // eth
  214.         , '<', 'e', ',', 'E'
  215.         , '<', 'f', ',', 'F'
  216.         , '<', 'g', ',', 'G'
  217.         , '<', 'h', ',', 'H'
  218.         , '<', 'i', ',', 'I'
  219.         , '<', 'j', ',', 'J'
  220.         , '<', 'k', ',', 'K'
  221.         , '<', 'l', ',', 'L'
  222.         , '<', 'm', ',', 'M'
  223.         , '<', 'n', ',', 'N'
  224.         , '<', 'o', ',', 'O'
  225.         , '<', 'p', ',', 'P'
  226.         , '<', 'q', ',', 'Q'
  227.         , '<', 'r', ',', 'R'
  228.         , '<', 's', ',', 'S', '&', 'S', 'S', ',', (UChar)0x00DF // s-zet
  229.         , '<', 't', ',', 'T'
  230.         , '&', 'T', 'H', ',', 0x00FE, '&', 'T', 'H', ',', (UChar)0x00DE  // thorn
  231.         , '<', 'u', ',', 'U'
  232.         , '<', 'v', ',', 'V'
  233.         , '<', 'w', ',', 'W'
  234.         , '<', 'x', ',', 'X'
  235.         , '<', 'y', ',', 'Y'
  236.         , '<', 'z', ',', 'Z'
  237.         , '&', 'A', 'E', ',', (UChar)0x00C6                    // ae & AE ligature
  238.         , '&', 'A', 'E', ',', (UChar)0x00E6
  239.         , '&', 'O', 'E', ',', (UChar)0x0152                    // oe & OE ligature
  240.         , '&', 'O', 'E', ',', (UChar)0x0153
  241.         , (UChar)0x0000
  242. };
  243.  
  244.  
  245.  
  246. CollationDummyTest::CollationDummyTest()
  247. : myCollation(0)
  248. {
  249.     UErrorCode status = U_ZERO_ERROR;
  250.     UnicodeString rules(DEFAULTRULEARRAY);
  251.     UnicodeString newRules("& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 ");
  252.     
  253.     rules += newRules;
  254.     myCollation = new RuleBasedCollator(rules, status);
  255. }
  256.  
  257. CollationDummyTest::~CollationDummyTest()
  258. {
  259.     delete myCollation;
  260. }
  261.  
  262. const UChar CollationDummyTest::testSourceCases[][CollationDummyTest::MAX_TOKEN_LEN] = {
  263.     {'a', 'b', '\'', 'c', 0},
  264.     {'c', 'o', '-', 'o', 'p', 0},
  265.     {'a', 'b', 0},
  266.     {'a', 'm', 'p', 'e', 'r', 's', 'a', 'd', 0},
  267.     {'a', 'l', 'l', 0},
  268.     {'f', 'o', 'u', 'r', 0},
  269.     {'f', 'i', 'v', 'e', 0},
  270.     {'1', 0},
  271.     {'1', 0},
  272.     {'1', 0},                                            // 10
  273.     {'2', 0},
  274.     {'2', 0},
  275.     {'H', 'e', 'l', 'l', 'o', 0},
  276.     {'a', '<', 'b', 0},
  277.     {'a', '<', 'b', 0},
  278.     {'a', 'c', 'c', 0},
  279.     {'a', 'c', 'H', 'c', 0},  // simple test
  280.     {'p', 0x00EA, 'c', 'h', 'e', 0},
  281.     {'a', 'b', 'c', 0},
  282.     {'a', 'b', 'c', 0},                                  // 20
  283.     {'a', 'b', 'c', 0},
  284.     {'a', 'b', 'c', 0},
  285.     {'a', 'b', 'c', 0},
  286.     {'a', 0x00E6, 'c', 0},
  287.     {'a', 'c', 'H', 'c', 0},  // primary test
  288.     {'b', 'l', 'a', 'c', 'k', 0},
  289.     {'f', 'o', 'u', 'r', 0},
  290.     {'f', 'i', 'v', 'e', 0},
  291.     {'1', 0},
  292.     {'a', 'b', 'c', 0},
  293.     {'a', 'b', 'c', 0},                                  // 30
  294.     {'a', 'b', 'c', 'H', 0},
  295.     {'a', 'b', 'c', 0},
  296.     {'a', 'c', 'H', 'c', 0}                              // 33
  297. };
  298.  
  299. const UChar CollationDummyTest::testTargetCases[][CollationDummyTest::MAX_TOKEN_LEN] = {
  300.     {'a', 'b', 'c', '\'', 0},
  301.     {'C', 'O', 'O', 'P', 0},
  302.     {'a', 'b', 'c', 0},
  303.     {'&', 0},
  304.     {'&', 0},
  305.     {'4', 0},
  306.     {'5', 0},
  307.     {'o', 'n', 'e', 0},
  308.     {'n', 'n', 'e', 0},
  309.     {'p', 'n', 'e', 0},                                  // 10
  310.     {'t', 'w', 'o', 0},
  311.     {'u', 'w', 'o', 0},
  312.     {'h', 'e', 'l', 'l', 'O', 0},
  313.     {'a', '<', '=', 'b', 0},
  314.     {'a', 'b', 'c', 0},
  315.     {'a', 'C', 'H', 'c', 0},
  316.     {'a', 'C', 'H', 'c', 0},  // simple test
  317.     {'p', 0x00E9, 'c', 'h', 0x00E9, 0},
  318.     {'a', 'b', 'c', 0},
  319.     {'a', 'B', 'C', 0},                                  // 20
  320.     {'a', 'b', 'c', 'h', 0},
  321.     {'a', 'b', 'd', 0},
  322.     {0x00E4, 'b', 'c', 0},
  323.     {'a', 0x00C6, 'c', 0},
  324.     {'a', 'C', 'H', 'c', 0},  // primary test
  325.     {'b', 'l', 'a', 'c', 'k', '-', 'b', 'i', 'r', 'd', 0},
  326.     {'4', 0},
  327.     {'5', 0},
  328.     {'o', 'n', 'e', 0},
  329.     {'a', 'b', 'c', 0},
  330.     {'a', 'B', 'c', 0},                                  // 30
  331.     {'a', 'b', 'c', 'h', 0},
  332.     {'a', 'b', 'd', 0},
  333.     {'a', 'C', 'H', 'c', 0}                              // 34
  334. };
  335.  
  336. const Collator::EComparisonResult CollationDummyTest::results[] = {
  337.     Collator::LESS,
  338.     Collator::GREATER,
  339.     Collator::LESS,
  340.     Collator::LESS,
  341.     Collator::LESS,
  342.     Collator::LESS,
  343.     Collator::LESS,
  344.     Collator::GREATER,
  345.     Collator::GREATER,
  346.     Collator::LESS,                                     // 10
  347.     Collator::GREATER,
  348.     Collator::LESS,
  349.     Collator::GREATER,
  350.     Collator::GREATER,
  351.     Collator::LESS,
  352.     Collator::LESS,
  353.     Collator::LESS,
  354.     // test primary > 17
  355.     Collator::EQUAL,
  356.     Collator::EQUAL,
  357.     Collator::EQUAL,                                    // 20
  358.     Collator::LESS,
  359.     Collator::LESS,
  360.     Collator::EQUAL,
  361.     Collator::EQUAL,
  362.     Collator::EQUAL,
  363.     Collator::LESS,
  364.     // test secondary > 26
  365.     Collator::EQUAL,
  366.     Collator::EQUAL,
  367.     Collator::EQUAL,
  368.     Collator::EQUAL,
  369.     Collator::EQUAL,                                    // 30
  370.     Collator::EQUAL,
  371.     Collator::LESS,
  372.     Collator::EQUAL                                     // 34
  373. };
  374.  
  375. const UChar CollationDummyTest::testCases[][CollationDummyTest::MAX_TOKEN_LEN] =
  376. {
  377.     {'a', 0},
  378.     {'A', 0},
  379.     {0x00e4, 0},
  380.     {0x00c4, 0},
  381.     {'a', 'e', 0},
  382.     {'a', 'E', 0},
  383.     {'A', 'e', 0},
  384.     {'A', 'E', 0},
  385.     {0x00e6, 0},
  386.     {0x00c6, 0},
  387.     {'b', 0},
  388.     {'c', 0},
  389.     {'z', 0}
  390. };
  391.  
  392. void CollationDummyTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
  393. {
  394.     Collator::EComparisonResult compareResult = myCollation->compare(source, target);
  395.     CollationKey sortKey1, sortKey2;
  396.     UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
  397.     myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status );
  398.     myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status );
  399.     if (U_FAILURE(key1status) || U_FAILURE(key2status))
  400.     {
  401.         errln("SortKey generation Failed.\n");
  402.         return;
  403.     }
  404.  
  405.     Collator::EComparisonResult keyResult = sortKey1.compareTo(sortKey2);
  406.     reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
  407. }
  408.  
  409. void CollationDummyTest::TestTertiary( char* par )
  410. {
  411.     int32_t i = 0;
  412.     myCollation->setStrength(Collator::TERTIARY);
  413.     for (i = 0; i < 17 ; i++)
  414.     {
  415.         doTest(testSourceCases[i], testTargetCases[i], results[i]);
  416.     }
  417. }
  418. void CollationDummyTest::TestPrimary( char* par )
  419. {
  420.     int32_t i;
  421.     myCollation->setStrength(Collator::PRIMARY);
  422.     for (i = 17; i < 26; i++)
  423.     {
  424.         doTest(testSourceCases[i], testTargetCases[i], results[i]);
  425.     }
  426. }
  427.  
  428. void CollationDummyTest::TestSecondary( char* par )
  429. {
  430.     int32_t i;
  431.     myCollation->setStrength(Collator::SECONDARY);
  432.     for (i = 26; i < 34; i++)
  433.     {
  434.         doTest(testSourceCases[i], testTargetCases[i], results[i]);
  435.     }
  436. }
  437.  
  438. void CollationDummyTest::TestExtra( char* par )
  439. {
  440.     int32_t i, j;
  441.     myCollation->setStrength(Collator::TERTIARY);
  442.     for (i = 0; i < 12; i++)
  443.     {
  444.         for (j = i + 1; j < 13; j += 1)
  445.         {
  446.             doTest(testCases[i], testCases[j], Collator::LESS);
  447.         }
  448.     }
  449. }
  450.  
  451. void CollationDummyTest::runIndexedTest( int32_t index, bool_t exec, char* &name, char* par )
  452. {
  453.     if (exec) logln("TestSuite CollationDummyTest: ");
  454.     switch (index) {
  455.         case 0: name = "TestPrimary";   if (exec)   TestPrimary( par ); break;
  456.         case 1: name = "TestSecondary"; if (exec)   TestSecondary( par ); break;
  457.         case 2: name = "TestTertiary";  if (exec)   TestTertiary( par ); break;
  458.         case 3: name = "TestExtra";     if (exec)   TestExtra( par ); break;
  459.         default: name = ""; break;
  460.     }
  461. }
  462.  
  463.