ICU-2222 fix breaking changes

X-SVN-Rev: 11357
This commit is contained in:
GCL Shanghai 2003-03-19 13:21:51 +00:00
parent bd3d5f0969
commit 2de3bade18
37 changed files with 313 additions and 310 deletions

View File

@ -507,9 +507,12 @@ Calendar::complete(UErrorCode& status)
// ------------------------------------- // -------------------------------------
int32_t Calendar::fieldDifference(UDate when, EDateFields field, UErrorCode& status) { int32_t Calendar::fieldDifference(UDate when, EDateFields field, UErrorCode& status) {
return fieldDifference(when, (UCalendarDateFields) field, status); return fieldDifference(when, (UCalendarDateFields) field, status);
} }
int32_t Calendar::fieldDifference(UDate targetMs, UCalendarDateFields field, UErrorCode& ec) { int32_t Calendar::fieldDifference(UDate targetMs, UCalendarDateFields field, UErrorCode& ec) {
if (U_FAILURE(ec)) return 0; if (U_FAILURE(ec)) return 0;
int32_t min = 0; int32_t min = 0;
@ -670,10 +673,10 @@ Calendar::setFirstDayOfWeek(UCalendarDaysOfWeek value)
// ------------------------------------- // -------------------------------------
UCalendarDaysOfWeek Calendar::EDaysOfWeek
Calendar::getFirstDayOfWeek() const Calendar::getFirstDayOfWeek() const
{ {
return fFirstDayOfWeek; return (Calendar::EDaysOfWeek)fFirstDayOfWeek;
} }
// ------------------------------------- // -------------------------------------

View File

@ -177,7 +177,7 @@ CollationKey::operator=(const CollationKey& other)
// NOTE: this is somewhat messy 'cause we can't count // NOTE: this is somewhat messy 'cause we can't count
// on memcmp returning the exact values which match // on memcmp returning the exact values which match
// Collator::EComparisonResult // Collator::EComparisonResult
UCollationResult Collator::EComparisonResult
CollationKey::compareTo(const CollationKey& target) const CollationKey::compareTo(const CollationKey& target) const
{ {
uint8_t *src = this->fBytes; uint8_t *src = this->fBytes;
@ -185,7 +185,7 @@ CollationKey::compareTo(const CollationKey& target) const
// are we comparing the same string // are we comparing the same string
if (src == tgt) if (src == tgt)
return UCOL_EQUAL; return Collator::EQUAL;
/* /*
int count = (this->fCount < target.fCount) ? this->fCount : target.fCount; int count = (this->fCount < target.fCount) ? this->fCount : target.fCount;
@ -208,32 +208,32 @@ CollationKey::compareTo(const CollationKey& target) const
*/ */
int minLength; int minLength;
UCollationResult result; Collator::EComparisonResult result;
// are we comparing different lengths? // are we comparing different lengths?
if (this->fCount != target.fCount) { if (this->fCount != target.fCount) {
if (this->fCount < target.fCount) { if (this->fCount < target.fCount) {
minLength = this->fCount; minLength = this->fCount;
result = UCOL_LESS; result = Collator::LESS;
} }
else { else {
minLength = target.fCount; minLength = target.fCount;
result = UCOL_GREATER; result = Collator::GREATER;
} }
} }
else { else {
minLength = target.fCount; minLength = target.fCount;
result = UCOL_EQUAL; result = Collator::EQUAL;
} }
if (minLength > 0) { if (minLength > 0) {
int diff = uprv_memcmp(src, tgt, minLength); int diff = uprv_memcmp(src, tgt, minLength);
if (diff > 0) { if (diff > 0) {
return UCOL_GREATER; return Collator::GREATER;
} }
else else
if (diff < 0) { if (diff < 0) {
return UCOL_LESS; return Collator::LESS;
} }
} }

View File

@ -342,7 +342,7 @@ void RuleBasedCollator::getVersion(UVersionInfo versionInfo) const
} }
} }
UCollationResult RuleBasedCollator::compare( Collator::EComparisonResult RuleBasedCollator::compare(
const UnicodeString& source, const UnicodeString& source,
const UnicodeString& target, const UnicodeString& target,
int32_t length) const int32_t length) const
@ -350,20 +350,20 @@ UCollationResult RuleBasedCollator::compare(
return compare(source.getBuffer(), uprv_min(length,source.length()), target.getBuffer(), uprv_min(length,target.length())); return compare(source.getBuffer(), uprv_min(length,source.length()), target.getBuffer(), uprv_min(length,target.length()));
} }
UCollationResult RuleBasedCollator::compare(const UChar* source, Collator::EComparisonResult RuleBasedCollator::compare(const UChar* source,
int32_t sourceLength, int32_t sourceLength,
const UChar* target, const UChar* target,
int32_t targetLength) int32_t targetLength)
const const
{ {
return ucol_strcoll(ucollator, source, sourceLength, return getEComparisonResult(ucol_strcoll(ucollator, source, sourceLength,
target, targetLength); target, targetLength));
} }
/** /**
* Compare two strings using this collator * Compare two strings using this collator
*/ */
UCollationResult RuleBasedCollator::compare( Collator::EComparisonResult RuleBasedCollator::compare(
const UnicodeString& source, const UnicodeString& source,
const UnicodeString& target) const const UnicodeString& target) const
{ {

View File

@ -790,7 +790,7 @@ public:
* @return The first day of the week. * @return The first day of the week.
* @stable ICU 2.0 * @stable ICU 2.0
*/ */
UCalendarDaysOfWeek getFirstDayOfWeek(void) const; EDaysOfWeek getFirstDayOfWeek(void) const;
/** /**
* Sets what the minimal days required in the first week of the year are; For * Sets what the minimal days required in the first week of the year are; For

View File

@ -328,7 +328,7 @@ public:
* than target * than target
* @stable ICU 2.0 * @stable ICU 2.0
**/ **/
virtual UCollationResult compare(const UnicodeString& source, virtual EComparisonResult compare(const UnicodeString& source,
const UnicodeString& target) const = 0; const UnicodeString& target) const = 0;
/** /**
@ -343,7 +343,7 @@ public:
* length) is less than target. * length) is less than target.
* @stable ICU 2.0 * @stable ICU 2.0
*/ */
virtual UCollationResult compare(const UnicodeString& source, virtual EComparisonResult compare(const UnicodeString& source,
const UnicodeString& target, const UnicodeString& target,
int32_t length) const = 0; int32_t length) const = 0;
@ -362,7 +362,7 @@ public:
* target * target
* @stable ICU 2.0 * @stable ICU 2.0
*/ */
virtual UCollationResult compare(const UChar* source, int32_t sourceLength, virtual EComparisonResult compare(const UChar* source, int32_t sourceLength,
const UChar* target, int32_t targetLength) const UChar* target, int32_t targetLength)
const = 0; const = 0;

View File

@ -183,7 +183,7 @@ public:
* otherwise. * otherwise.
* @stable ICU 2.0 * @stable ICU 2.0
*/ */
UCollationResult compareTo(const CollationKey& target) const; Collator::EComparisonResult compareTo(const CollationKey& target) const;
/** /**
* Creates an integer that is unique to the collation key. NOTE: this * Creates an integer that is unique to the collation key. NOTE: this

View File

@ -248,7 +248,7 @@ public:
* target. Otherwise, returns EQUAL. * target. Otherwise, returns EQUAL.
* @stable ICU 2.0 * @stable ICU 2.0
*/ */
virtual UCollationResult compare(const UnicodeString& source, virtual EComparisonResult compare(const UnicodeString& source,
const UnicodeString& target) const; const UnicodeString& target) const;
@ -265,7 +265,7 @@ public:
* target. Otherwise, returns EQUAL. * target. Otherwise, returns EQUAL.
* @stable ICU 2.0 * @stable ICU 2.0
*/ */
virtual UCollationResult compare(const UnicodeString& source, virtual EComparisonResult compare(const UnicodeString& source,
const UnicodeString& target, const UnicodeString& target,
int32_t length) const; int32_t length) const;
@ -302,7 +302,7 @@ public:
* target * target
* @stable ICU 2.2 * @stable ICU 2.2
*/ */
virtual UCollationResult compare(const UChar* source, int32_t sourceLength, virtual EComparisonResult compare(const UChar* source, int32_t sourceLength,
const UChar* target, int32_t targetLength) const UChar* target, int32_t targetLength)
const; const;

View File

@ -49,46 +49,46 @@ CollationDummyTest::~CollationDummyTest()
delete myCollation; delete myCollation;
} }
const UCollationResult CollationDummyTest::results[] = { const Collator::EComparisonResult CollationDummyTest::results[] = {
UCOL_LESS, Collator::LESS,
UCOL_LESS, /*Collator::GREATER,*/ Collator::LESS, /*Collator::GREATER,*/
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, /* 10 */ Collator::LESS, /* 10 */
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
/* test primary > 17 */ /* test primary > 17 */
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, /* 20 */ Collator::EQUAL, /* 20 */
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
UCOL_LESS, Collator::LESS,
/* test secondary > 26 */ /* test secondary > 26 */
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, /* 30 */ Collator::EQUAL, /* 30 */
UCOL_EQUAL, Collator::EQUAL,
UCOL_LESS, Collator::LESS,
UCOL_EQUAL, /* 34 */ Collator::EQUAL, /* 34 */
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
UCOL_LESS Collator::LESS
}; };
@ -138,7 +138,7 @@ void CollationDummyTest::TestExtra(/* char* par */)
{ {
for (j = i + 1; j < COUNT_TEST_CASES; j += 1) for (j = i + 1; j < COUNT_TEST_CASES; j += 1)
{ {
doTest(myCollation, testCases[i], testCases[j], UCOL_LESS); doTest(myCollation, testCases[i], testCases[j], Collator::LESS);
} }
} }
} }
@ -166,7 +166,7 @@ void CollationDummyTest::TestJB581(void)
return; return;
} }
UCollationResult result = coll->compare(source, target); Collator::EComparisonResult result = coll->compare(source, target);
/* result is 1, secondary differences only for ignorable space characters*/ /* result is 1, secondary differences only for ignorable space characters*/
if (result != 1) if (result != 1)
{ {

View File

@ -47,7 +47,7 @@ public:
void TestJB581(); void TestJB581();
private: private:
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
RuleBasedCollator *myCollation; RuleBasedCollator *myCollation;
}; };

View File

@ -119,21 +119,21 @@ CollationAPITest::TestProperty(/* char* par */)
} }
} }
doAssert((col->compare("ab", "abc") == UCOL_LESS), "ab < abc comparison failed"); doAssert((col->compare("ab", "abc") == Collator::LESS), "ab < abc comparison failed");
doAssert((col->compare("ab", "AB") == UCOL_LESS), "ab < AB comparison failed"); doAssert((col->compare("ab", "AB") == Collator::LESS), "ab < AB comparison failed");
doAssert((col->compare("blackbird", "black-bird") == UCOL_GREATER), "black-bird > blackbird comparison failed"); doAssert((col->compare("blackbird", "black-bird") == Collator::GREATER), "black-bird > blackbird comparison failed");
doAssert((col->compare("black bird", "black-bird") == UCOL_LESS), "black bird > black-bird comparison failed"); doAssert((col->compare("black bird", "black-bird") == Collator::LESS), "black bird > black-bird comparison failed");
doAssert((col->compare("Hello", "hello") == UCOL_GREATER), "Hello > hello comparison failed"); doAssert((col->compare("Hello", "hello") == Collator::GREATER), "Hello > hello comparison failed");
/*start of update [Bertrand A. D. 02/10/98]*/ /*start of update [Bertrand A. D. 02/10/98]*/
doAssert((col->compare("ab", "abc", 2) == UCOL_EQUAL), "ab = abc with length 2 comparison failed"); doAssert((col->compare("ab", "abc", 2) == Collator::EQUAL), "ab = abc with length 2 comparison failed");
doAssert((col->compare("ab", "AB", 2) == UCOL_LESS), "ab < AB with length 2 comparison failed"); doAssert((col->compare("ab", "AB", 2) == Collator::LESS), "ab < AB with length 2 comparison failed");
doAssert((col->compare("ab", "Aa", 1) == UCOL_LESS), "ab < Aa with length 1 comparison failed"); doAssert((col->compare("ab", "Aa", 1) == Collator::LESS), "ab < Aa with length 1 comparison failed");
doAssert((col->compare("ab", "Aa", 2) == UCOL_GREATER), "ab > Aa with length 2 comparison failed"); doAssert((col->compare("ab", "Aa", 2) == Collator::GREATER), "ab > Aa with length 2 comparison failed");
doAssert((col->compare("black-bird", "blackbird", 5) == UCOL_EQUAL), "black-bird = blackbird with length of 5 comparison failed"); doAssert((col->compare("black-bird", "blackbird", 5) == Collator::EQUAL), "black-bird = blackbird with length of 5 comparison failed");
doAssert((col->compare("black bird", "black-bird", 10) == UCOL_LESS), "black bird < black-bird with length 10 comparison failed"); doAssert((col->compare("black bird", "black-bird", 10) == Collator::LESS), "black bird < black-bird with length 10 comparison failed");
doAssert((col->compare("Hello", "hello", 5) == UCOL_GREATER), "Hello > hello with length 5 comparison failed"); doAssert((col->compare("Hello", "hello", 5) == Collator::GREATER), "Hello > hello with length 5 comparison failed");
/*end of update [Bertrand A. D. 02/10/98]*/ /*end of update [Bertrand A. D. 02/10/98]*/
@ -552,7 +552,7 @@ CollationAPITest::TestCollationKey(/* char* par */)
col->getCollationKey(test1, sortk1, key1Status); col->getCollationKey(test1, sortk1, key1Status);
doAssert((sortk1.compareTo(col->getCollationKey(test2, sortk2, key2Status))) doAssert((sortk1.compareTo(col->getCollationKey(test2, sortk2, key2Status)))
== UCOL_GREATER, == Collator::GREATER,
"Result should be \"Abcda\" >>> \"abcda\""); "Result should be \"Abcda\" >>> \"abcda\"");
CollationKey sortk3(sortk2), sortkNew, sortkEmpty; CollationKey sortk3(sortk2), sortkNew, sortkEmpty;
@ -565,11 +565,11 @@ CollationAPITest::TestCollationKey(/* char* par */)
doAssert((sortk1 == sortkNew), "The sort keys assignment failed"); doAssert((sortk1 == sortkNew), "The sort keys assignment failed");
doAssert((sortk1.hashCode() == sortkNew.hashCode()), "sort key hashCode() failed"); doAssert((sortk1.hashCode() == sortkNew.hashCode()), "sort key hashCode() failed");
doAssert((sortkNew != sortk3), "The sort keys should be different"); doAssert((sortkNew != sortk3), "The sort keys should be different");
doAssert(sortk1.compareTo(sortk3) == UCOL_GREATER, "Result should be \"Abcda\" >>> \"abcda\""); doAssert(sortk1.compareTo(sortk3) == Collator::GREATER, "Result should be \"Abcda\" >>> \"abcda\"");
doAssert(sortk2.compareTo(sortk3) == UCOL_EQUAL, "Result should be \"abcda\" == \"abcda\""); doAssert(sortk2.compareTo(sortk3) == Collator::EQUAL, "Result should be \"abcda\" == \"abcda\"");
doAssert(sortkEmpty.compareTo(sortk1) == UCOL_LESS, "Result should be (empty key) <<< \"Abcda\""); doAssert(sortkEmpty.compareTo(sortk1) == Collator::LESS, "Result should be (empty key) <<< \"Abcda\"");
doAssert(sortk1.compareTo(sortkEmpty) == UCOL_GREATER, "Result should be \"Abcda\" >>> (empty key)"); doAssert(sortk1.compareTo(sortkEmpty) == Collator::GREATER, "Result should be \"Abcda\" >>> (empty key)");
doAssert(sortkEmpty.compareTo(sortkEmpty) == UCOL_EQUAL, "Result should be (empty key) == (empty key)"); doAssert(sortkEmpty.compareTo(sortkEmpty) == Collator::EQUAL, "Result should be (empty key) == (empty key)");
int32_t cnt1, cnt2, cnt3, cnt4; int32_t cnt1, cnt2, cnt3, cnt4;
uint8_t* byteArray1 = 0; uint8_t* byteArray1 = 0;
@ -601,12 +601,12 @@ CollationAPITest::TestCollationKey(/* char* par */)
doAssert(memcmp(byteArray2, sortk2_compat, strlen(sortk2_compat)) == 0, doAssert(memcmp(byteArray2, sortk2_compat, strlen(sortk2_compat)) == 0,
"Binary format for 'abcda' sortkey different!"); "Binary format for 'abcda' sortkey different!");
*/ */
doAssert(sortk1.compareTo(sortk4) == UCOL_EQUAL, "CollationKey::toByteArray(sortk1) Failed."); doAssert(sortk1.compareTo(sortk4) == Collator::EQUAL, "CollationKey::toByteArray(sortk1) Failed.");
doAssert(sortk2.compareTo(sortk5) == UCOL_EQUAL, "CollationKey::toByteArray(sortk2) Failed."); doAssert(sortk2.compareTo(sortk5) == Collator::EQUAL, "CollationKey::toByteArray(sortk2) Failed.");
doAssert(sortk4.compareTo(sortk5) == UCOL_GREATER, "sortk4 >>> sortk5 Failed"); doAssert(sortk4.compareTo(sortk5) == Collator::GREATER, "sortk4 >>> sortk5 Failed");
doAssert(sortk1.compareTo(sortk6) == UCOL_EQUAL, "CollationKey::getByteArray(sortk1) Failed."); doAssert(sortk1.compareTo(sortk6) == Collator::EQUAL, "CollationKey::getByteArray(sortk1) Failed.");
doAssert(sortk2.compareTo(sortk7) == UCOL_EQUAL, "CollationKey::getByteArray(sortk2) Failed."); doAssert(sortk2.compareTo(sortk7) == Collator::EQUAL, "CollationKey::getByteArray(sortk2) Failed.");
doAssert(sortk6.compareTo(sortk7) == UCOL_GREATER, "sortk6 >>> sortk7 Failed"); doAssert(sortk6.compareTo(sortk7) == Collator::GREATER, "sortk6 >>> sortk7 Failed");
logln("Equality tests : "); logln("Equality tests : ");
doAssert(sortk1 == sortk4, "sortk1 == sortk4 Failed."); doAssert(sortk1 == sortk4, "sortk1 == sortk4 Failed.");
@ -629,7 +629,7 @@ CollationAPITest::TestCollationKey(/* char* par */)
col->setStrength(Collator::SECONDARY); col->setStrength(Collator::SECONDARY);
doAssert(col->getCollationKey(test1, sortk1, key1Status).compareTo( doAssert(col->getCollationKey(test1, sortk1, key1Status).compareTo(
col->getCollationKey(test2, sortk2, key2Status)) col->getCollationKey(test2, sortk2, key2Status))
== UCOL_EQUAL, == Collator::EQUAL,
"Result should be \"Abcda\" == \"abcda\""); "Result should be \"Abcda\" == \"abcda\"");
delete col; delete col;
} }
@ -1047,11 +1047,11 @@ void CollationAPITest::TestSortKey()
CollationKey key3; CollationKey key3;
col->getCollationKey(test3, u_strlen(test3), key3, status); col->getCollationKey(test3, u_strlen(test3), key3, status);
doAssert(key1.compareTo(key2) == UCOL_GREATER, doAssert(key1.compareTo(key2) == Collator::GREATER,
"Result should be \"Abcda\" > \"abcda\""); "Result should be \"Abcda\" > \"abcda\"");
doAssert(key2.compareTo(key1) == UCOL_LESS, doAssert(key2.compareTo(key1) == Collator::LESS,
"Result should be \"abcda\" < \"Abcda\""); "Result should be \"abcda\" < \"Abcda\"");
doAssert(key2.compareTo(key3) == UCOL_EQUAL, doAssert(key2.compareTo(key3) == Collator::EQUAL,
"Result should be \"abcda\" == \"abcda\""); "Result should be \"abcda\" == \"abcda\"");
int32_t keylength = 0; int32_t keylength = 0;
@ -1111,9 +1111,9 @@ void CollationAPITest::TestSortKey()
col->getCollationKey(test2, u_strlen(test2), key2, status); col->getCollationKey(test2, u_strlen(test2), key2, status);
col->getCollationKey(test3, u_strlen(test3), key3, status); col->getCollationKey(test3, u_strlen(test3), key3, status);
doAssert(key1.compareTo(key2) == UCOL_EQUAL, doAssert(key1.compareTo(key2) == Collator::EQUAL,
"Result should be \"Abcda\" == \"abcda\""); "Result should be \"Abcda\" == \"abcda\"");
doAssert(key2.compareTo(key3) == UCOL_EQUAL, doAssert(key2.compareTo(key3) == Collator::EQUAL,
"Result should be \"abcda\" == \"abcda\""); "Result should be \"abcda\" == \"abcda\"");
tempkey = key2.getByteArray(keylength); tempkey = key2.getByteArray(keylength);
@ -1745,12 +1745,12 @@ class TestCollator: Collator
{ {
public: public:
virtual Collator* clone(void) const; virtual Collator* clone(void) const;
virtual UCollationResult compare(const UnicodeString& source, virtual EComparisonResult compare(const UnicodeString& source,
const UnicodeString& target) const; const UnicodeString& target) const;
virtual UCollationResult compare(const UnicodeString& source, virtual EComparisonResult compare(const UnicodeString& source,
const UnicodeString& target, const UnicodeString& target,
int32_t length) const; int32_t length) const;
virtual UCollationResult compare(const UChar* source, virtual EComparisonResult compare(const UChar* source,
int32_t sourceLength, int32_t sourceLength,
const UChar* target, const UChar* target,
int32_t targetLength) const; int32_t targetLength) const;
@ -1793,29 +1793,29 @@ inline UBool TestCollator::operator!=(const TestCollator& other) const {
} }
#define returnEComparisonResult(data) \ #define returnEComparisonResult(data) \
if (data < 0) return UCOL_LESS;\ if (data < 0) return Collator::LESS;\
if (data > 0) return UCOL_GREATER;\ if (data > 0) return Collator::GREATER;\
return UCOL_EQUAL; return Collator::EQUAL;
Collator* TestCollator::clone() const Collator* TestCollator::clone() const
{ {
return new TestCollator(); return new TestCollator();
} }
UCollationResult TestCollator::compare(const UnicodeString& source, Collator::EComparisonResult TestCollator::compare(const UnicodeString& source,
const UnicodeString& target) const const UnicodeString& target) const
{ {
returnEComparisonResult(source.compare(target)); returnEComparisonResult(source.compare(target));
} }
UCollationResult TestCollator::compare(const UnicodeString& source, Collator::EComparisonResult TestCollator::compare(const UnicodeString& source,
const UnicodeString& target, const UnicodeString& target,
int32_t length) const int32_t length) const
{ {
returnEComparisonResult(source.compare(0, length, target)); returnEComparisonResult(source.compare(0, length, target));
} }
UCollationResult TestCollator::compare(const UChar* source, Collator::EComparisonResult TestCollator::compare(const UChar* source,
int32_t sourceLength, int32_t sourceLength,
const UChar* target, const UChar* target,
int32_t targetLength) const int32_t targetLength) const

View File

@ -80,7 +80,7 @@ void CollationCurrencyTest::currencyTest(/*char *par*/)
uint32_t i, j; uint32_t i, j;
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UCollationResult expectedResult = UCOL_EQUAL; Collator::EComparisonResult expectedResult = Collator::EQUAL;
RuleBasedCollator *c = (RuleBasedCollator *)Collator::createInstance("en_US", status); RuleBasedCollator *c = (RuleBasedCollator *)Collator::createInstance("en_US", status);
if (U_FAILURE(status)) if (U_FAILURE(status))
@ -100,18 +100,18 @@ void CollationCurrencyTest::currencyTest(/*char *par*/)
if (i < j) if (i < j)
{ {
expectedResult = UCOL_LESS; expectedResult = Collator::LESS;
} }
else if ( i == j) else if ( i == j)
{ {
expectedResult = UCOL_EQUAL; expectedResult = Collator::EQUAL;
} }
else else
{ {
expectedResult = UCOL_GREATER; expectedResult = Collator::GREATER;
} }
UCollationResult compareResult = c->compare(source, target); Collator::EComparisonResult compareResult = c->compare(source, target);
CollationKey sourceKey, targetKey; CollationKey sourceKey, targetKey;
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
@ -132,7 +132,7 @@ void CollationCurrencyTest::currencyTest(/*char *par*/)
continue; continue;
} }
UCollationResult keyResult = sourceKey.compareTo(targetKey); Collator::EComparisonResult keyResult = sourceKey.compareTo(targetKey);
reportCResult( source, target, sourceKey, targetKey, compareResult, keyResult, compareResult, expectedResult ); reportCResult( source, target, sourceKey, targetKey, compareResult, keyResult, compareResult, expectedResult );

View File

@ -59,16 +59,16 @@ const UChar CollationDanishTest::testTargetCases[][CollationDanishTest::MAX_TOKE
{(UChar)0x004C /* 'L' */, (UChar)0x0079 /* 'y' */, (UChar)0x0062 /* 'b' */, (UChar)0x0065 /* 'e' */, (UChar)0x0063 /* 'c' */, (UChar)0x006B /* 'k' */, (UChar)0x0000 /* '\0' */} {(UChar)0x004C /* 'L' */, (UChar)0x0079 /* 'y' */, (UChar)0x0062 /* 'b' */, (UChar)0x0065 /* 'e' */, (UChar)0x0063 /* 'c' */, (UChar)0x006B /* 'k' */, (UChar)0x0000 /* '\0' */}
}; };
const UCollationResult CollationDanishTest::results[] = { const Collator::EComparisonResult CollationDanishTest::results[] = {
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
/* test primary > 5*/ /* test primary > 5*/
UCOL_EQUAL, Collator::EQUAL,
UCOL_LESS, Collator::LESS,
UCOL_EQUAL Collator::EQUAL
}; };
const UChar CollationDanishTest::testBugs[][CollationDanishTest::MAX_TOKEN_LEN] = { const UChar CollationDanishTest::testBugs[][CollationDanishTest::MAX_TOKEN_LEN] = {
@ -202,13 +202,13 @@ void CollationDanishTest::TestTertiary(/* char* par */)
logln("Test internet data list : "); logln("Test internet data list : ");
for (i = 0; i < 53; i++) { for (i = 0; i < 53; i++) {
for (j = i+1; j < 54; j++) { for (j = i+1; j < 54; j++) {
doTest(myCollation, testBugs[i], testBugs[j], UCOL_LESS); doTest(myCollation, testBugs[i], testBugs[j], Collator::LESS);
} }
} }
logln("Test NT data list : "); logln("Test NT data list : ");
for (i = 0; i < 52; i++) { for (i = 0; i < 52; i++) {
for (j = i+1; j < 53; j++) { for (j = i+1; j < 53; j++) {
doTest(myCollation, testNTList[i], testNTList[j], UCOL_LESS); doTest(myCollation, testNTList[i], testNTList[j], Collator::LESS);
} }
} }
} }

View File

@ -41,7 +41,7 @@ private:
static const UChar testNTList[][MAX_TOKEN_LEN]; static const UChar testNTList[][MAX_TOKEN_LEN];
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
Collator *myCollation; Collator *myCollation;
}; };

View File

@ -106,15 +106,15 @@ DataDrivenCollatorTest::getNextInSequence(SeqElement &el) {
case CharacterIterator::DONE: case CharacterIterator::DONE:
break; break;
case 0x003C /* < */: case 0x003C /* < */:
el.relation = UCOL_LESS; el.relation = Collator::LESS;
currChar = CharacterIterator::DONE; currChar = CharacterIterator::DONE;
break; break;
case 0x003D /* = */: case 0x003D /* = */:
el.relation = UCOL_EQUAL; el.relation = Collator::EQUAL;
currChar = CharacterIterator::DONE; currChar = CharacterIterator::DONE;
break; break;
case 0x003E /* > */: case 0x003E /* > */:
el.relation = UCOL_GREATER; el.relation = Collator::GREATER;
currChar = CharacterIterator::DONE; currChar = CharacterIterator::DONE;
break; break;
case 0x0027 /* ' */: /* very basic quoting */ case 0x0027 /* ' */: /* very basic quoting */
@ -237,7 +237,7 @@ DataDrivenCollatorTest::processTest(TestData *testData) {
void void
DataDrivenCollatorTest::processSequence(Collator* col, const UnicodeString &sequence) { DataDrivenCollatorTest::processSequence(Collator* col, const UnicodeString &sequence) {
UCollationResult relation = UCOL_EQUAL; Collator::EComparisonResult relation = Collator::EQUAL;
UBool hasNext; UBool hasNext;
SeqElement *source = NULL; SeqElement *source = NULL;
SeqElement *target = NULL; SeqElement *target = NULL;
@ -251,12 +251,12 @@ DataDrivenCollatorTest::processSequence(Collator* col, const UnicodeString &sequ
sequences.addElement(target, status); sequences.addElement(target, status);
do { do {
relation = UCOL_EQUAL; relation = Collator::EQUAL;
target = new SeqElement(); target = new SeqElement();
hasNext = getNextInSequence(*target); hasNext = getNextInSequence(*target);
for(j = sequences.size(); j > 0; j--) { for(j = sequences.size(); j > 0; j--) {
source = (SeqElement *)sequences.elementAt(j-1); source = (SeqElement *)sequences.elementAt(j-1);
if(relation == UCOL_EQUAL && source->relation != UCOL_EQUAL) { if(relation == Collator::EQUAL && source->relation != Collator::EQUAL) {
relation = source->relation; relation = source->relation;
} }
doTest(col, source->source, target->source, relation); doTest(col, source->source, target->source, relation);

View File

@ -29,7 +29,7 @@
class SeqElement { class SeqElement {
public: public:
UnicodeString source; UnicodeString source;
UCollationResult relation; Collator::EComparisonResult relation;
}; };
class DataDrivenCollatorTest: public IntlTestCollator { class DataDrivenCollatorTest: public IntlTestCollator {

View File

@ -82,21 +82,21 @@ const UChar CollationGermanTest::testTargetCases[][CollationGermanTest::MAX_TOKE
{0x53, 0x74, 0x72, 0x61, 0x73, 0x73, 0x65, 0} {0x53, 0x74, 0x72, 0x61, 0x73, 0x73, 0x65, 0}
}; };
const UCollationResult CollationGermanTest::results[][2] = const Collator::EComparisonResult CollationGermanTest::results[][2] =
{ {
// Primary Tertiary // Primary Tertiary
{ UCOL_LESS, UCOL_LESS }, { Collator::LESS, Collator::LESS },
{ UCOL_EQUAL, UCOL_LESS }, { Collator::EQUAL, Collator::LESS },
{ UCOL_GREATER, UCOL_GREATER }, { Collator::GREATER, Collator::GREATER },
{ UCOL_GREATER, UCOL_GREATER }, { Collator::GREATER, Collator::GREATER },
{ UCOL_GREATER, UCOL_GREATER }, { Collator::GREATER, Collator::GREATER },
{ UCOL_EQUAL, UCOL_LESS }, { Collator::EQUAL, Collator::LESS },
{ UCOL_EQUAL, UCOL_EQUAL }, { Collator::EQUAL, Collator::EQUAL },
{ UCOL_LESS, UCOL_LESS }, { Collator::LESS, Collator::LESS },
{ UCOL_EQUAL, UCOL_GREATER }, { Collator::EQUAL, Collator::GREATER },
{ UCOL_EQUAL, UCOL_EQUAL }, { Collator::EQUAL, Collator::EQUAL },
{ UCOL_LESS, UCOL_LESS }, { Collator::LESS, Collator::LESS },
{ UCOL_EQUAL, UCOL_GREATER } { Collator::EQUAL, Collator::GREATER }
}; };

View File

@ -40,7 +40,7 @@ public:
private: private:
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UCollationResult results[][2]; static const Collator::EComparisonResult results[][2];
Collator *myCollation; Collator *myCollation;
}; };

View File

@ -130,60 +130,60 @@ const UChar CollationEnglishTest::testTargetCases[][CollationEnglishTest::MAX_TO
{(UChar)0x0070 /* 'p' */, 0x00EA, (UChar)0x0063 /* 'c' */, (UChar)0x0068 /* 'h' */, (UChar)0x0065 /* 'e' */, 0} // 49 {(UChar)0x0070 /* 'p' */, 0x00EA, (UChar)0x0063 /* 'c' */, (UChar)0x0068 /* 'h' */, (UChar)0x0065 /* 'e' */, 0} // 49
}; };
const UCollationResult CollationEnglishTest::results[] = { const Collator::EComparisonResult CollationEnglishTest::results[] = {
UCOL_LESS, Collator::LESS,
UCOL_LESS, /*Collator::GREATER,*/ Collator::LESS, /*Collator::GREATER,*/
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_GREATER, Collator::GREATER,
UCOL_EQUAL, Collator::EQUAL,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, /*Collator::GREATER,*/ /* 10 */ Collator::LESS, /*Collator::GREATER,*/ /* 10 */
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_EQUAL, Collator::EQUAL,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_GREATER, Collator::GREATER,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, /* 20 */ Collator::LESS, /* 20 */
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_GREATER, Collator::GREATER,
UCOL_GREATER, Collator::GREATER,
/* Test Tertiary > 26 */ /* Test Tertiary > 26 */
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, /* 30 */ Collator::LESS, /* 30 */
UCOL_GREATER, Collator::GREATER,
UCOL_EQUAL, Collator::EQUAL,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
/* test identical > 36 */ /* test identical > 36 */
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
/* test primary > 38 */ /* test primary > 38 */
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, /* 40 */ Collator::EQUAL, /* 40 */
UCOL_LESS, Collator::LESS,
UCOL_EQUAL, Collator::EQUAL,
UCOL_EQUAL, Collator::EQUAL,
/* test secondary > 43 */ /* test secondary > 43 */
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_EQUAL, Collator::EQUAL,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS // 49 Collator::LESS // 49
}; };
const UChar CollationEnglishTest::testBugs[][CollationEnglishTest::MAX_TOKEN_LEN] = { const UChar CollationEnglishTest::testBugs[][CollationEnglishTest::MAX_TOKEN_LEN] = {
@ -254,23 +254,23 @@ void CollationEnglishTest::TestTertiary(/* char* par */)
{ {
for (j = i+1; j < 10; j++) for (j = i+1; j < 10; j++)
{ {
doTest(myCollation, testBugs[i], testBugs[j], UCOL_LESS); doTest(myCollation, testBugs[i], testBugs[j], Collator::LESS);
} }
} }
//test more interesting cases //test more interesting cases
UCollationResult expected; Collator::EComparisonResult expected;
const int32_t testMoreSize = (int32_t)(sizeof(testMore) / sizeof(testMore[0])); const int32_t testMoreSize = (int32_t)(sizeof(testMore) / sizeof(testMore[0]));
for (i = 0; i < testMoreSize; i++) for (i = 0; i < testMoreSize; i++)
{ {
for (j = 0; j < testMoreSize; j++) for (j = 0; j < testMoreSize; j++)
{ {
if (i < j) if (i < j)
expected = UCOL_LESS; expected = Collator::LESS;
else if (i == j) else if (i == j)
expected = UCOL_EQUAL; expected = Collator::EQUAL;
else // (i > j) else // (i > j)
expected = UCOL_GREATER; expected = Collator::GREATER;
doTest(myCollation, testMore[i], testMore[j], expected ); doTest(myCollation, testMore[i], testMore[j], expected );
} }
} }
@ -298,18 +298,18 @@ void CollationEnglishTest::TestSecondary(/* char* par */)
//test acute and grave ordering (compare to french collation) //test acute and grave ordering (compare to french collation)
int32_t j; int32_t j;
UCollationResult expected; Collator::EComparisonResult expected;
const int32_t testAcuteSize = (int32_t)(sizeof(testAcute) / sizeof(testAcute[0])); const int32_t testAcuteSize = (int32_t)(sizeof(testAcute) / sizeof(testAcute[0]));
for (i = 0; i < testAcuteSize; i++) for (i = 0; i < testAcuteSize; i++)
{ {
for (j = 0; j < testAcuteSize; j++) for (j = 0; j < testAcuteSize; j++)
{ {
if (i < j) if (i < j)
expected = UCOL_LESS; expected = Collator::LESS;
else if (i == j) else if (i == j)
expected = UCOL_EQUAL; expected = Collator::EQUAL;
else // (i > j) else // (i > j)
expected = UCOL_GREATER; expected = Collator::GREATER;
doTest(myCollation, testAcute[i], testAcute[j], expected ); doTest(myCollation, testAcute[i], testAcute[j], expected );
} }
} }

View File

@ -43,7 +43,7 @@ private:
static const UChar testBugs[][MAX_TOKEN_LEN]; static const UChar testBugs[][MAX_TOKEN_LEN];
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
static const UChar testAcute[][MAX_TOKEN_LEN]; static const UChar testAcute[][MAX_TOKEN_LEN];
Collator *myCollation; Collator *myCollation;

View File

@ -67,17 +67,17 @@ const UChar CollationSpanishTest::testTargetCases[][CollationSpanishTest::MAX_TO
{0x68, 0x65, 0x6c, 0x6c, 0x4f, 0}, {0x68, 0x65, 0x6c, 0x6c, 0x4f, 0},
}; };
const UCollationResult CollationSpanishTest::results[] = { const Collator::EComparisonResult CollationSpanishTest::results[] = {
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
// test primary > 5 // test primary > 5
UCOL_LESS, Collator::LESS,
UCOL_EQUAL, Collator::EQUAL,
UCOL_LESS, Collator::LESS,
UCOL_EQUAL Collator::EQUAL
}; };
void CollationSpanishTest::TestTertiary(/* char* par */) void CollationSpanishTest::TestTertiary(/* char* par */)

View File

@ -39,7 +39,7 @@ public:
private: private:
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
Collator *myCollation; Collator *myCollation;
}; };

View File

@ -58,13 +58,13 @@ const UChar CollationFinnishTest::testTargetCases[][CollationFinnishTest::MAX_TO
{0x76, 0x61, 0x74, 0} {0x76, 0x61, 0x74, 0}
}; };
const UCollationResult CollationFinnishTest::results[] = { const Collator::EComparisonResult CollationFinnishTest::results[] = {
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
// test primary > 4 // test primary > 4
UCOL_EQUAL, Collator::EQUAL,
}; };
void CollationFinnishTest::TestTertiary(/* char* par */) void CollationFinnishTest::TestTertiary(/* char* par */)

View File

@ -38,7 +38,7 @@ public:
private: private:
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
Collator *myCollation; Collator *myCollation;
}; };

View File

@ -73,20 +73,20 @@ const UChar CollationFrenchTest::testTargetCases[][CollationFrenchTest::MAX_TOKE
{0x01df, 0x0000} {0x01df, 0x0000}
}; };
const UCollationResult CollationFrenchTest::results[] = const Collator::EComparisonResult CollationFrenchTest::results[] =
{ {
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, /*Collator::GREATER,*/ Collator::LESS, /*Collator::GREATER,*/
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, /*Collator::GREATER,*/ Collator::LESS, /*Collator::GREATER,*/
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_LESS Collator::LESS
}; };
// 0x0300 is grave, 0x0301 is acute // 0x0300 is grave, 0x0301 is acute
@ -158,7 +158,7 @@ void CollationFrenchTest::TestSecondary(/* char* par */)
//test acute and grave ordering //test acute and grave ordering
int32_t i = 0; int32_t i = 0;
int32_t j; int32_t j;
UCollationResult expected; Collator::EComparisonResult expected;
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
//myCollation->setAttribute(UCOL_FRENCH_COLLATION, UCOL_ON, status); //myCollation->setAttribute(UCOL_FRENCH_COLLATION, UCOL_ON, status);
myCollation->setStrength(Collator::SECONDARY); myCollation->setStrength(Collator::SECONDARY);
@ -172,11 +172,11 @@ void CollationFrenchTest::TestSecondary(/* char* par */)
for (j = 0; j < testAcuteSize; j++) for (j = 0; j < testAcuteSize; j++)
{ {
if (i < j) if (i < j)
expected = UCOL_LESS; expected = Collator::LESS;
else if (i == j) else if (i == j)
expected = UCOL_EQUAL; expected = Collator::EQUAL;
else // (i > j) else // (i > j)
expected = UCOL_GREATER; expected = Collator::GREATER;
doTest(myCollation, testAcute[i], testAcute[j], expected ); doTest(myCollation, testAcute[i], testAcute[j], expected );
} }
} }
@ -191,7 +191,7 @@ void CollationFrenchTest::TestExtra(/* char* par */)
{ {
for (j = i + 1; j < 10; j += 1) for (j = i + 1; j < 10; j += 1)
{ {
doTest(myCollation, testBugs[i], testBugs[j], UCOL_LESS); doTest(myCollation, testBugs[i], testBugs[j], Collator::LESS);
} }
} }
} }

View File

@ -41,7 +41,7 @@ private:
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UChar testBugs[][MAX_TOKEN_LEN]; static const UChar testBugs[][MAX_TOKEN_LEN];
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
static const UChar testAcute[][MAX_TOKEN_LEN]; static const UChar testAcute[][MAX_TOKEN_LEN];
Collator *myCollation; Collator *myCollation;

View File

@ -140,7 +140,7 @@ void G7CollationTest::TestG7Locales(/* char* par */)
{ {
for (n = j+1; n < FIXEDTESTSET; n++) for (n = j+1; n < FIXEDTESTSET; n++)
{ {
doTest(tblColl1, testCases[results[i][j]], testCases[results[i][n]], UCOL_LESS); doTest(tblColl1, testCases[results[i][j]], testCases[results[i][n]], Collator::LESS);
} }
} }
@ -170,7 +170,7 @@ void G7CollationTest::TestDemo1(/* char* par */)
{ {
for (n = j+1; n < FIXEDTESTSET; n++) for (n = j+1; n < FIXEDTESTSET; n++)
{ {
doTest(myCollation, testCases[results[8][j]], testCases[results[8][n]], UCOL_LESS); doTest(myCollation, testCases[results[8][j]], testCases[results[8][n]], Collator::LESS);
} }
} }
@ -199,7 +199,7 @@ void G7CollationTest::TestDemo2(/* char* par */)
{ {
for (n = j+1; n < TOTALTESTSET; n++) for (n = j+1; n < TOTALTESTSET; n++)
{ {
doTest(myCollation, testCases[results[9][j]], testCases[results[9][n]], UCOL_LESS); doTest(myCollation, testCases[results[9][j]], testCases[results[9][n]], Collator::LESS);
} }
} }
@ -228,7 +228,7 @@ void G7CollationTest::TestDemo3(/* char* par */)
{ {
for (n = j+1; n < TOTALTESTSET; n++) for (n = j+1; n < TOTALTESTSET; n++)
{ {
doTest(myCollation, testCases[results[10][j]], testCases[results[10][n]], UCOL_LESS); doTest(myCollation, testCases[results[10][j]], testCases[results[10][n]], Collator::LESS);
} }
} }
@ -257,7 +257,7 @@ void G7CollationTest::TestDemo4(/* char* par */)
{ {
for (n = j+1; n < TOTALTESTSET; n++) for (n = j+1; n < TOTALTESTSET; n++)
{ {
doTest(myCollation, testCases[results[11][j]], testCases[results[11][n]], UCOL_LESS); doTest(myCollation, testCases[results[11][j]], testCases[results[11][n]], Collator::LESS);
} }
} }

View File

@ -53,13 +53,13 @@ const UChar CollationKanaTest::testTargetCases[][CollationKanaTest::MAX_TOKEN_LE
{0x3042, 0x3042, 0x3068, 0x0000} /* 6 */ {0x3042, 0x3042, 0x3068, 0x0000} /* 6 */
}; };
const UCollationResult CollationKanaTest::results[] = { const Collator::EComparisonResult CollationKanaTest::results[] = {
UCOL_LESS, Collator::LESS,
UCOL_EQUAL, //Collator::LESS, /* Katakanas and Hiraganas are equal on tertiary level(ICU 2.0)*/ Collator::EQUAL, //Collator::LESS, /* Katakanas and Hiraganas are equal on tertiary level(ICU 2.0)*/
UCOL_LESS, Collator::LESS,
UCOL_GREATER, // Collator::LESS, /* Prolonged sound mark sorts BEFORE equivalent vowel (ICU 2.0)*/ Collator::GREATER, // Collator::LESS, /* Prolonged sound mark sorts BEFORE equivalent vowel (ICU 2.0)*/
UCOL_LESS, Collator::LESS,
UCOL_LESS, //Collator::GREATER /* Prolonged sound mark sorts BEFORE equivalent vowel (ICU 2.0)*//* 6 */ Collator::LESS, //Collator::GREATER /* Prolonged sound mark sorts BEFORE equivalent vowel (ICU 2.0)*//* 6 */
}; };
const UChar CollationKanaTest::testBaseCases[][CollationKanaTest::MAX_TOKEN_LEN] = { const UChar CollationKanaTest::testBaseCases[][CollationKanaTest::MAX_TOKEN_LEN] = {
@ -121,7 +121,7 @@ void CollationKanaTest::TestBase()
int32_t i; int32_t i;
myCollation->setStrength(Collator::PRIMARY); myCollation->setStrength(Collator::PRIMARY);
for (i = 0; i < 3 ; i++) for (i = 0; i < 3 ; i++)
doTest(myCollation, testBaseCases[i], testBaseCases[i + 1], UCOL_LESS); doTest(myCollation, testBaseCases[i], testBaseCases[i + 1], Collator::LESS);
} }
/* Testing plain, Daku-ten, Handaku-ten letters */ /* Testing plain, Daku-ten, Handaku-ten letters */
@ -131,7 +131,7 @@ void CollationKanaTest::TestPlainDakutenHandakuten(void)
myCollation->setStrength(Collator::SECONDARY); myCollation->setStrength(Collator::SECONDARY);
for (i = 0; i < 3 ; i++) for (i = 0; i < 3 ; i++)
doTest(myCollation, testPlainDakutenHandakutenCases[i], testPlainDakutenHandakutenCases[i + 1], doTest(myCollation, testPlainDakutenHandakutenCases[i], testPlainDakutenHandakutenCases[i + 1],
UCOL_LESS); Collator::LESS);
} }
/* /*
@ -144,7 +144,7 @@ void CollationKanaTest::TestSmallLarge(void)
myCollation->setStrength(Collator::TERTIARY); myCollation->setStrength(Collator::TERTIARY);
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status); myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
for (i = 0; i < 3 ; i++) for (i = 0; i < 3 ; i++)
doTest(myCollation, testSmallLargeCases[i], testSmallLargeCases[i + 1], UCOL_LESS); doTest(myCollation, testSmallLargeCases[i], testSmallLargeCases[i + 1], Collator::LESS);
} }
/* /*
@ -158,7 +158,7 @@ void CollationKanaTest::TestKatakanaHiragana(void)
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status); myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
for (i = 0; i < 3 ; i++) { for (i = 0; i < 3 ; i++) {
doTest(myCollation, testKatakanaHiraganaCases[i], testKatakanaHiraganaCases[i + 1], doTest(myCollation, testKatakanaHiraganaCases[i], testKatakanaHiraganaCases[i + 1],
UCOL_LESS); Collator::LESS);
} }
} }
@ -172,7 +172,7 @@ void CollationKanaTest::TestChooonKigoo(void)
myCollation->setStrength(Collator::QUATERNARY); myCollation->setStrength(Collator::QUATERNARY);
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status); myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
for (i = 0; i < 7 ; i++) { for (i = 0; i < 7 ; i++) {
doTest(myCollation, testChooonKigooCases[i], testChooonKigooCases[i + 1], UCOL_LESS); doTest(myCollation, testChooonKigooCases[i], testChooonKigooCases[i + 1], Collator::LESS);
} }
} }

View File

@ -50,7 +50,7 @@ public:
private: private:
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
static const UChar testBaseCases[][MAX_TOKEN_LEN]; static const UChar testBaseCases[][MAX_TOKEN_LEN];
static const UChar testPlainDakutenHandakutenCases[][MAX_TOKEN_LEN]; static const UChar testPlainDakutenHandakutenCases[][MAX_TOKEN_LEN];
static const UChar testSmallLargeCases[][MAX_TOKEN_LEN]; static const UChar testSmallLargeCases[][MAX_TOKEN_LEN];

View File

@ -50,8 +50,8 @@ const UChar LotusCollationKoreanTest::testTargetCases[][LotusCollationKoreanTest
{0xac01, 0} {0xac01, 0}
}; };
const UCollationResult LotusCollationKoreanTest::results[] = { const Collator::EComparisonResult LotusCollationKoreanTest::results[] = {
UCOL_LESS Collator::LESS
}; };
void LotusCollationKoreanTest::TestTertiary(/* char* par */) void LotusCollationKoreanTest::TestTertiary(/* char* par */)

View File

@ -30,7 +30,7 @@ public:
private: private:
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
Collator *myCollation; Collator *myCollation;
}; };

View File

@ -228,7 +228,7 @@ void CollationMonkeyTest::TestRules(/* char* par */){
return; return;
} }
for(i=0; i<2; i++){ for(i=0; i<2; i++){
doTest(myCollation, testSourceCases[i], testTargetCases[i], UCOL_LESS); doTest(myCollation, testSourceCases[i], testTargetCases[i], Collator::LESS);
} }
delete myCollation; delete myCollation;
@ -243,7 +243,7 @@ void CollationMonkeyTest::TestRules(/* char* par */){
return; return;
} }
for(i=0; i<2; i++){ for(i=0; i<2; i++){
doTest(myCollation, testSourceCases[i], testTargetCases[i], UCOL_LESS); doTest(myCollation, testSourceCases[i], testTargetCases[i], Collator::LESS);
} }
delete myCollation; delete myCollation;
delete col; delete col;

View File

@ -545,9 +545,9 @@ void CollationRegressionTest::Test4078588(/* char *par */)
return; return;
} }
UCollationResult result = rbc->compare("a","bb"); Collator::EComparisonResult result = rbc->compare("a","bb");
if (result != UCOL_LESS) if (result != Collator::LESS)
{ {
errln((UnicodeString)"Compare(a,bb) returned " + (int)result errln((UnicodeString)"Compare(a,bb) returned " + (int)result
+ (UnicodeString)"; expected -1"); + (UnicodeString)"; expected -1");
@ -1072,7 +1072,7 @@ void CollationRegressionTest::compareArray(Collator &c,
int32_t testCount) int32_t testCount)
{ {
int32_t i; int32_t i;
UCollationResult expectedResult = UCOL_EQUAL; Collator::EComparisonResult expectedResult = Collator::EQUAL;
for (i = 0; i < testCount; i += 3) for (i = 0; i < testCount; i += 3)
{ {
@ -1082,15 +1082,15 @@ void CollationRegressionTest::compareArray(Collator &c,
if (comparison == "<") if (comparison == "<")
{ {
expectedResult = UCOL_LESS; expectedResult = Collator::LESS;
} }
else if (comparison == ">") else if (comparison == ">")
{ {
expectedResult = UCOL_GREATER; expectedResult = Collator::GREATER;
} }
else if (comparison == "=") else if (comparison == "=")
{ {
expectedResult = UCOL_EQUAL; expectedResult = Collator::EQUAL;
} }
else else
{ {
@ -1099,7 +1099,7 @@ void CollationRegressionTest::compareArray(Collator &c,
errln(bogus1 + comparison + bogus2); errln(bogus1 + comparison + bogus2);
} }
UCollationResult compareResult = c.compare(source, target); Collator::EComparisonResult compareResult = c.compare(source, target);
CollationKey sourceKey, targetKey; CollationKey sourceKey, targetKey;
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
@ -1120,7 +1120,7 @@ void CollationRegressionTest::compareArray(Collator &c,
continue; continue;
} }
UCollationResult keyResult = sourceKey.compareTo(targetKey); Collator::EComparisonResult keyResult = sourceKey.compareTo(targetKey);
reportCResult( source, target, sourceKey, targetKey, compareResult, keyResult, compareResult, expectedResult ); reportCResult( source, target, sourceKey, targetKey, compareResult, keyResult, compareResult, expectedResult );

View File

@ -155,7 +155,7 @@ void CollationThaiTest::TestNamesList(void) {
} }
if (lastWord.length() > 0) { if (lastWord.length() > 0) {
UCollationResult result = coll->compare(lastWord, word); Collator::EComparisonResult result = coll->compare(lastWord, word);
doTest(coll, lastWord, word, result); doTest(coll, lastWord, word, result);
} }
lastWord = word; lastWord = word;
@ -222,7 +222,7 @@ void CollationThaiTest::TestDictionary(void) {
if (lastWord.length() > 0) { if (lastWord.length() > 0) {
// line enabled for j2720 // line enabled for j2720
doTest(coll, lastWord, word, UCOL_LESS); doTest(coll, lastWord, word, Collator::LESS);
int32_t result = coll->compare(lastWord, word); int32_t result = coll->compare(lastWord, word);
if (result >= 0) { if (result >= 0) {

View File

@ -70,19 +70,19 @@ const UChar CollationTurkishTest::testTargetCases[][CollationTurkishTest::MAX_TO
{0x49, 0x64, 0x65, 0x61, 0} {0x49, 0x64, 0x65, 0x61, 0}
}; };
const UCollationResult CollationTurkishTest::results[] = { const Collator::EComparisonResult CollationTurkishTest::results[] = {
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_GREATER, Collator::GREATER,
// test priamry > 8 // test priamry > 8
UCOL_LESS, Collator::LESS,
UCOL_LESS, Collator::LESS,
UCOL_GREATER Collator::GREATER
}; };
void CollationTurkishTest::TestTertiary(/* char* par */) void CollationTurkishTest::TestTertiary(/* char* par */)

View File

@ -39,7 +39,7 @@ private:
// static constants // static constants
static const UChar testSourceCases[][MAX_TOKEN_LEN]; static const UChar testSourceCases[][MAX_TOKEN_LEN];
static const UChar testTargetCases[][MAX_TOKEN_LEN]; static const UChar testTargetCases[][MAX_TOKEN_LEN];
static const UCollationResult results[]; static const Collator::EComparisonResult results[];
Collator *myCollation; Collator *myCollation;
}; };

View File

@ -351,13 +351,13 @@ IntlTestCollator::compareUsingPartials(UCollator *coll, const UChar source[], in
} }
void void
IntlTestCollator::doTestVariant(Collator* col, const UnicodeString &source, const UnicodeString &target, UCollationResult result) IntlTestCollator::doTestVariant(Collator* col, const UnicodeString &source, const UnicodeString &target, Collator::EComparisonResult result)
{ {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UCollator *myCollation = (UCollator *)((RuleBasedCollator *)col)->getUCollator(); UCollator *myCollation = (UCollator *)((RuleBasedCollator *)col)->getUCollator();
UCollationResult compareResult = col->compare(source, target); Collator::EComparisonResult compareResult = col->compare(source, target);
CollationKey srckey, tgtkey; CollationKey srckey, tgtkey;
col->getCollationKey(source, srckey, status); col->getCollationKey(source, srckey, status);
@ -365,7 +365,7 @@ IntlTestCollator::doTestVariant(Collator* col, const UnicodeString &source, cons
if (U_FAILURE(status)){ if (U_FAILURE(status)){
errln("Creation of collation keys failed\n"); errln("Creation of collation keys failed\n");
} }
UCollationResult keyResult = srckey.compareTo(tgtkey); Collator::EComparisonResult keyResult = srckey.compareTo(tgtkey);
reportCResult(source, target, srckey, tgtkey, compareResult, keyResult, result, result); reportCResult(source, target, srckey, tgtkey, compareResult, keyResult, result, result);
@ -464,18 +464,18 @@ IntlTestCollator::doTestVariant(Collator* col, const UnicodeString &source, cons
} }
void void
IntlTestCollator::doTest(Collator* col, const UChar *source, const UChar *target, UCollationResult result) { IntlTestCollator::doTest(Collator* col, const UChar *source, const UChar *target, Collator::EComparisonResult result) {
doTest(col, UnicodeString(source), UnicodeString(target), result); doTest(col, UnicodeString(source), UnicodeString(target), result);
} }
void void
IntlTestCollator::doTest(Collator* col, const UnicodeString &source, const UnicodeString &target, UCollationResult result) IntlTestCollator::doTest(Collator* col, const UnicodeString &source, const UnicodeString &target, Collator::EComparisonResult result)
{ {
doTestVariant(col, source, target, result); doTestVariant(col, source, target, result);
if(result == UCOL_LESS) { if(result == Collator::LESS) {
doTestVariant(col, target, source, UCOL_GREATER); doTestVariant(col, target, source, Collator::GREATER);
} else if (result == UCOL_GREATER) { } else if (result == Collator::GREATER) {
doTestVariant(col, target, source, UCOL_LESS); doTestVariant(col, target, source, Collator::LESS);
} }
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
@ -494,10 +494,10 @@ IntlTestCollator::doTest(Collator* col, const UnicodeString &source, const Unico
void void
IntlTestCollator::reportCResult( const UnicodeString &source, const UnicodeString &target, IntlTestCollator::reportCResult( const UnicodeString &source, const UnicodeString &target,
CollationKey &sourceKey, CollationKey &targetKey, CollationKey &sourceKey, CollationKey &targetKey,
UCollationResult compareResult, Collator::EComparisonResult compareResult,
UCollationResult keyResult, Collator::EComparisonResult keyResult,
UCollationResult incResult, Collator::EComparisonResult incResult,
UCollationResult expectedResult ) Collator::EComparisonResult expectedResult )
{ {
if (expectedResult < -1 || expectedResult > 1) if (expectedResult < -1 || expectedResult > 1)
{ {
@ -563,18 +563,18 @@ IntlTestCollator::reportCResult( const UnicodeString &source, const UnicodeStrin
} }
UnicodeString& UnicodeString&
IntlTestCollator::appendCompareResult(UCollationResult result, IntlTestCollator::appendCompareResult(Collator::EComparisonResult result,
UnicodeString& target) UnicodeString& target)
{ {
if (result == UCOL_LESS) if (result == Collator::LESS)
{ {
target += "LESS"; target += "LESS";
} }
else if (result == UCOL_EQUAL) else if (result == Collator::EQUAL)
{ {
target += "EQUAL"; target += "EQUAL";
} }
else if (result == UCOL_GREATER) else if (result == Collator::GREATER)
{ {
target += "GREATER"; target += "GREATER";
} }

View File

@ -28,19 +28,19 @@ class IntlTestCollator: public IntlTest {
void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ); void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL );
protected: protected:
// These two should probably go down in IntlTest // These two should probably go down in IntlTest
void doTest(Collator* col, const UChar *source, const UChar *target, UCollationResult result); void doTest(Collator* col, const UChar *source, const UChar *target, Collator::EComparisonResult result);
void doTest(Collator* col, const UnicodeString &source, const UnicodeString &target, UCollationResult result); void doTest(Collator* col, const UnicodeString &source, const UnicodeString &target, Collator::EComparisonResult result);
void doTestVariant(Collator* col, const UnicodeString &source, const UnicodeString &target, UCollationResult result); void doTestVariant(Collator* col, const UnicodeString &source, const UnicodeString &target, Collator::EComparisonResult result);
virtual void reportCResult( const UnicodeString &source, const UnicodeString &target, virtual void reportCResult( const UnicodeString &source, const UnicodeString &target,
CollationKey &sourceKey, CollationKey &targetKey, CollationKey &sourceKey, CollationKey &targetKey,
UCollationResult compareResult, Collator::EComparisonResult compareResult,
UCollationResult keyResult, Collator::EComparisonResult keyResult,
UCollationResult incResult, Collator::EComparisonResult incResult,
UCollationResult expectedResult ); Collator::EComparisonResult expectedResult );
static UnicodeString &prettify(const CollationKey &source, UnicodeString &target); static UnicodeString &prettify(const CollationKey &source, UnicodeString &target);
static UnicodeString &appendCompareResult(UCollationResult result, UnicodeString &target); static UnicodeString &appendCompareResult(Collator::EComparisonResult result, UnicodeString &target);
void backAndForth(CollationElementIterator &iter); void backAndForth(CollationElementIterator &iter);
/** /**
* Return an integer array containing all of the collation orders * Return an integer array containing all of the collation orders