| Index: source/test/intltest/ucaconf.cpp
|
| diff --git a/source/test/intltest/ucaconf.cpp b/source/test/intltest/ucaconf.cpp
|
| index e7bee3c5d37c489c7f9408bf91d95b7c595504c6..348415a33e95a9245dccb21ba81d8c47e6faaa44 100644
|
| --- a/source/test/intltest/ucaconf.cpp
|
| +++ b/source/test/intltest/ucaconf.cpp
|
| @@ -1,6 +1,6 @@
|
| /********************************************************************
|
| * COPYRIGHT:
|
| - * Copyright (c) 2002-2012, International Business Machines Corporation and
|
| + * Copyright (c) 2002-2014, International Business Machines Corporation and
|
| * others. All Rights Reserved.
|
| ********************************************************************/
|
|
|
| @@ -15,6 +15,8 @@
|
| #if !UCONFIG_NO_COLLATION
|
|
|
| #include "ucaconf.h"
|
| +#include "unicode/sortkey.h"
|
| +#include "unicode/tblcoll.h"
|
| #include "unicode/ustring.h"
|
| #include "cmemory.h"
|
| #include "cstring.h"
|
| @@ -69,8 +71,8 @@ void UCAConformanceTest::runIndexedTest( int32_t index, UBool exec, const char*
|
| void UCAConformanceTest::initRbUCA()
|
| {
|
| if(!rbUCA) {
|
| - UnicodeString ucarules;
|
| if (UCA) {
|
| + UnicodeString ucarules;
|
| UCA->getRules(UCOL_FULL_RULES, ucarules);
|
| rbUCA = new RuleBasedCollator(ucarules, status);
|
| if (U_FAILURE(status)) {
|
| @@ -142,7 +144,7 @@ void UCAConformanceTest::openTestFile(const char *type)
|
| "INFO: Working with the stub file.\n"
|
| "If you need the full conformance test, please\n"
|
| "download the appropriate data files from:\n"
|
| - "http://source.icu-project.org/repos/icu/tools/trunk/unicodetools/com/ibm/text/data/");
|
| + "http://unicode.org/cldr/trac/browser/trunk/common/uca");
|
| }
|
| }
|
| }
|
| @@ -153,22 +155,11 @@ static const uint32_t FROM_RULES = 2;
|
|
|
| static UBool
|
| skipLineBecauseOfBug(const UChar *s, int32_t length, uint32_t flags) {
|
| - // TODO: Fix ICU ticket #8052
|
| - if(length >= 3 &&
|
| - (s[0] == 0xfb2 || s[0] == 0xfb3) &&
|
| - s[1] == 0x334 &&
|
| - (s[2] == 0xf73 || s[2] == 0xf75 || s[2] == 0xf81)) {
|
| - return TRUE;
|
| - }
|
| - // TODO: Fix ICU ticket #9361
|
| - if((flags & IS_SHIFTED) != 0 && length >= 2 && s[0] == 0xfffe) {
|
| - return TRUE;
|
| - }
|
| - // TODO: Fix tailoring builder, ICU ticket #9593.
|
| - UChar c;
|
| - if((flags & FROM_RULES) != 0 && length >= 2 && ((c = s[1]) == 0xedc || c == 0xedd)) {
|
| - return TRUE;
|
| - }
|
| + // Add temporary exceptions here if there are ICU bugs, until we can fix them.
|
| + // For examples see the ICU 52 version of this file.
|
| + (void)s;
|
| + (void)length;
|
| + (void)flags;
|
| return FALSE;
|
| }
|
|
|
| @@ -190,6 +181,9 @@ void UCAConformanceTest::testConformance(const Collator *coll)
|
| skipFlags |= FROM_RULES;
|
| }
|
|
|
| + logln("-prop:ucaconfnosortkeys=1 turns off getSortKey() in UCAConformanceTest");
|
| + UBool withSortKeys = getProperty("ucaconfnosortkeys") == NULL;
|
| +
|
| int32_t line = 0;
|
|
|
| UChar b1[1024], b2[1024];
|
| @@ -226,22 +220,27 @@ void UCAConformanceTest::testConformance(const Collator *coll)
|
| continue;
|
| }
|
|
|
| - int32_t resLen = coll->getSortKey(buffer, buflen, newSk, 1024);
|
| + int32_t resLen = withSortKeys ? coll->getSortKey(buffer, buflen, newSk, 1024) : 0;
|
|
|
| if(oldSk != NULL) {
|
| - int32_t skres = strcmp((char *)oldSk, (char *)newSk);
|
| + UBool ok=TRUE;
|
| + int32_t skres = withSortKeys ? strcmp((char *)oldSk, (char *)newSk) : 0;
|
| int32_t cmpres = coll->compare(oldB, oldBlen, buffer, buflen, status);
|
| int32_t cmpres2 = coll->compare(buffer, buflen, oldB, oldBlen, status);
|
|
|
| if(cmpres != -cmpres2) {
|
| - errln("Compare result not symmetrical on line %i", line);
|
| + errln("Compare result not symmetrical on line %i: "
|
| + "previous vs. current (%d) / current vs. previous (%d)",
|
| + line, cmpres, cmpres2);
|
| + ok = FALSE;
|
| }
|
|
|
| - if(cmpres != normalizeResult(skres)) {
|
| + // TODO: Compare with normalization turned off if the input passes the FCD test.
|
| +
|
| + if(withSortKeys && cmpres != normalizeResult(skres)) {
|
| errln("Difference between coll->compare (%d) and sortkey compare (%d) on line %i",
|
| cmpres, skres, line);
|
| - errln(" Previous data line %s", oldLineB);
|
| - errln(" Current data line %s", lineB);
|
| + ok = FALSE;
|
| }
|
|
|
| int32_t res = cmpres;
|
| @@ -255,13 +254,19 @@ void UCAConformanceTest::testConformance(const Collator *coll)
|
| }
|
| if(res > 0) {
|
| errln("Line %i is not greater or equal than previous line", line);
|
| + ok = FALSE;
|
| + }
|
| +
|
| + if(!ok) {
|
| errln(" Previous data line %s", oldLineB);
|
| errln(" Current data line %s", lineB);
|
| - UnicodeString oldS, newS;
|
| - prettify(CollationKey(oldSk, oldLen), oldS);
|
| - prettify(CollationKey(newSk, resLen), newS);
|
| - errln(" Previous key: "+oldS);
|
| - errln(" Current key: "+newS);
|
| + if(withSortKeys) {
|
| + UnicodeString oldS, newS;
|
| + prettify(CollationKey(oldSk, oldLen), oldS);
|
| + prettify(CollationKey(newSk, resLen), newS);
|
| + errln(" Previous key: "+oldS);
|
| + errln(" Current key: "+newS);
|
| + }
|
| }
|
| }
|
|
|
| @@ -304,6 +309,7 @@ void UCAConformanceTest::TestTableShifted(/* par */) {
|
| }
|
|
|
| void UCAConformanceTest::TestRulesNonIgnorable(/* par */) {
|
| + if(logKnownIssue("cldrbug:6745", "UCARules.txt has problems")) { return; }
|
| initRbUCA();
|
|
|
| if(U_SUCCESS(status)) {
|
|
|