Lines Matching refs:Collator
61 * Test Collator::createInstance(... version...) for some locale. Called by TestProperty().
66 Collator *collator1, *collator2;
70 collator1=Collator::createInstance(locale, errorCode);
77 collator2=Collator::createInstance(locale, version1, errorCode);
81 test.errln("error: Collator::createInstance(\"%s\", (%s collator)->getVersion()) returns a different collator\n", locale.getName(), locale.getName());
85 test.errln("error: Collator::createInstance(\"%s\", (%s collator)->getVersion()) fails: %s\n", locale.getName(), locale.getName(), u_errorName(errorCode));
91 // Collator Class Properties
98 Collator *col = 0;
100 * Expected version of the English collator.
114 col = Collator::createInstance(Locale::getEnglish(), success);
116 errcheckln(success, "Default Collator creation failed. - %s", u_errorName(success));
131 errln("Testing Collator::getVersion() - unexpected result: %02x.%02x.%02x.%02x",
134 logln("Collator::getVersion() result: %02x.%02x.%02x.%02x",
138 doAssert((col->compare("ab", "abc") == Collator::LESS), "ab < abc comparison failed");
139 doAssert((col->compare("ab", "AB") == Collator::LESS), "ab < AB comparison failed");
140 doAssert((col->compare("blackbird", "black-bird") == Collator::GREATER), "black-bird > blackbird comparison failed");
141 doAssert((col->compare("black bird", "black-bird") == Collator::LESS), "black bird > black-bird comparison failed");
142 doAssert((col->compare("Hello", "hello") == Collator::GREATER), "Hello > hello comparison failed");
158 doAssert((col->compare("ab", "abc", 2) == Collator::EQUAL), "ab = abc with length 2 comparison failed");
159 doAssert((col->compare("ab", "AB", 2) == Collator::LESS), "ab < AB with length 2 comparison failed");
160 doAssert((col->compare("ab", "Aa", 1) == Collator::LESS), "ab < Aa with length 1 comparison failed");
161 doAssert((col->compare("ab", "Aa", 2) == Collator::GREATER), "ab > Aa with length 2 comparison failed");
162 doAssert((col->compare("black-bird", "blackbird", 5) == Collator::EQUAL), "black-bird = blackbird with length of 5 comparison failed");
163 doAssert((col->compare("black bird", "black-bird", 10) == Collator::LESS), "black bird < black-bird with length 10 comparison failed");
164 doAssert((col->compare("Hello", "hello", 5) == Collator::GREATER), "Hello > hello with length 5 comparison failed");
169 logln("testing Collator::getStrength() method ...");
170 doAssert((col->getStrength() == Collator::TERTIARY), "collation object has the wrong strength");
171 doAssert((col->getStrength() != Collator::PRIMARY), "collation object's strength is primary difference");
174 logln("testing Collator::setStrength() method ...");
175 col->setStrength(Collator::SECONDARY);
176 doAssert((col->getStrength() != Collator::TERTIARY), "collation object's strength is secondary difference");
177 doAssert((col->getStrength() != Collator::PRIMARY), "collation object's strength is primary difference");
178 doAssert((col->getStrength() == Collator::SECONDARY), "collation object has the wrong strength");
183 logln(Collator::getDisplayName(Locale::getUS(), Locale::getGerman(), name));
187 logln(Collator::getDisplayName(Locale::getUS(), Locale::getEnglish(), name));
193 logln(Collator::getDisplayName(Locale::US, name));
202 RuleBasedCollator *rcol = (RuleBasedCollator *)Collator::createInstance("da_DK",
209 col = Collator::createInstance(Locale::getFrench(), success);
216 col->setStrength(Collator::PRIMARY);
217 logln("testing Collator::getStrength() method again ...");
218 doAssert((col->getStrength() != Collator::TERTIARY), "collation object has the wrong strength");
219 doAssert((col->getStrength() == Collator::PRIMARY), "collation object's strength is not primary difference");
221 logln("testing French Collator::setStrength() method ...");
222 col->setStrength(Collator::TERTIARY);
223 doAssert((col->getStrength() == Collator::TERTIARY), "collation object's strength is not tertiary difference");
224 doAssert((col->getStrength() != Collator::PRIMARY), "collation object's strength is primary difference");
225 doAssert((col->getStrength() != Collator::SECONDARY), "collation object's strength is secondary difference");
230 Collator *junk = 0;
231 junk = Collator::createInstance(abcd, success);
241 col = Collator::createInstance(success);
244 errln("Creating default collator failed.");
251 Collator *frCol = Collator::createInstance(Locale::getCanadaFrench(), success);
254 errln("Creating fr_CA collator failed.");
263 doAssert((*frCol != *junk), "The junk is the same as the fr_CA collator.");
265 Collator *aFrCol = frCol->clone();
266 doAssert((*frCol == *aFrCol), "The cloning of a fr_CA collator failed.");
267 logln("Collator property test ended.");
275 /* test Collator::createInstance(...version...) */
286 col=Collator::createInstance(Locale(), versionArray, success);
305 errcheckln(status, "RuleBased Collator creation failed. - %s", u_errorName(status));
309 logln("PASS: RuleBased Collator creation passed\n");
315 errln("RuleBased Collator creation failed.\n");
319 logln("PASS: RuleBased Collator creation passed\n");
324 col3 = (RuleBasedCollator *)Collator::createInstance(locale, status);
326 errln("Fallback Collator creation failed.: %s\n");
330 logln("PASS: Fallback Collator creation passed\n");
335 col3 = (RuleBasedCollator *)Collator::createInstance(status);
337 errln("Default Collator creation failed.: %s\n");
341 logln("PASS: Default Collator creation passed\n");
348 doAssert(rule1 != rule2, "Default collator getRules failed");
349 doAssert(rule2 != rule3, "Default collator getRules failed");
350 doAssert(rule1 != rule3, "Default collator getRules failed");
354 errln("RuleBased Collator creation failed.\n");
359 doAssert(rule2 == rule4, "Default collator getRules failed");
384 coll = (RuleBasedCollator *)Collator::createInstance(Locale::getEnglish(), status);
386 errcheckln(status, "English Collator creation failed. - %s", u_errorName(status));
390 logln("PASS: RuleBased Collator creation passed\n");
408 Collator *en_US = Collator::createInstance("en_US", status),
409 *el_GR = Collator::createInstance("el_GR", status),
410 *vi_VN = Collator::createInstance("vi_VN", status);
441 Collator *someCollators [CLONETEST_COLLATOR_COUNT];
442 Collator *col;
449 /* one default collator & two complex ones */
450 someCollators[0] = Collator::createInstance("en_US", err);
451 someCollators[1] = Collator::createInstance("ko", err);
452 someCollators[2] = Collator::createInstance("ja_JP", err);
467 errln("SafeClone of collator should not return null\n");
470 col->setStrength(Collator::TERTIARY);
471 someCollators[index]->setStrength(Collator::PRIMARY);
487 Collator *col1 = 0;
488 col1 = Collator::createInstance(Locale::getEnglish(), success);
495 Collator *col2 = 0;
497 col2 = Collator::createInstance(dk, success);
504 Collator *col3 = 0;
505 col3 = Collator::createInstance(Locale::getEnglish(), success);
512 logln("Collator::hashCode() testing ...");
545 Collator *col = 0;
547 col = Collator::createInstance(Locale::getEnglish(), success);
553 col->setStrength(Collator::TERTIARY);
577 == Collator::GREATER,
590 doAssert(sortk1.compareTo(sortk3) == Collator::GREATER, "Result should be \"Abcda\" >>> \"abcda\"");
591 doAssert(sortk2.compareTo(sortk3) == Collator::EQUAL, "Result should be \"abcda\" == \"abcda\"");
592 doAssert(sortkEmpty.compareTo(sortk1) == Collator::LESS, "Result should be (empty key) <<< \"Abcda\"");
593 doAssert(sortk1.compareTo(sortkEmpty) == Collator::GREATER, "Result should be \"Abcda\" >>> (empty key)");
594 doAssert(sortkEmpty.compareTo(sortkEmpty) == Collator::EQUAL, "Result should be (empty key) == (empty key)");
615 doAssert(sortk1.compareTo(sortk4) == Collator::EQUAL, "CollationKey::toByteArray(sortk1) Failed.");
616 doAssert(sortk2.compareTo(sortk5) == Collator::EQUAL, "CollationKey::toByteArray(sortk2) Failed.");
617 doAssert(sortk4.compareTo(sortk5) == Collator::GREATER, "sortk4 >>> sortk5 Failed");
618 doAssert(sortk1.compareTo(sortk6) == Collator::EQUAL, "CollationKey::getByteArray(sortk1) Failed.");
619 doAssert(sortk2.compareTo(sortk7) == Collator::EQUAL, "CollationKey::getByteArray(sortk2) Failed.");
620 doAssert(sortk6.compareTo(sortk7) == Collator::GREATER, "sortk6 >>> sortk7 Failed");
638 col->setStrength(Collator::SECONDARY);
641 == Collator::EQUAL,
654 Collator *col = 0;
656 col = Collator::createInstance(Locale::getEnglish(), success);
812 Collator *colerror=NULL;
813 colerror=Collator::createInstance(Locale::getEnglish(), success);
865 doAssert((*col1 == *col2), "Collator objects not equal after assignment (operator=)");
868 Collator *col3 = Collator::createInstance(Locale::getEnglish(), success);
874 Collator* col4 = col1->clone();
875 Collator* col5 = col3->clone();
887 doAssert((((RuleBasedCollator*)col3)->getRules() == col6->getRules()), "Default collator getRules failed");
890 RuleBasedCollator *col7 = new RuleBasedCollator(ruleset2, Collator::TERTIARY, success);
902 RuleBasedCollator *col9 = new RuleBasedCollator(ruleset2, Collator::PRIMARY, UCOL_ON, success);
928 Collator *col1 = Collator::createInstance(Locale::getEnglish(), status);
930 logln("Default collator creation failed.");
933 Collator *col2 = col1->clone();
980 Collator *col = 0;
982 col = Collator::createInstance(Locale::getEnglish(), success);
994 col->setStrength(Collator::SECONDARY);
1001 col->setStrength(Collator::PRIMARY);
1014 doAssert((col->compare(test1, test2) == Collator::EQUAL), "Problem");
1016 doAssert((col->compare(t1, t1Len, t2, t2Len) == Collator::EQUAL), "Problem");
1018 doAssert((col->compare(test1, test2, t1Len) == Collator::EQUAL), "Problem");
1022 doAssert((col->compare(test1, test2) == Collator::GREATER), "Problem");
1024 doAssert((col->compare(t1, t1Len, t2, t2Len) == Collator::GREATER), "Problem");
1026 doAssert((col->compare(test1, test2, t1Len) == Collator::GREATER), "Problem");
1041 logln("Trying Collator::getAvailableLocales(int&)");
1043 const Locale* list = Collator::getAvailableLocales(count1);
1056 logln("Trying Collator::getAvailableLocales()");
1057 StringEnumeration* localeEnum = Collator::getAvailableLocales();
1076 logln("Trying Collator::getAvailableLocales() clone");
1104 Collator *col = Collator::createInstance(Locale::getEnglish(), status);
1110 if (col->getStrength() != Collator::TERTIARY)
1137 doAssert(key1.compareTo(key2) == Collator::GREATER,
1139 doAssert(key2.compareTo(key1) == Collator::LESS,
1141 doAssert(key2.compareTo(key3) == Collator::EQUAL,
1196 col->setStrength(Collator::SECONDARY);
1202 doAssert(key1.compareTo(key2) == Collator::EQUAL,
1204 doAssert(key2.compareTo(key3) == Collator::EQUAL,
1259 LocalPointer<Collator> col(Collator::createInstance(Locale::getEnglish(), errorCode));
1260 if (errorCode.logDataIfFailureAndReset("Collator::createInstance(English) failed")) {
1317 errcheckln(status, "Collator creation failed with error %s", u_errorName(status));
1426 Collator *coll = Collator::createInstance("en_US", error);
1428 errcheckln(error, "Failure creating english collator - %s", u_errorName(error));
1450 Collator *coll = Collator::createInstance(error);
1453 errcheckln(error, "Creation of default collator failed - %s", u_errorName(error));
1555 Collator *coll = Collator::createInstance(status);
1558 errcheckln(status, "Collator creation failed with error %s", u_errorName(status));
1589 Collator *coll = NULL;
1610 coll = Collator::createInstance(testStruct[i].requestedLocale, status);
1612 log("Failed to open collator for %s with %s\n", testStruct[i].requestedLocale, u_errorName(status));
1631 /* completely non-existant locale for collator should get a default collator */
1633 Collator *defaultColl = Collator::createInstance((const Locale)NULL, status);
1634 coll = Collator::createInstance("blahaha", status);
1636 log("Failed to open collator with %s\n", u_errorName(status));
1646 log("Valid locale for nonexisting locale locale collator differs "
1647 "from valid locale for default collator\n");
1651 log("Actual locale for nonexisting locale locale collator differs "
1652 "from actual locale for default collator\n");
1660 /* collator instantiated from rules should have all three locales NULL */
1664 log("For collator instantiated from rules, requested locale %s is not bogus\n", locale.getName());
1668 log("For collator instantiated from rules, valid locale %s is not bogus\n", locale.getName());
1672 log("For collator instantiated from rules, actual locale %s is not bogus\n", locale.getName());
1695 Collator *coll = Collator::createInstance(Locale("sh"), status);
1698 errcheckln(status, "Collator creation failed with %s", u_errorName(status));
1859 errcheckln(status, "Couldn't open collator with rules %s - %s", setTest[i].rules, u_errorName(status));
1873 = (RuleBasedCollator *)Collator::createInstance(status);
1876 errcheckln(status, "Collator creation failed with %s", u_errorName(status));
1907 class TestCollator : public Collator
1910 virtual Collator* clone(void) const;
1912 using Collator::compare;
1955 virtual UBool operator==(const Collator& other) const;
1956 // Collator::operator!= calls !Collator::operator== which works for all subclasses.
1958 TestCollator() : Collator() {};
1960 UNormalizationMode decompositionMode) : Collator(collationStrength, decompositionMode) {};
1963 inline UBool TestCollator::operator==(const Collator& other) const {
1969 // if (!Collator::operator==(other)) { return FALSE; } // not the same class
1975 Collator* TestCollator::clone() const
2068 Collator::ECollationStrength TestCollator::getStrength() const
2073 void TestCollator::setStrength(Collator::ECollationStrength newStrength)
2150 return Collator::getTailoredSet(status);
2155 Collator::setLocales(requestedLocale, validLocale, actualLocale);
2197 col1.getDisplayName(loc1, loc2, displayName); // de_DE collator in fr_FR locale
2202 Collator::EComparisonResult result = Collator::EComparisonResult(a.compare(b));
2204 errln("Collator doesn't give default result");
2207 errln("Collator doesn't give default result");
2210 errln("Collator doesn't give default result");
2224 errcheckln(status, "Failed to open collator - %s", u_errorName(status));
2237 RuleBasedCollator* c0 = (RuleBasedCollator*)Collator::createInstance(status);
2240 errcheckln(status, "Collator::CreateInstance(status) failed with %s", u_errorName(status));
2244 c0->setStrength(Collator::TERTIARY);
2248 RuleBasedCollator* c1 = (RuleBasedCollator*)Collator::createInstance(status);
2249 c1->setStrength(Collator::TERTIARY);
2268 errln("set and get attributes of collator failed. %s\n", u_errorName(status));