1f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)/******************************************************************** 2f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) * COPYRIGHT: 3f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) * Copyright (c) 1997-2010, International Business Machines Corporation and 4f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) * others. All Rights Reserved. 5f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) ********************************************************************/ 6f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 7f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "unicode/utypes.h" 8f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 9f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#if !UCONFIG_NO_COLLATION 10f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 11f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "unicode/coll.h" 12f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "unicode/tblcoll.h" 13f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "unicode/unistr.h" 14f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "unicode/sortkey.h" 15f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "regcoll.h" 16f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "sfwdchit.h" 17f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "testutil.h" 18f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#include "cmemory.h" 19f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 20f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#define ARRAY_LENGTH(array) ((int32_t)(sizeof array / sizeof array[0])) 21f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 22f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)CollationRegressionTest::CollationRegressionTest() 23f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 24f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 25f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 26f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) en_us = (RuleBasedCollator *)Collator::createInstance(Locale::getUS(), status); 27f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if(U_FAILURE(status)) { 28f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete en_us; 29f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) en_us = 0; 30f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errcheckln(status, "Collator creation failed with %s", u_errorName(status)); 31f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 32f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 33f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 34f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 35f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)CollationRegressionTest::~CollationRegressionTest() 36f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 37f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete en_us; 38f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 39f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 40f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 41f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // @bug 4048446 42f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 43f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// CollationElementIterator.reset() doesn't work 44f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 45f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4048446(/* char* par */) 46f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 47f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) const UnicodeString test1 = "XFILE What subset of all possible test cases has the highest probability of detecting the most errors?"; 48f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) const UnicodeString test2 = "Xf_ile What subset of all possible test cases has the lowest probability of detecting the least errors?"; 49f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationElementIterator *i1 = en_us->createCollationElementIterator(test1); 50f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationElementIterator *i2 = en_us->createCollationElementIterator(test1); 51f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 52f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 53f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (i1 == NULL|| i2 == NULL) 54f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 55f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Could not create CollationElementIterator's"); 56f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i1; 57f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i2; 58f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 59f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 60f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 61f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) while (i1->next(status) != CollationElementIterator::NULLORDER) 62f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 63f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (U_FAILURE(status)) 64f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 65f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("error calling next()"); 66f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 67f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i1; 68f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i2; 69f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 70f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 71f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 72f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 73f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) i1->reset(); 74f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 75f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) assertEqual(*i1, *i2); 76f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 77f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i1; 78f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i2; 79f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 80f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 81f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4051866 82f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 83f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collator -> rules -> Collator round-trip broken for expanding characters 84f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 85f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4051866(/* char* par */) 86f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 87f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)/* 88f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator c1 = new RuleBasedCollator("< o " 89f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) +"& oe ,o\u3080" 90f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) +"& oe ,\u1530 ,O" 91f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) +"& OE ,O\u3080" 92f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) +"& OE ,\u1520" 93f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) +"< p ,P"); 94f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)*/ 95f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 96f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString rules; 97f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 98f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 99f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += "< o "; 100f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += "& oe ,o"; 101f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += (UChar)0x3080; 102f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += "& oe ,"; 103f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += (UChar)0x1530; 104f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += " ,O"; 105f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += "& OE ,O"; 106f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += (UChar)0x3080; 107f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += "& OE ,"; 108f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += (UChar)0x1520; 109f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += "< p ,P"; 110f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 111f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Build a collator containing expanding characters 112f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c1 = new RuleBasedCollator(rules, status); 113f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 114f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Build another using the rules from the first 115f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c2 = new RuleBasedCollator(c1->getRules(), status); 116f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 117f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Make sure they're the same 118f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (!(c1->getRules() == c2->getRules())) 119f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 120f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Rules are not equal"); 121f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 122f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 123f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c2; 124f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c1; 125f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 126f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 127f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4053636 128f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 129f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collator thinks "black-bird" == "black" 130f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 131f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4053636(/* char* par */) 132f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 133f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (en_us->equals("black_bird", "black")) 134f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 135f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("black-bird == black"); 136f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 137f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 138f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 139f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4054238 140f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 141f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// CollationElementIterator will not work correctly if the associated 142f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collator object's mode is changed 143f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 144f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4054238(/* char* par */) 145f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 146f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) const UChar chars3[] = {0x61, 0x00FC, 0x62, 0x65, 0x63, 0x6b, 0x20, 0x47, 0x72, 0x00F6, 0x00DF, 0x65, 0x20, 0x4c, 0x00FC, 0x62, 0x63, 0x6b, 0}; 147f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) const UnicodeString test3(chars3); 148f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 149f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 150f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // NOTE: The Java code uses en_us to create the CollationElementIterators 151f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // but I'm pretty sure that's wrong, so I've changed this to use c. 152f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 153f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 154f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationElementIterator *i1 = c->createCollationElementIterator(test3); 155f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i1; 156f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 157f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 158f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 159f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4054734 160f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 161f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collator::IDENTICAL documented but not implemented 162f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 163f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4054734(/* char* par */) 164f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 165f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) /* 166f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Here's the original Java: 167f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 168f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) String[] decomp = { 169f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u0001", "<", "\u0002", 170f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u0001", "=", "\u0001", 171f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "A\u0001", ">", "~\u0002", // Ensure A and ~ are not compared bitwise 172f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u00C0", "=", "A\u0300" // Decomp should make these equal 173f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 174f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 175f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) String[] nodecomp = { 176f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u00C0", ">", "A\u0300" // A-grave vs. A combining-grave 177f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 178f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) */ 179f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 180f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar decomp[][CollationRegressionTest::MAX_TOKEN_LEN] = 181f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 182f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x0001, 0}, {0x3c, 0}, {0x0002, 0}, 183f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x0001, 0}, {0x3d, 0}, {0x0001, 0}, 184f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x41, 0x0001, 0}, {0x3e, 0}, {0x7e, 0x0002, 0}, 185f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x00c0, 0}, {0x3d, 0}, {0x41, 0x0300, 0} 186f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 187f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 188f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 189f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 190f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 191f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 192f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::IDENTICAL); 193f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 194f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 195f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, decomp, ARRAY_LENGTH(decomp)); 196f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 197f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 198f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 199f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 200f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4054736 201f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 202f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Full Decomposition mode not implemented 203f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 204f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4054736(/* char* par */) 205f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 206f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 207f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 208f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 209f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::SECONDARY); 210f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 211f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 212f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = 213f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 214f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0xFB4F, 0}, {0x3d, 0}, {0x05D0, 0x05DC} // Alef-Lamed vs. Alef, Lamed 215f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 216f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 217f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tests, ARRAY_LENGTH(tests)); 218f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 219f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 220f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 221f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 222f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4058613 223f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 224f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collator::createInstance() causes an ArrayIndexOutofBoundsException for Korean 225f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 226f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4058613(/* char* par */) 227f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 228f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Creating a default collator doesn't work when Korean is the default 229f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // locale 230f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 231f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Locale oldDefault = Locale::getDefault(); 232f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 233f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 234f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Locale::setDefault(Locale::getKorean(), status); 235f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 236f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (U_FAILURE(status)) 237f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 238f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Could not set default locale to Locale::KOREAN"); 239f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 240f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 241f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 242f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator *c = NULL; 243f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 244f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = Collator::createInstance("en_US", status); 245f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 246f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 247f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 248f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Could not create a Korean collator"); 249f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Locale::setDefault(oldDefault, status); 250f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 251f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 252f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 253f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 254f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Since the fix to this bug was to turn off decomposition for Korean collators, 255f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // ensure that's what we got 256f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_OFF) 257f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 258f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Decomposition is not set to NO_DECOMPOSITION for Korean collator"); 259f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 260f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 261f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 262f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 263f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Locale::setDefault(oldDefault, status); 264f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 265f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 266f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4059820 267f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 268f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// RuleBasedCollator.getRules does not return the exact pattern as input 269f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// for expanding character sequences 270f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 271f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4059820(/* char* par */) 272f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 273f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 274f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 275f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = NULL; 276f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString rules = "< a < b , c/a < d < z"; 277f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 278f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = new RuleBasedCollator(rules, status); 279f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 280f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 281f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 282f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failure building a collator."); 283f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 284f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 285f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 286f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 287f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if ( c->getRules().indexOf("c/a") == -1) 288f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 289f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("returned rules do not contain 'c/a'"); 290f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 291f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 292f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 293f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 294f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 295f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4060154 296f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 297f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// MergeCollation::fixEntry broken for "& H < \u0131, \u0130, i, I" 298f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 299f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4060154(/* char* par */) 300f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 301f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 302f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString rules; 303f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 304f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += "< g, G < h, H < i, I < j, J"; 305f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += " & H < "; 306f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += (UChar)0x0131; 307f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += ", "; 308f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += (UChar)0x0130; 309f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) rules += ", i, I"; 310f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 311f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = NULL; 312f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 313f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = new RuleBasedCollator(rules, status); 314f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 315f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 316f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 317f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("failure building collator."); 318f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 319f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 320f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 321f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 322f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 323f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 324f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) /* 325f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) String[] tertiary = { 326f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "A", "<", "B", 327f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "H", "<", "\u0131", 328f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "H", "<", "I", 329f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u0131", "<", "\u0130", 330f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u0130", "<", "i", 331f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u0130", ">", "H", 332f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 333f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)*/ 334f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 335f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tertiary[][CollationRegressionTest::MAX_TOKEN_LEN] = 336f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 337f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x41, 0}, {0x3c, 0}, {0x42, 0}, 338f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x48, 0}, {0x3c, 0}, {0x0131, 0}, 339f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x48, 0}, {0x3c, 0}, {0x49, 0}, 340f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x0131, 0}, {0x3c, 0}, {0x0130, 0}, 341f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x0130, 0}, {0x3c, 0}, {0x69, 0}, 342f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x0130, 0}, {0x3e, 0}, {0x48, 0} 343f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 344f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 345f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::TERTIARY); 346f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tertiary, ARRAY_LENGTH(tertiary)); 347f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 348f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) /* 349f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) String[] secondary = { 350f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "H", "<", "I", 351f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u0131", "=", "\u0130", 352f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 353f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)*/ 354f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar secondary[][CollationRegressionTest::MAX_TOKEN_LEN] = 355f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 356f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x48, 0}, {0x3c, 0}, {0x49, 0}, 357f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x0131, 0}, {0x3d, 0}, {0x0130, 0} 358f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 359f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 360f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::PRIMARY); 361f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, secondary, ARRAY_LENGTH(secondary)); 362f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 363f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 364f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 365f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 366f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4062418 367f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 368f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Secondary/Tertiary comparison incorrect in French Secondary 369f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 370f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4062418(/* char* par */) 371f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 372f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 373f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 374f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = NULL; 375f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 376f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = (RuleBasedCollator *) Collator::createInstance(Locale::getCanadaFrench(), status); 377f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 378f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 379f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 380f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create collator for Locale::getCanadaFrench()"); 381f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 382f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 383f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 384f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 385f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::SECONDARY); 386f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 387f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)/* 388f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) String[] tests = { 389f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "p\u00eache", "<", "p\u00e9ch\u00e9", // Comparing accents from end, p\u00e9ch\u00e9 is greater 390f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 391f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)*/ 392f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = 393f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 394f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x70, 0x00EA, 0x63, 0x68, 0x65, 0}, {0x3c, 0}, {0x70, 0x00E9, 0x63, 0x68, 0x00E9, 0} 395f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 396f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 397f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tests, ARRAY_LENGTH(tests)); 398f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 399f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 400f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 401f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 402f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4065540 403f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 404f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collator::compare() method broken if either string contains spaces 405f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 406f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4065540(/* char* par */) 407f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 408f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (en_us->compare("abcd e", "abcd f") == 0) 409f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 410f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("'abcd e' == 'abcd f'"); 411f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 412f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 413f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 414f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4066189 415f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 416f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Unicode characters need to be recursively decomposed to get the 417f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// correct result. For example, 418f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// u1EB1 -> \u0103 + \u0300 -> a + \u0306 + \u0300. 419f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 420f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4066189(/* char* par */) 421f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 422f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar chars1[] = {0x1EB1, 0}; 423f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar chars2[] = {0x61, 0x0306, 0x0300, 0}; 424f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) const UnicodeString test1(chars1); 425f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) const UnicodeString test2(chars2); 426f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 427f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 428f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // NOTE: The java code used en_us to create the 429f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // CollationElementIterator's. I'm pretty sure that 430f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // was wrong, so I've change the code to use c1 and c2 431f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c1 = (RuleBasedCollator *) en_us->clone(); 432f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c1->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 433f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationElementIterator *i1 = c1->createCollationElementIterator(test1); 434f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 435f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c2 = (RuleBasedCollator *) en_us->clone(); 436f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c2->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status); 437f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationElementIterator *i2 = c2->createCollationElementIterator(test2); 438f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 439f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) assertEqual(*i1, *i2); 440f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 441f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i2; 442f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c2; 443f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i1; 444f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c1; 445f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 446f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 447f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4066696 448f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 449f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// French secondary collation checking at the end of compare iteration fails 450f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 451f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4066696(/* char* par */) 452f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 453f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 454f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = NULL; 455f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 456f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = (RuleBasedCollator *)Collator::createInstance(Locale::getCanadaFrench(), status); 457f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 458f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 459f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 460f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failure creating collator for Locale::getCanadaFrench()"); 461f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 462f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 463f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 464f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 465f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::SECONDARY); 466f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 467f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)/* 468f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) String[] tests = { 469f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u00e0", "<", "\u01fa", // a-grave < A-ring-acute 470f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 471f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 472f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) should be: 473f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 474f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) String[] tests = { 475f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) "\u00e0", ">", "\u01fa", // a-grave < A-ring-acute 476f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 477f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 478f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)*/ 479f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 480f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = 481f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 482f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x00E0, 0}, {0x3e, 0}, {0x01FA, 0} 483f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 484f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 485f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tests, ARRAY_LENGTH(tests)); 486f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 487f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 488f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 489f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 490f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4076676 491f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 492f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Bad canonicalization of same-class combining characters 493f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 494f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4076676(/* char* par */) 495f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 496f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // These combining characters are all in the same class, so they should not 497f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // be reordered, and they should compare as unequal. 498f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar s1[] = {0x41, 0x0301, 0x0302, 0x0300, 0}; 499f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar s2[] = {0x41, 0x0302, 0x0300, 0x0301, 0}; 500f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 501f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 502f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::TERTIARY); 503f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 504f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c->compare(s1,s2) == 0) 505f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 506f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Same-class combining chars were reordered"); 507f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 508f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 509f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 510f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 511f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 512f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4079231 513f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 514f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// RuleBasedCollator::operator==(NULL) throws NullPointerException 515f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 516f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4079231(/* char* par */) 517f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 518f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // I don't think there's any way to write this test 519f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // in C++. The following is equivalent to the Java, 520f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // but doesn't compile 'cause NULL can't be converted 521f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // to Collator& 522f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 523f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // if (en_us->operator==(NULL)) 524f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // { 525f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // errln("en_us->operator==(NULL) returned TRUE"); 526f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // } 527f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 528f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) /* 529f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) try { 530f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (en_us->equals(null)) { 531f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("en_us->equals(null) returned true"); 532f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 533f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 534f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) catch (Exception e) { 535f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("en_us->equals(null) threw " + e.toString()); 536f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 537f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)*/ 538f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 539f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 540f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4078588 541f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 542f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// RuleBasedCollator breaks on "< a < bb" rule 543f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 544f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4078588(/* char *par */) 545f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 546f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 547f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *rbc = new RuleBasedCollator((UnicodeString)"< a < bb", status); 548f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 549f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (rbc == NULL || U_FAILURE(status)) 550f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 551f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create RuleBasedCollator."); 552f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete rbc; 553f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 554f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 555f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 556f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator::EComparisonResult result = rbc->compare("a","bb"); 557f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 558f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (result != Collator::LESS) 559f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 560f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln((UnicodeString)"Compare(a,bb) returned " + (int)result 561f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) + (UnicodeString)"; expected -1"); 562f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 563f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 564f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete rbc; 565f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 566f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 567f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4081866 568f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 569f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Combining characters in different classes not reordered properly. 570f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 571f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4081866(/* char* par */) 572f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 573f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // These combining characters are all in different classes, 574f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // so they should be reordered and the strings should compare as equal. 575f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar s1[] = {0x41, 0x0300, 0x0316, 0x0327, 0x0315, 0}; 576f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar s2[] = {0x41, 0x0327, 0x0316, 0x0315, 0x0300, 0}; 577f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 578f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 579f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 580f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::TERTIARY); 581f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 582f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Now that the default collators are set to NO_DECOMPOSITION 583f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // (as a result of fixing bug 4114077), we must set it explicitly 584f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // when we're testing reordering behavior. -- lwerner, 5/5/98 585f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 586f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 587f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c->compare(s1,s2) != 0) 588f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 589f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Combining chars were not reordered"); 590f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 591f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 592f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 593f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 594f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 595f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4087241 596f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 597f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// string comparison errors in Scandinavian collators 598f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 599f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4087241(/* char* par */) 600f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 601f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 602f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Locale da_DK("da", "DK"); 603f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = NULL; 604f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 605f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = (RuleBasedCollator *) Collator::createInstance(da_DK, status); 606f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 607f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 608f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 609f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create collator for da_DK locale"); 610f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 611f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 612f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 613f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 614f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::SECONDARY); 615f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 616f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = 617f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 618f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x7a, 0}, {0x3c, 0}, {0x00E6, 0}, // z < ae 619f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x61, 0x0308, 0}, {0x3c, 0}, {0x61, 0x030A, 0}, // a-unlaut < a-ring 620f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x59, 0}, {0x3c, 0}, {0x75, 0x0308, 0}, // Y < u-umlaut 621f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 622f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 623f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tests, ARRAY_LENGTH(tests)); 624f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 625f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 626f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 627f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 628f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4087243 629f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 630f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// CollationKey takes ignorable strings into account when it shouldn't 631f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 632f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4087243(/* char* par */) 633f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 634f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 635f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::TERTIARY); 636f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 637f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = 638f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 639f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x31, 0x32, 0x33, 0}, {0x3d, 0}, {0x31, 0x32, 0x33, 0x0001, 0} // 1 2 3 = 1 2 3 ctrl-A 640f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 641f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 642f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tests, ARRAY_LENGTH(tests)); 643f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 644f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 645f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 646f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 647f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4092260 648f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 649f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Mu/micro conflict 650f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Micro symbol and greek lowercase letter Mu should sort identically 651f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 652f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4092260(/* char* par */) 653f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 654f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 655f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Locale el("el", ""); 656f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator *c = NULL; 657f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 658f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = Collator::createInstance(el, status); 659f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 660f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 661f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 662f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create collator for el locale."); 663f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 664f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 665f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 666f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 667f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // These now have tertiary differences in UCA 668f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_STRENGTH, UCOL_SECONDARY, status); 669f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 670f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = 671f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 672f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x00B5, 0}, {0x3d, 0}, {0x03BC, 0} 673f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 674f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 675f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tests, ARRAY_LENGTH(tests)); 676f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 677f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 678f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 679f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 680f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4095316 681f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 682f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4095316(/* char* par */) 683f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 684f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 685f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Locale el_GR("el", "GR"); 686f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator *c = Collator::createInstance(el_GR, status); 687f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 688f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 689f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 690f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create collator for el_GR locale"); 691f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 692f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 693f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 694f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // These now have tertiary differences in UCA 695f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) //c->setStrength(Collator::TERTIARY); 696f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_STRENGTH, UCOL_SECONDARY, status); 697f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 698f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = 699f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 700f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x03D4, 0}, {0x3d, 0}, {0x03AB, 0} 701f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 702f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 703f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tests, ARRAY_LENGTH(tests)); 704f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 705f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 706f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 707f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 708f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4101940 709f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 710f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4101940(/* char* par */) 711f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 712f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 713f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = NULL; 714f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString rules = "< a < b"; 715f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString nothing = ""; 716f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 717f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = new RuleBasedCollator(rules, status); 718f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 719f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 720f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 721f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create RuleBasedCollator"); 722f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 723f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 724f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 725f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 726f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationElementIterator *i = c->createCollationElementIterator(nothing); 727f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) i->reset(); 728f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 729f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (i->next(status) != CollationElementIterator::NULLORDER) 730f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 731f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("next did not return NULLORDER"); 732f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 733f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 734f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete i; 735f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 736f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 737f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 738f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4103436 739f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 740f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collator::compare not handling spaces properly 741f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 742f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4103436(/* char* par */) 743f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 744f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 745f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::TERTIARY); 746f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 747f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = 748f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 749f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x66, 0x69, 0x6c, 0x65, 0}, {0x3c, 0}, {0x66, 0x69, 0x6c, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0}, 750f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x66, 0x69, 0x6c, 0x65, 0}, {0x3c, 0}, {0x66, 0x69, 0x6c, 0x65, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0} 751f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 752f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 753f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, tests, ARRAY_LENGTH(tests)); 754f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 755f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 756f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 757f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 758f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4114076 759f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 760f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collation not Unicode conformant with Hangul syllables 761f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 762f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4114076(/* char* par */) 763f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 764f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 765f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 766f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::TERTIARY); 767f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 768f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 769f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // With Canonical decomposition, Hangul syllables should get decomposed 770f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // into Jamo, but Jamo characters should not be decomposed into 771f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // conjoining Jamo 772f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 773f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] = 774f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 775f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0xd4db, 0}, {0x3d, 0}, {0x1111, 0x1171, 0x11b6, 0} 776f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 777f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 778f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 779f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, test1, ARRAY_LENGTH(test1)); 780f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 781f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // From UTR #15: 782f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // *In earlier versions of Unicode, jamo characters like ksf 783f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // had compatibility mappings to kf + sf. These mappings were 784f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // removed in Unicode 2.1.9 to ensure that Hangul syllables are maintained.) 785f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // That is, the following test is obsolete as of 2.1.9 786f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 787f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- // With Full decomposition, it should go all the way down to 788f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- // conjoining Jamo characters. 789f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- // 790f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- static const UChar test2[][CollationRegressionTest::MAX_TOKEN_LEN] = 791f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- { 792f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- {0xd4db, 0}, {0x3d, 0}, {0x1111, 0x116e, 0x1175, 0x11af, 0x11c2, 0} 793f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- }; 794f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- 795f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- c->setDecomposition(Normalizer::DECOMP_COMPAT); 796f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)//obsolete- compareArray(*c, test2, ARRAY_LENGTH(test2)); 797f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 798f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 799f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 800f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 801f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 802f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4124632 803f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 804f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collator::getCollationKey was hanging on certain character sequences 805f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 806f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4124632(/* char* par */) 807f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 808f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 809f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator *coll = NULL; 810f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 811f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) coll = Collator::createInstance(Locale::getJapan(), status); 812f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 813f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (coll == NULL || U_FAILURE(status)) 814f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 815f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create collator for Locale::JAPAN"); 816f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete coll; 817f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 818f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 819f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 820f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar test[] = {0x41, 0x0308, 0x62, 0x63, 0}; 821f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationKey key; 822f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 823f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) coll->getCollationKey(test, key, status); 824f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 825f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (key.isBogus() || U_FAILURE(status)) 826f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 827f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("CollationKey creation failed."); 828f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 829f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 830f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete coll; 831f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 832f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 833f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4132736 834f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 835f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// sort order of french words with multiple accents has errors 836f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 837f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4132736(/* char* par */) 838f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 839f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 840f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 841f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator *c = NULL; 842f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 843f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = Collator::createInstance(Locale::getCanadaFrench(), status); 844f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::TERTIARY); 845f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 846f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 847f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 848f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create a collator for Locale::getCanadaFrench()"); 849f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 850f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 851f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 852f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 853f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] = 854f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 855f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x65, 0x0300, 0x65, 0x0301, 0}, {0x3c, 0}, {0x65, 0x0301, 0x65, 0x0300, 0}, 856f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x65, 0x0300, 0x0301, 0}, {0x3c, 0}, {0x65, 0x0301, 0x0300, 0} 857f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 858f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 859f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, test1, ARRAY_LENGTH(test1)); 860f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 861f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 862f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 863f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 864f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4133509 865f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 866f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// The sorting using java.text.CollationKey is not in the exact order 867f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 868f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4133509(/* char* par */) 869f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 870f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] = 871f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 872f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0}, {0x3c, 0}, {0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0}, 873f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0}, {0x3c, 0}, {0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0}, 874f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0}, {0x3c, 0}, {0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0} 875f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 876f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 877f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*en_us, test1, ARRAY_LENGTH(test1)); 878f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 879f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 880f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4114077 881f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 882f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Collation with decomposition off doesn't work for Europe 883f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 884f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4114077(/* char* par */) 885f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 886f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Ensure that we get the same results with decomposition off 887f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // as we do with it on.... 888f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 889f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 890f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); 891f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setStrength(Collator::TERTIARY); 892f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 893f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] = 894f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 895f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x00C0, 0}, {0x3d, 0}, {0x41, 0x0300, 0}, // Should be equivalent 896f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x70, 0x00ea, 0x63, 0x68, 0x65, 0}, {0x3e, 0}, {0x70, 0x00e9, 0x63, 0x68, 0x00e9, 0}, 897f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x0204, 0}, {0x3d, 0}, {0x45, 0x030F, 0}, 898f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x01fa, 0}, {0x3d, 0}, {0x41, 0x030a, 0x0301, 0}, // a-ring-acute -> a-ring, acute 899f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // -> a, ring, acute 900f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x41, 0x0300, 0x0316, 0}, {0x3c, 0}, {0x41, 0x0316, 0x0300, 0} // No reordering --> unequal 901f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 902f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 903f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status); 904f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, test1, ARRAY_LENGTH(test1)); 905f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 906f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar test2[][CollationRegressionTest::MAX_TOKEN_LEN] = 907f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 908f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) {0x41, 0x0300, 0x0316, 0}, {0x3d, 0}, {0x41, 0x0316, 0x0300, 0} // Reordering --> equal 909f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 910f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 911f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); 912f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compareArray(*c, test2, ARRAY_LENGTH(test2)); 913f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 914f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 915f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 916f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 917f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4141640 918f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 919f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Support for Swedish gone in 1.1.6 (Can't create Swedish collator) 920f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 921f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4141640(/* char* par */) 922f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 923f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 924f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Rather than just creating a Swedish collator, we might as well 925f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // try to instantiate one for every locale available on the system 926f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // in order to prevent this sort of bug from cropping up in the future 927f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 928f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 929f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) int32_t i, localeCount; 930f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) const Locale *locales = Locale::getAvailableLocales(localeCount); 931f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 932f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) for (i = 0; i < localeCount; i += 1) 933f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 934f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator *c = NULL; 935f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 936f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) status = U_ZERO_ERROR; 937f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c = Collator::createInstance(locales[i], status); 938f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 939f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c == NULL || U_FAILURE(status)) 940f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 941f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString msg, localeName; 942f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 943f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) msg += "Could not create collator for locale "; 944f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) msg += locales[i].getName(); 945f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 946f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln(msg); 947f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 948f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 949f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete c; 950f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 951f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 952f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 953f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4139572 954f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 955f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// getCollationKey throws exception for spanish text 956f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Cannot reproduce this bug on 1.2, however it DOES fail on 1.1.6 957f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 958f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4139572(/* char* par */) 959f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 960f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 961f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Code pasted straight from the bug report 962f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // (and then translated to C++ ;-) 963f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 964f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // create spanish locale and collator 965f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 966f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Locale l("es", "es"); 967f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator *col = NULL; 968f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 969f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) col = Collator::createInstance(l, status); 970f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 971f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (col == NULL || U_FAILURE(status)) 972f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 973f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create a collator for es_es locale."); 974f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete col; 975f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 976f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 977f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 978f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationKey key; 979f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 980f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // this spanish phrase kills it! 981f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) col->getCollationKey("Nombre De Objeto", key, status); 982f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 983f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (key.isBogus() || U_FAILURE(status)) 984f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 985f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Error creating CollationKey for \"Nombre De Ojbeto\""); 986f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 987f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 988f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete col; 989f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 990f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)/* HSYS : RuleBasedCollator::compare() performance enhancements 991f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) compare() does not create CollationElementIterator() anymore.*/ 992f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 993f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)class My4146160Collator : public RuleBasedCollator 994f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 995f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)public: 996f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) My4146160Collator(RuleBasedCollator &rbc, UErrorCode &status); 997f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) ~My4146160Collator(); 998f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 999f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationElementIterator *createCollationElementIterator(const UnicodeString &text) const; 1000f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1001f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationElementIterator *createCollationElementIterator(const CharacterIterator &text) const; 1002f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1003f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static int32_t count; 1004f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)}; 1005f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1006f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)int32_t My4146160Collator::count = 0; 1007f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1008f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)My4146160Collator::My4146160Collator(RuleBasedCollator &rbc, UErrorCode &status) 1009f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) : RuleBasedCollator(rbc.getRules(), status) 1010f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 1011f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1012f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1013f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)My4146160Collator::~My4146160Collator() 1014f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 1015f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1016f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1017f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)CollationElementIterator *My4146160Collator::createCollationElementIterator(const UnicodeString &text) const 1018f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 1019f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) count += 1; 1020f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return RuleBasedCollator::createCollationElementIterator(text); 1021f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1022f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1023f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)CollationElementIterator *My4146160Collator::createCollationElementIterator(const CharacterIterator &text) const 1024f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 1025f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) count += 1; 1026f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return RuleBasedCollator::createCollationElementIterator(text); 1027f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1028f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1029f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// @bug 4146160 1030f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 1031f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// RuleBasedCollator doesn't use createCollationElementIterator internally 1032f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 1033f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::Test4146160(/* char* par */) 1034f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 1035f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#if 0 1036f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 1037f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Use a custom collator class whose createCollationElementIterator 1038f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // methods increment a count.... 1039f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // 1040f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 1041f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationKey key; 1042f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1043f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) My4146160Collator::count = 0; 1044f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) My4146160Collator *mc = NULL; 1045f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1046f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) mc = new My4146160Collator(*en_us, status); 1047f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1048f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (mc == NULL || U_FAILURE(status)) 1049f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1050f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create a My4146160Collator."); 1051f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete mc; 1052f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 1053f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1054f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1055f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) mc->getCollationKey("1", key, status); 1056f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1057f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (key.isBogus() || U_FAILURE(status)) 1058f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1059f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failure to get a CollationKey from a My4146160Collator."); 1060f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete mc; 1061f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 1062f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1063f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1064f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (My4146160Collator::count < 1) 1065f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1066f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("My4146160Collator::createCollationElementIterator not called for getCollationKey"); 1067f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1068f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1069f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) My4146160Collator::count = 0; 1070f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) mc->compare("1", "2"); 1071f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1072f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (My4146160Collator::count < 1) 1073f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1074f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("My4146160Collator::createtCollationElementIterator not called for compare"); 1075f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1076f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1077f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) delete mc; 1078f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#endif 1079f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1080f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1081f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// Ticket 7189 1082f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// 1083f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)// nextSortKeyPart incorrect for EO_S1 collation 1084f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)static int32_t calcKeyIncremental(UCollator *coll, const UChar* text, int32_t len, uint8_t *keyBuf, int32_t /*keyBufLen*/, UErrorCode& status) { 1085f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UCharIterator uiter; 1086f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) uint32_t state[2] = { 0, 0 }; 1087f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) int32_t keyLen; 1088f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) int32_t count = 8; 1089f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1090f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) uiter_setString(&uiter, text, len); 1091f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) keyLen = 0; 1092f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) while (TRUE) { 1093f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) int32_t keyPartLen = ucol_nextSortKeyPart(coll, &uiter, state, &keyBuf[keyLen], count, &status); 1094f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (U_FAILURE(status)) { 1095f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return -1; 1096f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1097f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (keyPartLen == 0) { 1098f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) break; 1099f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1100f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) keyLen += keyPartLen; 1101f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1102f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return keyLen; 1103f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1104f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1105f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::TestT7189() { 1106f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 1107f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UCollator *coll; 1108f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) uint32_t i; 1109f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1110f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar text1[][CollationRegressionTest::MAX_TOKEN_LEN] = { 1111f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // "Achter De Hoven" 1112f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 0x41, 0x63, 0x68, 0x74, 0x65, 0x72, 0x20, 0x44, 0x65, 0x20, 0x48, 0x6F, 0x76, 0x65, 0x6E, 0x00 }, 1113f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // "ABC" 1114f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 0x41, 0x42, 0x43, 0x00 }, 1115f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // "HELLO world!" 1116f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 0x48, 0x45, 0x4C, 0x4C, 0x4F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00 } 1117f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 1118f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1119f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) static const UChar text2[][CollationRegressionTest::MAX_TOKEN_LEN] = { 1120f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // "Achter de Hoven" 1121f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 0x41, 0x63, 0x68, 0x74, 0x65, 0x72, 0x20, 0x64, 0x65, 0x20, 0x48, 0x6F, 0x76, 0x65, 0x6E, 0x00 }, 1122f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // "abc" 1123f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 0x61, 0x62, 0x63, 0x00 }, 1124f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // "hello world!" 1125f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00 } 1126f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) }; 1127f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1128f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) // Open the collator 1129f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) coll = ucol_openFromShortString("EO_S1", FALSE, NULL, &status); 1130f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (U_FAILURE(status)) { 1131f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Failed to create a collator for short string EO_S1"); 1132f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) return; 1133f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1134f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1135f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) for (i = 0; i < sizeof(text1) / (CollationRegressionTest::MAX_TOKEN_LEN * sizeof(UChar)); i++) { 1136f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) uint8_t key1[100], key2[100]; 1137f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) int32_t len1, len2; 1138f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1139f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) len1 = calcKeyIncremental(coll, text1[i], -1, key1, sizeof(key1), status); 1140f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (U_FAILURE(status)) { 1141f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln(UnicodeString("Failed to get a partial collation key for ") + text1[i]); 1142f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) break; 1143f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1144f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) len2 = calcKeyIncremental(coll, text2[i], -1, key2, sizeof(key2), status); 1145f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (U_FAILURE(status)) { 1146f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln(UnicodeString("Failed to get a partial collation key for ") + text2[i]); 1147f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) break; 1148f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1149f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1150f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (len1 == len2 && uprv_memcmp(key1, key2, len1) == 0) { 1151f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln(UnicodeString("Failed: Identical key\n") + " text1: " + text1[i] + "\n" + " text2: " + text2[i] + "\n" + " key : " + TestUtility::hex(key1, len1)); 1152f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } else { 1153f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) logln(UnicodeString("Keys produced -\n") + " text1: " + text1[i] + "\n" + " key1 : " + TestUtility::hex(key1, len1) + "\n" + " text2: " + text2[i] + "\n" + " key2 : " 1154f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) + TestUtility::hex(key2, len2)); 1155f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1156f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1157f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) ucol_close(coll); 1158f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1159f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1160f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::compareArray(Collator &c, 1161f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN], 1162f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) int32_t testCount) 1163f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 1164f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) int32_t i; 1165f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator::EComparisonResult expectedResult = Collator::EQUAL; 1166f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1167f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) for (i = 0; i < testCount; i += 3) 1168f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1169f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString source(tests[i]); 1170f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString comparison(tests[i + 1]); 1171f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString target(tests[i + 2]); 1172f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1173f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (comparison == "<") 1174f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1175f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) expectedResult = Collator::LESS; 1176f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1177f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) else if (comparison == ">") 1178f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1179f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) expectedResult = Collator::GREATER; 1180f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1181f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) else if (comparison == "=") 1182f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1183f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) expectedResult = Collator::EQUAL; 1184f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1185f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) else 1186f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1187f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString bogus1("Bogus comparison string \""); 1188f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString bogus2("\""); 1189f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln(bogus1 + comparison + bogus2); 1190f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1191f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1192f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator::EComparisonResult compareResult = c.compare(source, target); 1193f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1194f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) CollationKey sourceKey, targetKey; 1195f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 1196f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1197f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c.getCollationKey(source, sourceKey, status); 1198f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1199f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (U_FAILURE(status)) 1200f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1201f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Couldn't get collationKey for source"); 1202f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) continue; 1203f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1204f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1205f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c.getCollationKey(target, targetKey, status); 1206f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1207f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (U_FAILURE(status)) 1208f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1209f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln("Couldn't get collationKey for target"); 1210f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) continue; 1211f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1212f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1213f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) Collator::EComparisonResult keyResult = sourceKey.compareTo(targetKey); 1214f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1215f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) reportCResult( source, target, sourceKey, targetKey, compareResult, keyResult, compareResult, expectedResult ); 1216f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1217f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1218f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1219f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1220f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::assertEqual(CollationElementIterator &i1, CollationElementIterator &i2) 1221f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 1222f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) int32_t c1, c2, count = 0; 1223f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UErrorCode status = U_ZERO_ERROR; 1224f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1225f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) do 1226f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1227f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c1 = i1.next(status); 1228f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) c2 = i2.next(status); 1229f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1230f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (c1 != c2) 1231f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1232f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) UnicodeString msg, msg1(" "); 1233f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1234f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) msg += msg1 + count; 1235f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) msg += ": strength(0x"; 1236f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) appendHex(c1, 8, msg); 1237f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) msg += ") != strength(0x"; 1238f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) appendHex(c2, 8, msg); 1239f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) msg += ")"; 1240f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1241f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) errln(msg); 1242f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) break; 1243f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1244f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1245f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) count += 1; 1246f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1247f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) while (c1 != CollationElementIterator::NULLORDER); 1248f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1249f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1250f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)void CollationRegressionTest::runIndexedTest(int32_t index, UBool exec, const char* &name, char* /* par */) 1251f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles){ 1252f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if (exec) 1253f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1254f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) logln("Collation Regression Tests: "); 1255f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1256f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1257f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) if(en_us) { 1258f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) switch (index) 1259f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) { 1260f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 0: name = "Test4048446"; if (exec) Test4048446(/* par */); break; 1261f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 1: name = "Test4051866"; if (exec) Test4051866(/* par */); break; 1262f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 2: name = "Test4053636"; if (exec) Test4053636(/* par */); break; 1263f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 3: name = "Test4054238"; if (exec) Test4054238(/* par */); break; 1264f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 4: name = "Test4054734"; if (exec) Test4054734(/* par */); break; 1265f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 5: name = "Test4054736"; if (exec) Test4054736(/* par */); break; 1266f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 6: name = "Test4058613"; if (exec) Test4058613(/* par */); break; 1267f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 7: name = "Test4059820"; if (exec) Test4059820(/* par */); break; 1268f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 8: name = "Test4060154"; if (exec) Test4060154(/* par */); break; 1269f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 9: name = "Test4062418"; if (exec) Test4062418(/* par */); break; 1270f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 10: name = "Test4065540"; if (exec) Test4065540(/* par */); break; 1271f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 11: name = "Test4066189"; if (exec) Test4066189(/* par */); break; 1272f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 12: name = "Test4066696"; if (exec) Test4066696(/* par */); break; 1273f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 13: name = "Test4076676"; if (exec) Test4076676(/* par */); break; 1274f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 14: name = "Test4078588"; if (exec) Test4078588(/* par */); break; 1275f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 15: name = "Test4079231"; if (exec) Test4079231(/* par */); break; 1276f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 16: name = "Test4081866"; if (exec) Test4081866(/* par */); break; 1277f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 17: name = "Test4087241"; if (exec) Test4087241(/* par */); break; 1278f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 18: name = "Test4087243"; if (exec) Test4087243(/* par */); break; 1279f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 19: name = "Test4092260"; if (exec) Test4092260(/* par */); break; 1280f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 20: name = "Test4095316"; if (exec) Test4095316(/* par */); break; 1281f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 21: name = "Test4101940"; if (exec) Test4101940(/* par */); break; 1282f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 22: name = "Test4103436"; if (exec) Test4103436(/* par */); break; 1283f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 23: name = "Test4114076"; if (exec) Test4114076(/* par */); break; 1284f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 24: name = "Test4114077"; if (exec) Test4114077(/* par */); break; 1285f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 25: name = "Test4124632"; if (exec) Test4124632(/* par */); break; 1286f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 26: name = "Test4132736"; if (exec) Test4132736(/* par */); break; 1287f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 27: name = "Test4133509"; if (exec) Test4133509(/* par */); break; 1288f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 28: name = "Test4139572"; if (exec) Test4139572(/* par */); break; 1289f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 29: name = "Test4141640"; if (exec) Test4141640(/* par */); break; 1290f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 30: name = "Test4146160"; if (exec) Test4146160(/* par */); break; 1291f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) case 31: name = "TestT7189"; if (exec) TestT7189(); break; 1292f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) default: name = ""; break; 1293f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1294f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } else { 1295f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) dataerrln("Class collator not instantiated"); 1296f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) name = ""; 1297f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) } 1298f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)} 1299f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles) 1300f4ed1cf5d184064c4cf0e4359c6d5d8aadb50afaTorne (Richard Coles)#endif /* #if !UCONFIG_NO_COLLATION */ 1301