Lines Matching refs:errorCode
102 UBool readNonEmptyLine(UCHARBUF *f, IcuTestErrorCode &errorCode);
103 … void parseString(int32_t &start, UnicodeString &prefix, UnicodeString &s, UErrorCode &errorCode);
104 Collation::Level parseRelationAndString(UnicodeString &s, IcuTestErrorCode &errorCode);
105 void parseAndSetAttribute(IcuTestErrorCode &errorCode);
106 void parseAndSetReorderCodes(int32_t start, IcuTestErrorCode &errorCode);
107 void buildTailoring(UCHARBUF *f, IcuTestErrorCode &errorCode);
108 void setRootCollator(IcuTestErrorCode &errorCode);
109 void setLocaleCollator(IcuTestErrorCode &errorCode);
111 UBool needsNormalization(const UnicodeString &s, UErrorCode &errorCode) const;
115 IcuTestErrorCode &errorCode);
118 CollationKey &key, IcuTestErrorCode &errorCode);
120 CollationKey &key, IcuTestErrorCode &errorCode);
124 IcuTestErrorCode &errorCode);
125 void checkCompareStrings(UCHARBUF *f, IcuTestErrorCode &errorCode);
159 IcuTestErrorCode errorCode(*this, "TestMinMax"); in TestMinMax() local
161 setRootCollator(errorCode); in TestMinMax()
162 if(errorCode.isFailure()) { in TestMinMax()
163 errorCode.reset(); in TestMinMax()
173 UVector64 ces(errorCode); in TestMinMax()
174 rbc->internalGetCEs(UnicodeString(false, s, 2), ces, errorCode); in TestMinMax()
175 errorCode.assertSuccess(); in TestMinMax()
194 IcuTestErrorCode errorCode(*this, "TestImplicits"); in TestImplicits() local
196 const CollationData *cd = CollationRoot::getData(errorCode); in TestImplicits()
197 if(errorCode.errDataIfFailureAndReset("CollationRoot::getData()")) { in TestImplicits()
209 errorCode); in TestImplicits()
214 errorCode); in TestImplicits()
215 UnicodeSet unassigned("[[:Cn:][:Cs:][:Co:]]", errorCode); in TestImplicits()
225 errorCode); in TestImplicits()
228 if(errorCode.errIfFailureAndReset("UnicodeSet")) { in TestImplicits()
241 int64_t ce = ci.nextCE(errorCode); in TestImplicits()
242 int64_t ce2 = ci.nextCE(errorCode); in TestImplicits()
243 if(errorCode.errIfFailureAndReset("CollationIterator.nextCE()")) { in TestImplicits()
267 IcuTestErrorCode errorCode(*this, "TestNulTerminated"); in TestNulTerminated() local
268 const CollationData *data = CollationRoot::getData(errorCode); in TestNulTerminated()
269 if(errorCode.errDataIfFailureAndReset("CollationRoot::getData()")) { in TestNulTerminated()
278 int64_t ce1 = ci1.nextCE(errorCode); in TestNulTerminated()
279 int64_t ce2 = ci2.nextCE(errorCode); in TestNulTerminated()
280 if(errorCode.errIfFailureAndReset("CollationIterator.nextCE()")) { in TestNulTerminated()
292 IcuTestErrorCode errorCode(*this, "TestIllegalUTF8"); in TestIllegalUTF8() local
294 setRootCollator(errorCode); in TestIllegalUTF8()
295 if(errorCode.isFailure()) { in TestIllegalUTF8()
296 errorCode.reset(); in TestIllegalUTF8()
299 coll->setAttribute(UCOL_STRENGTH, UCOL_IDENTICAL, errorCode); in TestIllegalUTF8()
315 UCollationResult order = coll->compareUTF8(fffd, illegal, errorCode); in TestIllegalUTF8()
339 IcuTestErrorCode errorCode(*this, "TestShortFCDData"); in TestShortFCDData() local
340 UnicodeSet expectedLccc("[:^lccc=0:]", errorCode); in TestShortFCDData()
341 errorCode.assertSuccess(); in TestShortFCDData()
360 UnicodeSet expectedTccc("[:^tccc=0:]", errorCode); in TestShortFCDData()
361 if (errorCode.isSuccess()) { in TestShortFCDData()
395 IcuTestErrorCode errorCode(*this, "checkFCD"); in checkFCD() local
399 UChar32 c1 = ci.nextCodePoint(errorCode); in checkFCD()
411 UChar32 c1 = ci.previousCodePoint(errorCode); in checkFCD()
422 UChar32 c1 = ci.nextCodePoint(errorCode); in checkFCD()
434 UChar32 c1 = ci.previousCodePoint(errorCode); in checkFCD()
446 IcuTestErrorCode errorCode(*this, "TestFCD"); in TestFCD() local
447 const CollationData *data = CollationRoot::getData(errorCode); in TestFCD()
448 if(errorCode.errDataIfFailureAndReset("CollationRoot::getData()")) { in TestFCD()
481 if(errorCode.errIfFailureAndReset("FCDUTF16CollationIterator constructor")) { in TestFCD()
492 if(errorCode.errIfFailureAndReset("FCDUTF8CollationIterator constructor")) { in TestFCD()
501 if(errorCode.errIfFailureAndReset("FCDUIterCollationIterator constructor")) { in TestFCD()
765 IcuTestErrorCode errorCode(*this, "TestRootElements"); in TestRootElements() local
766 const CollationData *root = CollationRoot::getData(errorCode); in TestRootElements()
767 if(errorCode.errDataIfFailureAndReset("CollationRoot::getData()")) { in TestRootElements()
868 IcuTestErrorCode errorCode(*this, "TestTailoredElements"); in TestTailoredElements() local
869 const CollationData *root = CollationRoot::getData(errorCode); in TestTailoredElements()
870 if(errorCode.errDataIfFailureAndReset("CollationRoot::getData()")) { in TestTailoredElements()
875 UHashtable *prevLocales = uhash_open(uhash_hashChars, uhash_compareChars, NULL, errorCode); in TestTailoredElements()
876 if(errorCode.errIfFailureAndReset("failed to create a hash table")) { in TestTailoredElements()
881 uhash_puti(prevLocales, uprv_strdup(""), 1, errorCode); in TestTailoredElements()
882 uhash_puti(prevLocales, uprv_strdup("root"), 1, errorCode); in TestTailoredElements()
883 uhash_puti(prevLocales, uprv_strdup("root@collation=standard"), 1, errorCode); in TestTailoredElements()
885 UVector64 ces(errorCode); in TestTailoredElements()
892 Collator::getKeywordValuesForLocale("collation", locale, false, errorCode)); in TestTailoredElements()
893 errorCode.assertSuccess(); in TestTailoredElements()
895 while((type = types->next(NULL, errorCode)) != NULL) { in TestTailoredElements()
901 localeWithType.setKeywordValue("collation", type, errorCode); in TestTailoredElements()
902 errorCode.assertSuccess(); in TestTailoredElements()
903 LocalPointer<Collator> coll(Collator::createInstance(localeWithType, errorCode)); in TestTailoredElements()
904 if(errorCode.errIfFailureAndReset("Collator::createInstance(%s)", in TestTailoredElements()
908 Locale actual = coll->getLocale(ULOC_ACTUAL_LOCALE, errorCode); in TestTailoredElements()
912 uhash_puti(prevLocales, uprv_strdup(actual.getName()), 1, errorCode); in TestTailoredElements()
913 errorCode.assertSuccess(); in TestTailoredElements()
928 LocalPointer<UnicodeSet> tailored(coll->getTailoredSet(errorCode)); in TestTailoredElements()
929 errorCode.assertSuccess(); in TestTailoredElements()
934 rbc->internalGetCEs(s, ces, errorCode); in TestTailoredElements()
935 errorCode.assertSuccess(); in TestTailoredElements()
946 } while((localeID = locales->next(NULL, errorCode)) != NULL); in TestTailoredElements()
972 UBool CollationTest::readNonEmptyLine(UCHARBUF *f, IcuTestErrorCode &errorCode) { in readNonEmptyLine() argument
975 const UChar *line = ucbuf_readline(f, &lineLength, errorCode); in readNonEmptyLine()
976 if(line == NULL || errorCode.isFailure()) { in readNonEmptyLine()
998 UErrorCode &errorCode) { in parseString() argument
1008 errorCode = U_PARSE_ERROR; in parseString()
1019 errorCode = U_PARSE_ERROR; in parseString()
1025 …ation::Level CollationTest::parseRelationAndString(UnicodeString &s, IcuTestErrorCode &errorCode) { in parseRelationAndString() argument
1064 errorCode.set(U_PARSE_ERROR); in parseRelationAndString()
1069 parseString(start, prefix, s, errorCode); in parseRelationAndString()
1070 if(errorCode.isSuccess() && !prefix.isEmpty()) { in parseRelationAndString()
1073 errorCode.set(U_PARSE_ERROR); in parseRelationAndString()
1079 errorCode.set(U_PARSE_ERROR); in parseRelationAndString()
1117 void CollationTest::parseAndSetAttribute(IcuTestErrorCode &errorCode) { in parseAndSetAttribute() argument
1124 parseAndSetReorderCodes(start + 7, errorCode); in parseAndSetAttribute()
1129 errorCode.set(U_PARSE_ERROR); in parseAndSetAttribute()
1148 errorCode.set(U_PARSE_ERROR); in parseAndSetAttribute()
1152 coll->setMaxVariable(max, errorCode); in parseAndSetAttribute()
1153 if(errorCode.isFailure()) { in parseAndSetAttribute()
1155 (int)fileLineNumber, errorCode.errorName()); in parseAndSetAttribute()
1169 errorCode.set(U_PARSE_ERROR); in parseAndSetAttribute()
1183 errorCode.set(U_PARSE_ERROR); in parseAndSetAttribute()
1193 coll->setAttribute(attr, value, errorCode); in parseAndSetAttribute()
1194 if(errorCode.isFailure()) { in parseAndSetAttribute()
1196 (int)fileLineNumber, errorCode.errorName()); in parseAndSetAttribute()
1204 void CollationTest::parseAndSetReorderCodes(int32_t start, IcuTestErrorCode &errorCode) { in parseAndSetReorderCodes() argument
1205 UVector32 reorderCodes(errorCode); in parseAndSetReorderCodes()
1211 name.appendInvariantChars(fileLine.tempSubStringBetween(start, limit), errorCode); in parseAndSetReorderCodes()
1219 errorCode.set(U_PARSE_ERROR); in parseAndSetReorderCodes()
1223 reorderCodes.addElement(code, errorCode); in parseAndSetReorderCodes()
1227 coll->setReorderCodes(reorderCodes.getBuffer(), reorderCodes.size(), errorCode); in parseAndSetReorderCodes()
1228 if(errorCode.isFailure()) { in parseAndSetReorderCodes()
1230 (int)fileLineNumber, errorCode.errorName()); in parseAndSetReorderCodes()
1238 void CollationTest::buildTailoring(UCHARBUF *f, IcuTestErrorCode &errorCode) { in buildTailoring() argument
1240 while(readNonEmptyLine(f, errorCode) && !isSectionStarter(fileLine[0])) { in buildTailoring()
1243 if(errorCode.isFailure()) { return; } in buildTailoring()
1249 coll = new RuleBasedCollator(rules, parseError, reason, errorCode); in buildTailoring()
1252 errorCode.set(U_MEMORY_ALLOCATION_ERROR); in buildTailoring()
1255 if(errorCode.isFailure()) { in buildTailoring()
1256 dataerrln("RuleBasedCollator(rules) failed - %s", errorCode.errorName()); in buildTailoring()
1265 errorCode.reset(); in buildTailoring()
1272 void CollationTest::setRootCollator(IcuTestErrorCode &errorCode) { in setRootCollator() argument
1273 if(errorCode.isFailure()) { return; } in setRootCollator()
1275 coll = Collator::createInstance(Locale::getRoot(), errorCode); in setRootCollator()
1276 if(errorCode.isFailure()) { in setRootCollator()
1282 void CollationTest::setLocaleCollator(IcuTestErrorCode &errorCode) { in setLocaleCollator() argument
1283 if(errorCode.isFailure()) { return; } in setLocaleCollator()
1291 localeID.appendInvariantChars(fileLine.tempSubString(9), errorCode); in setLocaleCollator()
1296 if(fileLine.length() == 9 || errorCode.isFailure() || locale.isBogus()) { in setLocaleCollator()
1299 if(errorCode.isSuccess()) { errorCode.set(U_PARSE_ERROR); } in setLocaleCollator()
1304 coll = Collator::createInstance(locale, errorCode); in setLocaleCollator()
1305 if(errorCode.isFailure()) { in setLocaleCollator()
1311 errorCode.reset(); in setLocaleCollator()
1315 UBool CollationTest::needsNormalization(const UnicodeString &s, UErrorCode &errorCode) const { in needsNormalization()
1316 if(U_FAILURE(errorCode) || !fcd->isNormalized(s, errorCode)) { return true; } in needsNormalization()
1333 IcuTestErrorCode &errorCode) { in getSortKeyParts() argument
1334 if(errorCode.isFailure()) { return false; } in getSortKeyParts()
1341 int32_t partLength = coll->internalNextSortKeyPart(&iter, state, part, partSize, errorCode); in getSortKeyParts()
1347 dest.append(reinterpret_cast<char *>(part), partLength, errorCode); in getSortKeyParts()
1349 return errorCode.isSuccess(); in getSortKeyParts()
1356 CollationKey &key, IcuTestErrorCode &errorCode) { in getCollationKey() argument
1357 if(errorCode.isFailure()) { return false; } in getCollationKey()
1358 coll->getCollationKey(s, length, key, errorCode); in getCollationKey()
1359 if(errorCode.isFailure()) { in getCollationKey()
1362 norm, errorCode.errorName()); in getCollationKey()
1377 int32_t numLevels = coll->getAttribute(UCOL_STRENGTH, errorCode); in getCollationKey()
1383 if(coll->getAttribute(UCOL_CASE_LEVEL, errorCode) == UCOL_ON) { in getCollationKey()
1386 errorCode.assertSuccess(); in getCollationKey()
1413 if(!getSortKeyParts(s, length, parts, 32, errorCode)) { in getCollationKey()
1416 norm, (int)partSize, errorCode.errorName()); in getCollationKey()
1439 CollationKey &key, IcuTestErrorCode &errorCode) { in getMergedCollationKey() argument
1440 if(errorCode.isFailure()) { return false; } in getMergedCollationKey()
1459 coll->getCollationKey(s + segmentStart, i - segmentStart, key2, errorCode); in getMergedCollationKey()
1550 IcuTestErrorCode &errorCode) { in checkCompareTwo() argument
1551 if(errorCode.isFailure()) { return false; } in checkCompareTwo()
1556 prevKey, errorCode)) { in checkCompareTwo()
1560 … if(!getCollationKey(norm, fileLine, s.getBuffer(), s.length(), key, errorCode)) { return false; } in checkCompareTwo()
1562 UCollationResult order = coll->compare(prevString, s, errorCode); in checkCompareTwo()
1563 if(order != expectedOrder || errorCode.isFailure()) { in checkCompareTwo()
1566 (int)fileLineNumber, norm, order, expectedOrder, errorCode.errorName()); in checkCompareTwo()
1573 order = coll->compare(s, prevString, errorCode); in checkCompareTwo()
1574 if(order != -expectedOrder || errorCode.isFailure()) { in checkCompareTwo()
1577 (int)fileLineNumber, norm, order, -expectedOrder, errorCode.errorName()); in checkCompareTwo()
1587 order = coll->compare(prevString.getBuffer(), -1, s.getBuffer(), -1, errorCode); in checkCompareTwo()
1588 if(order != expectedOrder || errorCode.isFailure()) { in checkCompareTwo()
1591 (int)fileLineNumber, norm, order, expectedOrder, errorCode.errorName()); in checkCompareTwo()
1598 order = coll->compare(s.getBuffer(), -1, prevString.getBuffer(), -1, errorCode); in checkCompareTwo()
1599 if(order != -expectedOrder || errorCode.isFailure()) { in checkCompareTwo()
1602 (int)fileLineNumber, norm, order, -expectedOrder, errorCode.errorName()); in checkCompareTwo()
1625 expectedUTF8Order = coll->compare(prevValid, sValid, errorCode); in checkCompareTwo()
1628 order = coll->compareUTF8(prevUTF8, sUTF8, errorCode); in checkCompareTwo()
1629 if(order != expectedUTF8Order || errorCode.isFailure()) { in checkCompareTwo()
1632 (int)fileLineNumber, norm, order, expectedUTF8Order, errorCode.errorName()); in checkCompareTwo()
1639 order = coll->compareUTF8(sUTF8, prevUTF8, errorCode); in checkCompareTwo()
1640 if(order != -expectedUTF8Order || errorCode.isFailure()) { in checkCompareTwo()
1643 (int)fileLineNumber, norm, order, -expectedUTF8Order, errorCode.errorName()); in checkCompareTwo()
1652 order = coll->internalCompareUTF8(prevUTF8.c_str(), -1, sUTF8.c_str(), -1, errorCode); in checkCompareTwo()
1653 if(order != expectedUTF8Order || errorCode.isFailure()) { in checkCompareTwo()
1656 (int)fileLineNumber, norm, order, expectedUTF8Order, errorCode.errorName()); in checkCompareTwo()
1663 order = coll->internalCompareUTF8(sUTF8.c_str(), -1, prevUTF8.c_str(), -1, errorCode); in checkCompareTwo()
1664 if(order != -expectedUTF8Order || errorCode.isFailure()) { in checkCompareTwo()
1667 (int)fileLineNumber, norm, order, -expectedUTF8Order, errorCode.errorName()); in checkCompareTwo()
1680 order = coll->compare(leftIter, rightIter, errorCode); in checkCompareTwo()
1681 if(order != expectedOrder || errorCode.isFailure()) { in checkCompareTwo()
1685 (int)fileLineNumber, norm, order, expectedOrder, errorCode.errorName()); in checkCompareTwo()
1693 order = prevKey.compareTo(key, errorCode); in checkCompareTwo()
1694 if(order != expectedOrder || errorCode.isFailure()) { in checkCompareTwo()
1697 (int)fileLineNumber, norm, order, expectedOrder, errorCode.errorName()); in checkCompareTwo()
1704 UBool collHasCaseLevel = coll->getAttribute(UCOL_CASE_LEVEL, errorCode) == UCOL_ON; in checkCompareTwo()
1727 if((getMergedCollationKey(prevString.getBuffer(), prevString.length(), prevKey, errorCode) | in checkCompareTwo()
1728 getMergedCollationKey(s.getBuffer(), s.length(), key, errorCode)) || in checkCompareTwo()
1729 errorCode.isFailure()) { in checkCompareTwo()
1730 order = prevKey.compareTo(key, errorCode); in checkCompareTwo()
1731 if(order != expectedOrder || errorCode.isFailure()) { in checkCompareTwo()
1735 (int)fileLineNumber, norm, order, expectedOrder, errorCode.errorName()); in checkCompareTwo()
1760 void CollationTest::checkCompareStrings(UCHARBUF *f, IcuTestErrorCode &errorCode) { in checkCompareStrings() argument
1761 if(errorCode.isFailure()) { return; } in checkCompareStrings()
1765 while(readNonEmptyLine(f, errorCode) && !isSectionStarter(fileLine[0])) { in checkCompareStrings()
1768 Collation::Level relation = parseRelationAndString(s, errorCode); in checkCompareStrings()
1769 if(errorCode.isFailure()) { in checkCompareStrings()
1770 errorCode.reset(); in checkCompareStrings()
1783 if(!needsNormalization(prevString, errorCode) && !needsNormalization(s, errorCode)) { in checkCompareStrings()
1784 coll->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, errorCode); in checkCompareStrings()
1786 expectedOrder, expectedLevel, errorCode); in checkCompareStrings()
1789 coll->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, errorCode); in checkCompareStrings()
1791 expectedOrder, expectedLevel, errorCode); in checkCompareStrings()
1793 … if(isOk && (!nfd->isNormalized(prevString, errorCode) || !nfd->isNormalized(s, errorCode))) { in checkCompareStrings()
1794 UnicodeString pn = nfd->normalize(prevString, errorCode); in checkCompareStrings()
1795 UnicodeString n = nfd->normalize(s, errorCode); in checkCompareStrings()
1798 errorCode.assertSuccess(); in checkCompareStrings()
1800 expectedOrder, expectedLevel, errorCode); in checkCompareStrings()
1803 errorCode.reset(); // already reported in checkCompareStrings()
1812 IcuTestErrorCode errorCode(*this, "TestDataDriven"); in TestDataDriven() local
1814 fcd = Normalizer2Factory::getFCDInstance(errorCode); in TestDataDriven()
1815 nfd = Normalizer2::getNFDInstance(errorCode); in TestDataDriven()
1816 …if(errorCode.errDataIfFailureAndReset("Normalizer2Factory::getFCDInstance() or getNFDInstance()"))… in TestDataDriven()
1820 CharString path(getSourceTestData(errorCode), errorCode); in TestDataDriven()
1821 path.appendPathPart("collationtest.txt", errorCode); in TestDataDriven()
1823 LocalUCHARBUFPointer f(ucbuf_open(path.data(), &codePage, true, false, errorCode)); in TestDataDriven()
1824 if(errorCode.errIfFailureAndReset("ucbuf_open(collationtest.txt)")) { in TestDataDriven()
1829 …while(errorCode.isSuccess() && (!fileLine.isEmpty() || readNonEmptyLine(f.getAlias(), errorCode)))… in TestDataDriven()
1840 setRootCollator(errorCode); in TestDataDriven()
1843 setLocaleCollator(errorCode); in TestDataDriven()
1846 buildTailoring(f.getAlias(), errorCode); in TestDataDriven()
1848 parseAndSetAttribute(errorCode); in TestDataDriven()
1850 checkCompareStrings(f.getAlias(), errorCode); in TestDataDriven()
1860 IcuTestErrorCode errorCode(*this, "TestLongLocale"); in TestLongLocale() local
1864 LocalPointer<Collator> coll(Collator::createInstance(longLocale, errorCode)); in TestLongLocale()
1868 IcuTestErrorCode errorCode(*this, "TestBuilderContextsOverflow"); in TestBuilderContextsOverflow() local
1889 LocalPointer<Collator> coll(new RuleBasedCollator(s, errorCode), errorCode); in TestBuilderContextsOverflow()
1890 if(errorCode.isSuccess()) { in TestBuilderContextsOverflow()