ICU-2222 fix breaking changes
X-SVN-Rev: 11357
This commit is contained in:
parent
bd3d5f0969
commit
2de3bade18
@ -507,9 +507,12 @@ Calendar::complete(UErrorCode& status)
|
||||
|
||||
// -------------------------------------
|
||||
int32_t Calendar::fieldDifference(UDate when, EDateFields field, UErrorCode& status) {
|
||||
|
||||
return fieldDifference(when, (UCalendarDateFields) field, status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int32_t Calendar::fieldDifference(UDate targetMs, UCalendarDateFields field, UErrorCode& ec) {
|
||||
if (U_FAILURE(ec)) return 0;
|
||||
int32_t min = 0;
|
||||
@ -670,10 +673,10 @@ Calendar::setFirstDayOfWeek(UCalendarDaysOfWeek value)
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
UCalendarDaysOfWeek
|
||||
Calendar::EDaysOfWeek
|
||||
Calendar::getFirstDayOfWeek() const
|
||||
{
|
||||
return fFirstDayOfWeek;
|
||||
return (Calendar::EDaysOfWeek)fFirstDayOfWeek;
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
|
@ -177,7 +177,7 @@ CollationKey::operator=(const CollationKey& other)
|
||||
// NOTE: this is somewhat messy 'cause we can't count
|
||||
// on memcmp returning the exact values which match
|
||||
// Collator::EComparisonResult
|
||||
UCollationResult
|
||||
Collator::EComparisonResult
|
||||
CollationKey::compareTo(const CollationKey& target) const
|
||||
{
|
||||
uint8_t *src = this->fBytes;
|
||||
@ -185,7 +185,7 @@ CollationKey::compareTo(const CollationKey& target) const
|
||||
|
||||
// are we comparing the same string
|
||||
if (src == tgt)
|
||||
return UCOL_EQUAL;
|
||||
return Collator::EQUAL;
|
||||
|
||||
/*
|
||||
int count = (this->fCount < target.fCount) ? this->fCount : target.fCount;
|
||||
@ -208,32 +208,32 @@ CollationKey::compareTo(const CollationKey& target) const
|
||||
*/
|
||||
|
||||
int minLength;
|
||||
UCollationResult result;
|
||||
Collator::EComparisonResult result;
|
||||
|
||||
// are we comparing different lengths?
|
||||
if (this->fCount != target.fCount) {
|
||||
if (this->fCount < target.fCount) {
|
||||
minLength = this->fCount;
|
||||
result = UCOL_LESS;
|
||||
result = Collator::LESS;
|
||||
}
|
||||
else {
|
||||
minLength = target.fCount;
|
||||
result = UCOL_GREATER;
|
||||
result = Collator::GREATER;
|
||||
}
|
||||
}
|
||||
else {
|
||||
minLength = target.fCount;
|
||||
result = UCOL_EQUAL;
|
||||
result = Collator::EQUAL;
|
||||
}
|
||||
|
||||
if (minLength > 0) {
|
||||
int diff = uprv_memcmp(src, tgt, minLength);
|
||||
if (diff > 0) {
|
||||
return UCOL_GREATER;
|
||||
return Collator::GREATER;
|
||||
}
|
||||
else
|
||||
if (diff < 0) {
|
||||
return UCOL_LESS;
|
||||
return Collator::LESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ void RuleBasedCollator::getVersion(UVersionInfo versionInfo) const
|
||||
}
|
||||
}
|
||||
|
||||
UCollationResult RuleBasedCollator::compare(
|
||||
Collator::EComparisonResult RuleBasedCollator::compare(
|
||||
const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
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()));
|
||||
}
|
||||
|
||||
UCollationResult RuleBasedCollator::compare(const UChar* source,
|
||||
Collator::EComparisonResult RuleBasedCollator::compare(const UChar* source,
|
||||
int32_t sourceLength,
|
||||
const UChar* target,
|
||||
int32_t targetLength)
|
||||
const
|
||||
{
|
||||
return ucol_strcoll(ucollator, source, sourceLength,
|
||||
target, targetLength);
|
||||
return getEComparisonResult(ucol_strcoll(ucollator, source, sourceLength,
|
||||
target, targetLength));
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two strings using this collator
|
||||
*/
|
||||
UCollationResult RuleBasedCollator::compare(
|
||||
Collator::EComparisonResult RuleBasedCollator::compare(
|
||||
const UnicodeString& source,
|
||||
const UnicodeString& target) const
|
||||
{
|
||||
|
@ -790,7 +790,7 @@ public:
|
||||
* @return The first day of the week.
|
||||
* @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
|
||||
|
@ -328,7 +328,7 @@ public:
|
||||
* than target
|
||||
* @stable ICU 2.0
|
||||
**/
|
||||
virtual UCollationResult compare(const UnicodeString& source,
|
||||
virtual EComparisonResult compare(const UnicodeString& source,
|
||||
const UnicodeString& target) const = 0;
|
||||
|
||||
/**
|
||||
@ -343,7 +343,7 @@ public:
|
||||
* length) is less than target.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
virtual UCollationResult compare(const UnicodeString& source,
|
||||
virtual EComparisonResult compare(const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
int32_t length) const = 0;
|
||||
|
||||
@ -362,7 +362,7 @@ public:
|
||||
* target
|
||||
* @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 = 0;
|
||||
|
||||
|
@ -183,7 +183,7 @@ public:
|
||||
* otherwise.
|
||||
* @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
|
||||
|
@ -248,7 +248,7 @@ public:
|
||||
* target. Otherwise, returns EQUAL.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
virtual UCollationResult compare(const UnicodeString& source,
|
||||
virtual EComparisonResult compare(const UnicodeString& source,
|
||||
const UnicodeString& target) const;
|
||||
|
||||
|
||||
@ -265,7 +265,7 @@ public:
|
||||
* target. Otherwise, returns EQUAL.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
virtual UCollationResult compare(const UnicodeString& source,
|
||||
virtual EComparisonResult compare(const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
int32_t length) const;
|
||||
|
||||
@ -302,7 +302,7 @@ public:
|
||||
* target
|
||||
* @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;
|
||||
|
||||
|
@ -49,46 +49,46 @@ CollationDummyTest::~CollationDummyTest()
|
||||
delete myCollation;
|
||||
}
|
||||
|
||||
const UCollationResult CollationDummyTest::results[] = {
|
||||
UCOL_LESS,
|
||||
UCOL_LESS, /*Collator::GREATER,*/
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS, /* 10 */
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
const Collator::EComparisonResult CollationDummyTest::results[] = {
|
||||
Collator::LESS,
|
||||
Collator::LESS, /*Collator::GREATER,*/
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::GREATER,
|
||||
Collator::LESS, /* 10 */
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
/* test primary > 17 */
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL, /* 20 */
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL, /* 20 */
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::LESS,
|
||||
/* test secondary > 26 */
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL, /* 30 */
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL, /* 34 */
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL, /* 30 */
|
||||
Collator::EQUAL,
|
||||
Collator::LESS,
|
||||
Collator::EQUAL, /* 34 */
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::LESS
|
||||
};
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ void CollationDummyTest::TestExtra(/* char* par */)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
UCollationResult result = coll->compare(source, target);
|
||||
Collator::EComparisonResult result = coll->compare(source, target);
|
||||
/* result is 1, secondary differences only for ignorable space characters*/
|
||||
if (result != 1)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
void TestJB581();
|
||||
|
||||
private:
|
||||
static const UCollationResult results[];
|
||||
static const Collator::EComparisonResult results[];
|
||||
|
||||
RuleBasedCollator *myCollation;
|
||||
};
|
||||
|
@ -119,21 +119,21 @@ CollationAPITest::TestProperty(/* char* par */)
|
||||
}
|
||||
}
|
||||
|
||||
doAssert((col->compare("ab", "abc") == UCOL_LESS), "ab < abc comparison failed");
|
||||
doAssert((col->compare("ab", "AB") == UCOL_LESS), "ab < AB comparison failed");
|
||||
doAssert((col->compare("blackbird", "black-bird") == UCOL_GREATER), "black-bird > blackbird comparison failed");
|
||||
doAssert((col->compare("black bird", "black-bird") == UCOL_LESS), "black bird > black-bird comparison failed");
|
||||
doAssert((col->compare("Hello", "hello") == UCOL_GREATER), "Hello > hello comparison failed");
|
||||
doAssert((col->compare("ab", "abc") == Collator::LESS), "ab < abc comparison failed");
|
||||
doAssert((col->compare("ab", "AB") == Collator::LESS), "ab < AB comparison failed");
|
||||
doAssert((col->compare("blackbird", "black-bird") == Collator::GREATER), "black-bird > blackbird comparison failed");
|
||||
doAssert((col->compare("black bird", "black-bird") == Collator::LESS), "black bird > black-bird comparison failed");
|
||||
doAssert((col->compare("Hello", "hello") == Collator::GREATER), "Hello > hello comparison failed");
|
||||
|
||||
|
||||
/*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", "AB", 2) == UCOL_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", 2) == UCOL_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", "black-bird", 10) == UCOL_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("ab", "abc", 2) == Collator::EQUAL), "ab = abc 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) == Collator::LESS), "ab < Aa with length 1 comparison failed");
|
||||
doAssert((col->compare("ab", "Aa", 2) == Collator::GREATER), "ab > Aa with length 2 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) == Collator::LESS), "black bird < black-bird with length 10 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]*/
|
||||
|
||||
|
||||
@ -552,7 +552,7 @@ CollationAPITest::TestCollationKey(/* char* par */)
|
||||
|
||||
col->getCollationKey(test1, sortk1, key1Status);
|
||||
doAssert((sortk1.compareTo(col->getCollationKey(test2, sortk2, key2Status)))
|
||||
== UCOL_GREATER,
|
||||
== Collator::GREATER,
|
||||
"Result should be \"Abcda\" >>> \"abcda\"");
|
||||
|
||||
CollationKey sortk3(sortk2), sortkNew, sortkEmpty;
|
||||
@ -565,11 +565,11 @@ CollationAPITest::TestCollationKey(/* char* par */)
|
||||
doAssert((sortk1 == sortkNew), "The sort keys assignment failed");
|
||||
doAssert((sortk1.hashCode() == sortkNew.hashCode()), "sort key hashCode() failed");
|
||||
doAssert((sortkNew != sortk3), "The sort keys should be different");
|
||||
doAssert(sortk1.compareTo(sortk3) == UCOL_GREATER, "Result should be \"Abcda\" >>> \"abcda\"");
|
||||
doAssert(sortk2.compareTo(sortk3) == UCOL_EQUAL, "Result should be \"abcda\" == \"abcda\"");
|
||||
doAssert(sortkEmpty.compareTo(sortk1) == UCOL_LESS, "Result should be (empty key) <<< \"Abcda\"");
|
||||
doAssert(sortk1.compareTo(sortkEmpty) == UCOL_GREATER, "Result should be \"Abcda\" >>> (empty key)");
|
||||
doAssert(sortkEmpty.compareTo(sortkEmpty) == UCOL_EQUAL, "Result should be (empty key) == (empty key)");
|
||||
doAssert(sortk1.compareTo(sortk3) == Collator::GREATER, "Result should be \"Abcda\" >>> \"abcda\"");
|
||||
doAssert(sortk2.compareTo(sortk3) == Collator::EQUAL, "Result should be \"abcda\" == \"abcda\"");
|
||||
doAssert(sortkEmpty.compareTo(sortk1) == Collator::LESS, "Result should be (empty key) <<< \"Abcda\"");
|
||||
doAssert(sortk1.compareTo(sortkEmpty) == Collator::GREATER, "Result should be \"Abcda\" >>> (empty key)");
|
||||
doAssert(sortkEmpty.compareTo(sortkEmpty) == Collator::EQUAL, "Result should be (empty key) == (empty key)");
|
||||
|
||||
int32_t cnt1, cnt2, cnt3, cnt4;
|
||||
uint8_t* byteArray1 = 0;
|
||||
@ -601,12 +601,12 @@ CollationAPITest::TestCollationKey(/* char* par */)
|
||||
doAssert(memcmp(byteArray2, sortk2_compat, strlen(sortk2_compat)) == 0,
|
||||
"Binary format for 'abcda' sortkey different!");
|
||||
*/
|
||||
doAssert(sortk1.compareTo(sortk4) == UCOL_EQUAL, "CollationKey::toByteArray(sortk1) Failed.");
|
||||
doAssert(sortk2.compareTo(sortk5) == UCOL_EQUAL, "CollationKey::toByteArray(sortk2) Failed.");
|
||||
doAssert(sortk4.compareTo(sortk5) == UCOL_GREATER, "sortk4 >>> sortk5 Failed");
|
||||
doAssert(sortk1.compareTo(sortk6) == UCOL_EQUAL, "CollationKey::getByteArray(sortk1) Failed.");
|
||||
doAssert(sortk2.compareTo(sortk7) == UCOL_EQUAL, "CollationKey::getByteArray(sortk2) Failed.");
|
||||
doAssert(sortk6.compareTo(sortk7) == UCOL_GREATER, "sortk6 >>> sortk7 Failed");
|
||||
doAssert(sortk1.compareTo(sortk4) == Collator::EQUAL, "CollationKey::toByteArray(sortk1) Failed.");
|
||||
doAssert(sortk2.compareTo(sortk5) == Collator::EQUAL, "CollationKey::toByteArray(sortk2) Failed.");
|
||||
doAssert(sortk4.compareTo(sortk5) == Collator::GREATER, "sortk4 >>> sortk5 Failed");
|
||||
doAssert(sortk1.compareTo(sortk6) == Collator::EQUAL, "CollationKey::getByteArray(sortk1) Failed.");
|
||||
doAssert(sortk2.compareTo(sortk7) == Collator::EQUAL, "CollationKey::getByteArray(sortk2) Failed.");
|
||||
doAssert(sortk6.compareTo(sortk7) == Collator::GREATER, "sortk6 >>> sortk7 Failed");
|
||||
|
||||
logln("Equality tests : ");
|
||||
doAssert(sortk1 == sortk4, "sortk1 == sortk4 Failed.");
|
||||
@ -629,7 +629,7 @@ CollationAPITest::TestCollationKey(/* char* par */)
|
||||
col->setStrength(Collator::SECONDARY);
|
||||
doAssert(col->getCollationKey(test1, sortk1, key1Status).compareTo(
|
||||
col->getCollationKey(test2, sortk2, key2Status))
|
||||
== UCOL_EQUAL,
|
||||
== Collator::EQUAL,
|
||||
"Result should be \"Abcda\" == \"abcda\"");
|
||||
delete col;
|
||||
}
|
||||
@ -1047,11 +1047,11 @@ void CollationAPITest::TestSortKey()
|
||||
CollationKey key3;
|
||||
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\"");
|
||||
doAssert(key2.compareTo(key1) == UCOL_LESS,
|
||||
doAssert(key2.compareTo(key1) == Collator::LESS,
|
||||
"Result should be \"abcda\" < \"Abcda\"");
|
||||
doAssert(key2.compareTo(key3) == UCOL_EQUAL,
|
||||
doAssert(key2.compareTo(key3) == Collator::EQUAL,
|
||||
"Result should be \"abcda\" == \"abcda\"");
|
||||
|
||||
int32_t keylength = 0;
|
||||
@ -1111,9 +1111,9 @@ void CollationAPITest::TestSortKey()
|
||||
col->getCollationKey(test2, u_strlen(test2), key2, 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\"");
|
||||
doAssert(key2.compareTo(key3) == UCOL_EQUAL,
|
||||
doAssert(key2.compareTo(key3) == Collator::EQUAL,
|
||||
"Result should be \"abcda\" == \"abcda\"");
|
||||
|
||||
tempkey = key2.getByteArray(keylength);
|
||||
@ -1745,12 +1745,12 @@ class TestCollator: Collator
|
||||
{
|
||||
public:
|
||||
virtual Collator* clone(void) const;
|
||||
virtual UCollationResult compare(const UnicodeString& source,
|
||||
virtual EComparisonResult compare(const UnicodeString& source,
|
||||
const UnicodeString& target) const;
|
||||
virtual UCollationResult compare(const UnicodeString& source,
|
||||
virtual EComparisonResult compare(const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
int32_t length) const;
|
||||
virtual UCollationResult compare(const UChar* source,
|
||||
virtual EComparisonResult compare(const UChar* source,
|
||||
int32_t sourceLength,
|
||||
const UChar* target,
|
||||
int32_t targetLength) const;
|
||||
@ -1793,29 +1793,29 @@ inline UBool TestCollator::operator!=(const TestCollator& other) const {
|
||||
}
|
||||
|
||||
#define returnEComparisonResult(data) \
|
||||
if (data < 0) return UCOL_LESS;\
|
||||
if (data > 0) return UCOL_GREATER;\
|
||||
return UCOL_EQUAL;
|
||||
if (data < 0) return Collator::LESS;\
|
||||
if (data > 0) return Collator::GREATER;\
|
||||
return Collator::EQUAL;
|
||||
|
||||
Collator* TestCollator::clone() const
|
||||
{
|
||||
return new TestCollator();
|
||||
}
|
||||
|
||||
UCollationResult TestCollator::compare(const UnicodeString& source,
|
||||
Collator::EComparisonResult TestCollator::compare(const UnicodeString& source,
|
||||
const UnicodeString& target) const
|
||||
{
|
||||
returnEComparisonResult(source.compare(target));
|
||||
}
|
||||
|
||||
UCollationResult TestCollator::compare(const UnicodeString& source,
|
||||
Collator::EComparisonResult TestCollator::compare(const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
int32_t length) const
|
||||
{
|
||||
returnEComparisonResult(source.compare(0, length, target));
|
||||
}
|
||||
|
||||
UCollationResult TestCollator::compare(const UChar* source,
|
||||
Collator::EComparisonResult TestCollator::compare(const UChar* source,
|
||||
int32_t sourceLength,
|
||||
const UChar* target,
|
||||
int32_t targetLength) const
|
||||
|
@ -80,7 +80,7 @@ void CollationCurrencyTest::currencyTest(/*char *par*/)
|
||||
|
||||
uint32_t i, j;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UCollationResult expectedResult = UCOL_EQUAL;
|
||||
Collator::EComparisonResult expectedResult = Collator::EQUAL;
|
||||
RuleBasedCollator *c = (RuleBasedCollator *)Collator::createInstance("en_US", status);
|
||||
|
||||
if (U_FAILURE(status))
|
||||
@ -100,18 +100,18 @@ void CollationCurrencyTest::currencyTest(/*char *par*/)
|
||||
|
||||
if (i < j)
|
||||
{
|
||||
expectedResult = UCOL_LESS;
|
||||
expectedResult = Collator::LESS;
|
||||
}
|
||||
else if ( i == j)
|
||||
{
|
||||
expectedResult = UCOL_EQUAL;
|
||||
expectedResult = Collator::EQUAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
expectedResult = UCOL_GREATER;
|
||||
expectedResult = Collator::GREATER;
|
||||
}
|
||||
|
||||
UCollationResult compareResult = c->compare(source, target);
|
||||
Collator::EComparisonResult compareResult = c->compare(source, target);
|
||||
|
||||
CollationKey sourceKey, targetKey;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@ -132,7 +132,7 @@ void CollationCurrencyTest::currencyTest(/*char *par*/)
|
||||
continue;
|
||||
}
|
||||
|
||||
UCollationResult keyResult = sourceKey.compareTo(targetKey);
|
||||
Collator::EComparisonResult keyResult = sourceKey.compareTo(targetKey);
|
||||
|
||||
reportCResult( source, target, sourceKey, targetKey, compareResult, keyResult, compareResult, expectedResult );
|
||||
|
||||
|
@ -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' */}
|
||||
};
|
||||
|
||||
const UCollationResult CollationDanishTest::results[] = {
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
const Collator::EComparisonResult CollationDanishTest::results[] = {
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
/* test primary > 5*/
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL
|
||||
Collator::EQUAL,
|
||||
Collator::LESS,
|
||||
Collator::EQUAL
|
||||
};
|
||||
|
||||
const UChar CollationDanishTest::testBugs[][CollationDanishTest::MAX_TOKEN_LEN] = {
|
||||
@ -202,13 +202,13 @@ void CollationDanishTest::TestTertiary(/* char* par */)
|
||||
logln("Test internet data list : ");
|
||||
for (i = 0; i < 53; i++) {
|
||||
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 : ");
|
||||
for (i = 0; i < 52; i++) {
|
||||
for (j = i+1; j < 53; j++) {
|
||||
doTest(myCollation, testNTList[i], testNTList[j], UCOL_LESS);
|
||||
doTest(myCollation, testNTList[i], testNTList[j], Collator::LESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
static const UChar testNTList[][MAX_TOKEN_LEN];
|
||||
static const UChar testSourceCases[][MAX_TOKEN_LEN];
|
||||
static const UChar testTargetCases[][MAX_TOKEN_LEN];
|
||||
static const UCollationResult results[];
|
||||
static const Collator::EComparisonResult results[];
|
||||
|
||||
Collator *myCollation;
|
||||
};
|
||||
|
@ -106,15 +106,15 @@ DataDrivenCollatorTest::getNextInSequence(SeqElement &el) {
|
||||
case CharacterIterator::DONE:
|
||||
break;
|
||||
case 0x003C /* < */:
|
||||
el.relation = UCOL_LESS;
|
||||
el.relation = Collator::LESS;
|
||||
currChar = CharacterIterator::DONE;
|
||||
break;
|
||||
case 0x003D /* = */:
|
||||
el.relation = UCOL_EQUAL;
|
||||
el.relation = Collator::EQUAL;
|
||||
currChar = CharacterIterator::DONE;
|
||||
break;
|
||||
case 0x003E /* > */:
|
||||
el.relation = UCOL_GREATER;
|
||||
el.relation = Collator::GREATER;
|
||||
currChar = CharacterIterator::DONE;
|
||||
break;
|
||||
case 0x0027 /* ' */: /* very basic quoting */
|
||||
@ -237,7 +237,7 @@ DataDrivenCollatorTest::processTest(TestData *testData) {
|
||||
|
||||
void
|
||||
DataDrivenCollatorTest::processSequence(Collator* col, const UnicodeString &sequence) {
|
||||
UCollationResult relation = UCOL_EQUAL;
|
||||
Collator::EComparisonResult relation = Collator::EQUAL;
|
||||
UBool hasNext;
|
||||
SeqElement *source = NULL;
|
||||
SeqElement *target = NULL;
|
||||
@ -251,12 +251,12 @@ DataDrivenCollatorTest::processSequence(Collator* col, const UnicodeString &sequ
|
||||
sequences.addElement(target, status);
|
||||
|
||||
do {
|
||||
relation = UCOL_EQUAL;
|
||||
relation = Collator::EQUAL;
|
||||
target = new SeqElement();
|
||||
hasNext = getNextInSequence(*target);
|
||||
for(j = sequences.size(); j > 0; j--) {
|
||||
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;
|
||||
}
|
||||
doTest(col, source->source, target->source, relation);
|
||||
|
@ -29,7 +29,7 @@
|
||||
class SeqElement {
|
||||
public:
|
||||
UnicodeString source;
|
||||
UCollationResult relation;
|
||||
Collator::EComparisonResult relation;
|
||||
};
|
||||
|
||||
class DataDrivenCollatorTest: public IntlTestCollator {
|
||||
|
@ -82,21 +82,21 @@ const UChar CollationGermanTest::testTargetCases[][CollationGermanTest::MAX_TOKE
|
||||
{0x53, 0x74, 0x72, 0x61, 0x73, 0x73, 0x65, 0}
|
||||
};
|
||||
|
||||
const UCollationResult CollationGermanTest::results[][2] =
|
||||
const Collator::EComparisonResult CollationGermanTest::results[][2] =
|
||||
{
|
||||
// Primary Tertiary
|
||||
{ UCOL_LESS, UCOL_LESS },
|
||||
{ UCOL_EQUAL, UCOL_LESS },
|
||||
{ UCOL_GREATER, UCOL_GREATER },
|
||||
{ UCOL_GREATER, UCOL_GREATER },
|
||||
{ UCOL_GREATER, UCOL_GREATER },
|
||||
{ UCOL_EQUAL, UCOL_LESS },
|
||||
{ UCOL_EQUAL, UCOL_EQUAL },
|
||||
{ UCOL_LESS, UCOL_LESS },
|
||||
{ UCOL_EQUAL, UCOL_GREATER },
|
||||
{ UCOL_EQUAL, UCOL_EQUAL },
|
||||
{ UCOL_LESS, UCOL_LESS },
|
||||
{ UCOL_EQUAL, UCOL_GREATER }
|
||||
{ Collator::LESS, Collator::LESS },
|
||||
{ Collator::EQUAL, Collator::LESS },
|
||||
{ Collator::GREATER, Collator::GREATER },
|
||||
{ Collator::GREATER, Collator::GREATER },
|
||||
{ Collator::GREATER, Collator::GREATER },
|
||||
{ Collator::EQUAL, Collator::LESS },
|
||||
{ Collator::EQUAL, Collator::EQUAL },
|
||||
{ Collator::LESS, Collator::LESS },
|
||||
{ Collator::EQUAL, Collator::GREATER },
|
||||
{ Collator::EQUAL, Collator::EQUAL },
|
||||
{ Collator::LESS, Collator::LESS },
|
||||
{ Collator::EQUAL, Collator::GREATER }
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
private:
|
||||
static const UChar testSourceCases[][MAX_TOKEN_LEN];
|
||||
static const UChar testTargetCases[][MAX_TOKEN_LEN];
|
||||
static const UCollationResult results[][2];
|
||||
static const Collator::EComparisonResult results[][2];
|
||||
|
||||
Collator *myCollation;
|
||||
};
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
const UCollationResult CollationEnglishTest::results[] = {
|
||||
UCOL_LESS,
|
||||
UCOL_LESS, /*Collator::GREATER,*/
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_GREATER,
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS, /*Collator::GREATER,*/ /* 10 */
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_GREATER,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS, /* 20 */
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_GREATER,
|
||||
UCOL_GREATER,
|
||||
const Collator::EComparisonResult CollationEnglishTest::results[] = {
|
||||
Collator::LESS,
|
||||
Collator::LESS, /*Collator::GREATER,*/
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::GREATER,
|
||||
Collator::EQUAL,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS, /*Collator::GREATER,*/ /* 10 */
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::EQUAL,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::GREATER,
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS, /* 20 */
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::GREATER,
|
||||
Collator::GREATER,
|
||||
/* Test Tertiary > 26 */
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS, /* 30 */
|
||||
UCOL_GREATER,
|
||||
UCOL_EQUAL,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::LESS, /* 30 */
|
||||
Collator::GREATER,
|
||||
Collator::EQUAL,
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
/* test identical > 36 */
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
/* test primary > 38 */
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL, /* 40 */
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL, /* 40 */
|
||||
Collator::LESS,
|
||||
Collator::EQUAL,
|
||||
Collator::EQUAL,
|
||||
/* test secondary > 43 */
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS // 49
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::EQUAL,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS // 49
|
||||
};
|
||||
|
||||
const UChar CollationEnglishTest::testBugs[][CollationEnglishTest::MAX_TOKEN_LEN] = {
|
||||
@ -254,23 +254,23 @@ void CollationEnglishTest::TestTertiary(/* char* par */)
|
||||
{
|
||||
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
|
||||
UCollationResult expected;
|
||||
Collator::EComparisonResult expected;
|
||||
const int32_t testMoreSize = (int32_t)(sizeof(testMore) / sizeof(testMore[0]));
|
||||
for (i = 0; i < testMoreSize; i++)
|
||||
{
|
||||
for (j = 0; j < testMoreSize; j++)
|
||||
{
|
||||
if (i < j)
|
||||
expected = UCOL_LESS;
|
||||
expected = Collator::LESS;
|
||||
else if (i == j)
|
||||
expected = UCOL_EQUAL;
|
||||
expected = Collator::EQUAL;
|
||||
else // (i > j)
|
||||
expected = UCOL_GREATER;
|
||||
expected = Collator::GREATER;
|
||||
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)
|
||||
int32_t j;
|
||||
UCollationResult expected;
|
||||
Collator::EComparisonResult expected;
|
||||
const int32_t testAcuteSize = (int32_t)(sizeof(testAcute) / sizeof(testAcute[0]));
|
||||
for (i = 0; i < testAcuteSize; i++)
|
||||
{
|
||||
for (j = 0; j < testAcuteSize; j++)
|
||||
{
|
||||
if (i < j)
|
||||
expected = UCOL_LESS;
|
||||
expected = Collator::LESS;
|
||||
else if (i == j)
|
||||
expected = UCOL_EQUAL;
|
||||
expected = Collator::EQUAL;
|
||||
else // (i > j)
|
||||
expected = UCOL_GREATER;
|
||||
expected = Collator::GREATER;
|
||||
doTest(myCollation, testAcute[i], testAcute[j], expected );
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ private:
|
||||
static const UChar testBugs[][MAX_TOKEN_LEN];
|
||||
static const UChar testSourceCases[][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];
|
||||
|
||||
Collator *myCollation;
|
||||
|
@ -67,17 +67,17 @@ const UChar CollationSpanishTest::testTargetCases[][CollationSpanishTest::MAX_TO
|
||||
{0x68, 0x65, 0x6c, 0x6c, 0x4f, 0},
|
||||
};
|
||||
|
||||
const UCollationResult CollationSpanishTest::results[] = {
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
const Collator::EComparisonResult CollationSpanishTest::results[] = {
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
// test primary > 5
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL
|
||||
Collator::LESS,
|
||||
Collator::EQUAL,
|
||||
Collator::LESS,
|
||||
Collator::EQUAL
|
||||
};
|
||||
|
||||
void CollationSpanishTest::TestTertiary(/* char* par */)
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
private:
|
||||
static const UChar testSourceCases[][MAX_TOKEN_LEN];
|
||||
static const UChar testTargetCases[][MAX_TOKEN_LEN];
|
||||
static const UCollationResult results[];
|
||||
static const Collator::EComparisonResult results[];
|
||||
|
||||
Collator *myCollation;
|
||||
};
|
||||
|
@ -58,13 +58,13 @@ const UChar CollationFinnishTest::testTargetCases[][CollationFinnishTest::MAX_TO
|
||||
{0x76, 0x61, 0x74, 0}
|
||||
};
|
||||
|
||||
const UCollationResult CollationFinnishTest::results[] = {
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
const Collator::EComparisonResult CollationFinnishTest::results[] = {
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
// test primary > 4
|
||||
UCOL_EQUAL,
|
||||
Collator::EQUAL,
|
||||
};
|
||||
|
||||
void CollationFinnishTest::TestTertiary(/* char* par */)
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
private:
|
||||
static const UChar testSourceCases[][MAX_TOKEN_LEN];
|
||||
static const UChar testTargetCases[][MAX_TOKEN_LEN];
|
||||
static const UCollationResult results[];
|
||||
static const Collator::EComparisonResult results[];
|
||||
|
||||
Collator *myCollation;
|
||||
};
|
||||
|
@ -73,20 +73,20 @@ const UChar CollationFrenchTest::testTargetCases[][CollationFrenchTest::MAX_TOKE
|
||||
{0x01df, 0x0000}
|
||||
};
|
||||
|
||||
const UCollationResult CollationFrenchTest::results[] =
|
||||
const Collator::EComparisonResult CollationFrenchTest::results[] =
|
||||
{
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS, /*Collator::GREATER,*/
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS, /*Collator::GREATER,*/
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS, /*Collator::GREATER,*/
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::LESS, /*Collator::GREATER,*/
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::LESS
|
||||
};
|
||||
|
||||
// 0x0300 is grave, 0x0301 is acute
|
||||
@ -158,7 +158,7 @@ void CollationFrenchTest::TestSecondary(/* char* par */)
|
||||
//test acute and grave ordering
|
||||
int32_t i = 0;
|
||||
int32_t j;
|
||||
UCollationResult expected;
|
||||
Collator::EComparisonResult expected;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
//myCollation->setAttribute(UCOL_FRENCH_COLLATION, UCOL_ON, status);
|
||||
myCollation->setStrength(Collator::SECONDARY);
|
||||
@ -172,11 +172,11 @@ void CollationFrenchTest::TestSecondary(/* char* par */)
|
||||
for (j = 0; j < testAcuteSize; j++)
|
||||
{
|
||||
if (i < j)
|
||||
expected = UCOL_LESS;
|
||||
expected = Collator::LESS;
|
||||
else if (i == j)
|
||||
expected = UCOL_EQUAL;
|
||||
expected = Collator::EQUAL;
|
||||
else // (i > j)
|
||||
expected = UCOL_GREATER;
|
||||
expected = Collator::GREATER;
|
||||
doTest(myCollation, testAcute[i], testAcute[j], expected );
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ void CollationFrenchTest::TestExtra(/* char* par */)
|
||||
{
|
||||
for (j = i + 1; j < 10; j += 1)
|
||||
{
|
||||
doTest(myCollation, testBugs[i], testBugs[j], UCOL_LESS);
|
||||
doTest(myCollation, testBugs[i], testBugs[j], Collator::LESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
static const UChar testSourceCases[][MAX_TOKEN_LEN];
|
||||
static const UChar testTargetCases[][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];
|
||||
|
||||
Collator *myCollation;
|
||||
|
@ -140,7 +140,7 @@ void G7CollationTest::TestG7Locales(/* char* par */)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
doTest(myCollation, testCases[results[11][j]], testCases[results[11][n]], UCOL_LESS);
|
||||
doTest(myCollation, testCases[results[11][j]], testCases[results[11][n]], Collator::LESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,13 @@ const UChar CollationKanaTest::testTargetCases[][CollationKanaTest::MAX_TOKEN_LE
|
||||
{0x3042, 0x3042, 0x3068, 0x0000} /* 6 */
|
||||
};
|
||||
|
||||
const UCollationResult CollationKanaTest::results[] = {
|
||||
UCOL_LESS,
|
||||
UCOL_EQUAL, //Collator::LESS, /* Katakanas and Hiraganas are equal on tertiary level(ICU 2.0)*/
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER, // Collator::LESS, /* Prolonged sound mark sorts BEFORE equivalent vowel (ICU 2.0)*/
|
||||
UCOL_LESS,
|
||||
UCOL_LESS, //Collator::GREATER /* Prolonged sound mark sorts BEFORE equivalent vowel (ICU 2.0)*//* 6 */
|
||||
const Collator::EComparisonResult CollationKanaTest::results[] = {
|
||||
Collator::LESS,
|
||||
Collator::EQUAL, //Collator::LESS, /* Katakanas and Hiraganas are equal on tertiary level(ICU 2.0)*/
|
||||
Collator::LESS,
|
||||
Collator::GREATER, // Collator::LESS, /* Prolonged sound mark sorts BEFORE equivalent vowel (ICU 2.0)*/
|
||||
Collator::LESS,
|
||||
Collator::LESS, //Collator::GREATER /* Prolonged sound mark sorts BEFORE equivalent vowel (ICU 2.0)*//* 6 */
|
||||
};
|
||||
|
||||
const UChar CollationKanaTest::testBaseCases[][CollationKanaTest::MAX_TOKEN_LEN] = {
|
||||
@ -121,7 +121,7 @@ void CollationKanaTest::TestBase()
|
||||
int32_t i;
|
||||
myCollation->setStrength(Collator::PRIMARY);
|
||||
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 */
|
||||
@ -131,7 +131,7 @@ void CollationKanaTest::TestPlainDakutenHandakuten(void)
|
||||
myCollation->setStrength(Collator::SECONDARY);
|
||||
for (i = 0; i < 3 ; i++)
|
||||
doTest(myCollation, testPlainDakutenHandakutenCases[i], testPlainDakutenHandakutenCases[i + 1],
|
||||
UCOL_LESS);
|
||||
Collator::LESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -144,7 +144,7 @@ void CollationKanaTest::TestSmallLarge(void)
|
||||
myCollation->setStrength(Collator::TERTIARY);
|
||||
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
|
||||
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);
|
||||
for (i = 0; i < 3 ; i++) {
|
||||
doTest(myCollation, testKatakanaHiraganaCases[i], testKatakanaHiraganaCases[i + 1],
|
||||
UCOL_LESS);
|
||||
Collator::LESS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ void CollationKanaTest::TestChooonKigoo(void)
|
||||
myCollation->setStrength(Collator::QUATERNARY);
|
||||
myCollation->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
|
||||
for (i = 0; i < 7 ; i++) {
|
||||
doTest(myCollation, testChooonKigooCases[i], testChooonKigooCases[i + 1], UCOL_LESS);
|
||||
doTest(myCollation, testChooonKigooCases[i], testChooonKigooCases[i + 1], Collator::LESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
private:
|
||||
static const UChar testSourceCases[][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 testPlainDakutenHandakutenCases[][MAX_TOKEN_LEN];
|
||||
static const UChar testSmallLargeCases[][MAX_TOKEN_LEN];
|
||||
|
@ -50,8 +50,8 @@ const UChar LotusCollationKoreanTest::testTargetCases[][LotusCollationKoreanTest
|
||||
{0xac01, 0}
|
||||
};
|
||||
|
||||
const UCollationResult LotusCollationKoreanTest::results[] = {
|
||||
UCOL_LESS
|
||||
const Collator::EComparisonResult LotusCollationKoreanTest::results[] = {
|
||||
Collator::LESS
|
||||
};
|
||||
|
||||
void LotusCollationKoreanTest::TestTertiary(/* char* par */)
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
private:
|
||||
static const UChar testSourceCases[][MAX_TOKEN_LEN];
|
||||
static const UChar testTargetCases[][MAX_TOKEN_LEN];
|
||||
static const UCollationResult results[];
|
||||
static const Collator::EComparisonResult results[];
|
||||
|
||||
Collator *myCollation;
|
||||
};
|
||||
|
@ -228,7 +228,7 @@ void CollationMonkeyTest::TestRules(/* char* par */){
|
||||
return;
|
||||
}
|
||||
for(i=0; i<2; i++){
|
||||
doTest(myCollation, testSourceCases[i], testTargetCases[i], UCOL_LESS);
|
||||
doTest(myCollation, testSourceCases[i], testTargetCases[i], Collator::LESS);
|
||||
}
|
||||
delete myCollation;
|
||||
|
||||
@ -243,7 +243,7 @@ void CollationMonkeyTest::TestRules(/* char* par */){
|
||||
return;
|
||||
}
|
||||
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 col;
|
||||
|
@ -545,9 +545,9 @@ void CollationRegressionTest::Test4078588(/* char *par */)
|
||||
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
|
||||
+ (UnicodeString)"; expected -1");
|
||||
@ -1072,7 +1072,7 @@ void CollationRegressionTest::compareArray(Collator &c,
|
||||
int32_t testCount)
|
||||
{
|
||||
int32_t i;
|
||||
UCollationResult expectedResult = UCOL_EQUAL;
|
||||
Collator::EComparisonResult expectedResult = Collator::EQUAL;
|
||||
|
||||
for (i = 0; i < testCount; i += 3)
|
||||
{
|
||||
@ -1082,15 +1082,15 @@ void CollationRegressionTest::compareArray(Collator &c,
|
||||
|
||||
if (comparison == "<")
|
||||
{
|
||||
expectedResult = UCOL_LESS;
|
||||
expectedResult = Collator::LESS;
|
||||
}
|
||||
else if (comparison == ">")
|
||||
{
|
||||
expectedResult = UCOL_GREATER;
|
||||
expectedResult = Collator::GREATER;
|
||||
}
|
||||
else if (comparison == "=")
|
||||
{
|
||||
expectedResult = UCOL_EQUAL;
|
||||
expectedResult = Collator::EQUAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1099,7 +1099,7 @@ void CollationRegressionTest::compareArray(Collator &c,
|
||||
errln(bogus1 + comparison + bogus2);
|
||||
}
|
||||
|
||||
UCollationResult compareResult = c.compare(source, target);
|
||||
Collator::EComparisonResult compareResult = c.compare(source, target);
|
||||
|
||||
CollationKey sourceKey, targetKey;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@ -1120,7 +1120,7 @@ void CollationRegressionTest::compareArray(Collator &c,
|
||||
continue;
|
||||
}
|
||||
|
||||
UCollationResult keyResult = sourceKey.compareTo(targetKey);
|
||||
Collator::EComparisonResult keyResult = sourceKey.compareTo(targetKey);
|
||||
|
||||
reportCResult( source, target, sourceKey, targetKey, compareResult, keyResult, compareResult, expectedResult );
|
||||
|
||||
|
@ -155,7 +155,7 @@ void CollationThaiTest::TestNamesList(void) {
|
||||
}
|
||||
|
||||
if (lastWord.length() > 0) {
|
||||
UCollationResult result = coll->compare(lastWord, word);
|
||||
Collator::EComparisonResult result = coll->compare(lastWord, word);
|
||||
doTest(coll, lastWord, word, result);
|
||||
}
|
||||
lastWord = word;
|
||||
@ -222,7 +222,7 @@ void CollationThaiTest::TestDictionary(void) {
|
||||
|
||||
if (lastWord.length() > 0) {
|
||||
// line enabled for j2720
|
||||
doTest(coll, lastWord, word, UCOL_LESS);
|
||||
doTest(coll, lastWord, word, Collator::LESS);
|
||||
int32_t result = coll->compare(lastWord, word);
|
||||
|
||||
if (result >= 0) {
|
||||
|
@ -70,19 +70,19 @@ const UChar CollationTurkishTest::testTargetCases[][CollationTurkishTest::MAX_TO
|
||||
{0x49, 0x64, 0x65, 0x61, 0}
|
||||
};
|
||||
|
||||
const UCollationResult CollationTurkishTest::results[] = {
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER,
|
||||
const Collator::EComparisonResult CollationTurkishTest::results[] = {
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::GREATER,
|
||||
// test priamry > 8
|
||||
UCOL_LESS,
|
||||
UCOL_LESS,
|
||||
UCOL_GREATER
|
||||
Collator::LESS,
|
||||
Collator::LESS,
|
||||
Collator::GREATER
|
||||
};
|
||||
|
||||
void CollationTurkishTest::TestTertiary(/* char* par */)
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
// static constants
|
||||
static const UChar testSourceCases[][MAX_TOKEN_LEN];
|
||||
static const UChar testTargetCases[][MAX_TOKEN_LEN];
|
||||
static const UCollationResult results[];
|
||||
static const Collator::EComparisonResult results[];
|
||||
|
||||
Collator *myCollation;
|
||||
};
|
||||
|
@ -351,13 +351,13 @@ IntlTestCollator::compareUsingPartials(UCollator *coll, const UChar source[], in
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
UCollator *myCollation = (UCollator *)((RuleBasedCollator *)col)->getUCollator();
|
||||
|
||||
UCollationResult compareResult = col->compare(source, target);
|
||||
Collator::EComparisonResult compareResult = col->compare(source, target);
|
||||
|
||||
CollationKey srckey, tgtkey;
|
||||
col->getCollationKey(source, srckey, status);
|
||||
@ -365,7 +365,7 @@ IntlTestCollator::doTestVariant(Collator* col, const UnicodeString &source, cons
|
||||
if (U_FAILURE(status)){
|
||||
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);
|
||||
|
||||
@ -464,18 +464,18 @@ IntlTestCollator::doTestVariant(Collator* col, const UnicodeString &source, cons
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
if(result == UCOL_LESS) {
|
||||
doTestVariant(col, target, source, UCOL_GREATER);
|
||||
} else if (result == UCOL_GREATER) {
|
||||
doTestVariant(col, target, source, UCOL_LESS);
|
||||
if(result == Collator::LESS) {
|
||||
doTestVariant(col, target, source, Collator::GREATER);
|
||||
} else if (result == Collator::GREATER) {
|
||||
doTestVariant(col, target, source, Collator::LESS);
|
||||
}
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@ -494,10 +494,10 @@ IntlTestCollator::doTest(Collator* col, const UnicodeString &source, const Unico
|
||||
void
|
||||
IntlTestCollator::reportCResult( const UnicodeString &source, const UnicodeString &target,
|
||||
CollationKey &sourceKey, CollationKey &targetKey,
|
||||
UCollationResult compareResult,
|
||||
UCollationResult keyResult,
|
||||
UCollationResult incResult,
|
||||
UCollationResult expectedResult )
|
||||
Collator::EComparisonResult compareResult,
|
||||
Collator::EComparisonResult keyResult,
|
||||
Collator::EComparisonResult incResult,
|
||||
Collator::EComparisonResult expectedResult )
|
||||
{
|
||||
if (expectedResult < -1 || expectedResult > 1)
|
||||
{
|
||||
@ -563,18 +563,18 @@ IntlTestCollator::reportCResult( const UnicodeString &source, const UnicodeStrin
|
||||
}
|
||||
|
||||
UnicodeString&
|
||||
IntlTestCollator::appendCompareResult(UCollationResult result,
|
||||
IntlTestCollator::appendCompareResult(Collator::EComparisonResult result,
|
||||
UnicodeString& target)
|
||||
{
|
||||
if (result == UCOL_LESS)
|
||||
if (result == Collator::LESS)
|
||||
{
|
||||
target += "LESS";
|
||||
}
|
||||
else if (result == UCOL_EQUAL)
|
||||
else if (result == Collator::EQUAL)
|
||||
{
|
||||
target += "EQUAL";
|
||||
}
|
||||
else if (result == UCOL_GREATER)
|
||||
else if (result == Collator::GREATER)
|
||||
{
|
||||
target += "GREATER";
|
||||
}
|
||||
|
@ -28,19 +28,19 @@ class IntlTestCollator: public IntlTest {
|
||||
void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL );
|
||||
protected:
|
||||
// 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 doTestVariant(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, Collator::EComparisonResult result);
|
||||
virtual void reportCResult( const UnicodeString &source, const UnicodeString &target,
|
||||
CollationKey &sourceKey, CollationKey &targetKey,
|
||||
UCollationResult compareResult,
|
||||
UCollationResult keyResult,
|
||||
UCollationResult incResult,
|
||||
UCollationResult expectedResult );
|
||||
Collator::EComparisonResult compareResult,
|
||||
Collator::EComparisonResult keyResult,
|
||||
Collator::EComparisonResult incResult,
|
||||
Collator::EComparisonResult expectedResult );
|
||||
|
||||
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);
|
||||
/**
|
||||
* Return an integer array containing all of the collation orders
|
||||
|
Loading…
Reference in New Issue
Block a user