UListNode *tail;
int32_t size;
- int32_t currentIndex;
};
static void ulist_addFirstItem(UList *list, UListNode *newItem);
newList->head = NULL;
newList->tail = NULL;
newList->size = 0;
- newList->currentIndex = -1;
return newList;
}
} else {
p->next->previous = p->previous;
}
- list->curr = NULL;
- list->currentIndex = 0;
+ if (p == list->curr) {
+ list->curr = p->next;
+ }
--list->size;
if (p->forceDelete) {
uprv_free(p->data);
newItem->next = list->head;
list->head->previous = newItem;
list->head = newItem;
- list->currentIndex++;
}
list->size++;
curr = list->curr;
list->curr = curr->next;
- list->currentIndex++;
return curr->data;
}
U_CAPI void U_EXPORT2 ulist_resetList(UList *list) {
if (list != NULL) {
list->curr = list->head;
- list->currentIndex = 0;
}
}
U_CAPI UList * U_EXPORT2 ulist_getListFromEnum(UEnumeration *en) {
return (UList *)(en->context);
}
-
logln("Test ctors : ");
col = Collator::createInstance(Locale::getEnglish(), success);
if (U_FAILURE(success)){
- errcheckln(success, "Default Collator creation failed. - %s", u_errorName(success));
+ errcheckln(success, "English Collator creation failed. - %s", u_errorName(success));
return;
}
- StringEnumeration* kwEnum = col->getKeywordValuesForLocale("", Locale::getEnglish(),true,success);
- if (U_FAILURE(success)){
- errcheckln(success, "Get Keyword Values for Locale failed. - %s", u_errorName(success));
- return;
- }
- delete kwEnum;
-
col->getVersion(versionArray);
// Check for a version greater than some value rather than equality
// so that we need not update the expected version each time.
delete junk;
}
+void CollationAPITest::TestKeywordValues() {
+ IcuTestErrorCode errorCode(*this, "TestKeywordValues");
+ LocalPointer<Collator> col(Collator::createInstance(Locale::getEnglish(), errorCode));
+ if (errorCode.logIfFailureAndReset("English Collator creation failed")) {
+ return;
+ }
+
+ LocalPointer<StringEnumeration> kwEnum(
+ col->getKeywordValuesForLocale("collation", Locale::getEnglish(), TRUE, errorCode));
+ if (errorCode.logIfFailureAndReset("Get Keyword Values for English Collator failed")) {
+ return;
+ }
+ assertTrue("expect at least one collation tailoring for English", kwEnum->count(errorCode) > 0);
+ const char *kw;
+ UBool hasStandard = FALSE;
+ while ((kw = kwEnum->next(NULL, errorCode)) != NULL) {
+ if (strcmp(kw, "standard") == 0) {
+ hasStandard = TRUE;
+ }
+ }
+ assertTrue("expect at least the 'standard' collation tailoring for English", hasStandard);
+}
+
void
CollationAPITest::TestRuleBasedColl()
{
if (exec) logln("TestSuite CollationAPITest: ");
TESTCASE_AUTO_BEGIN;
TESTCASE_AUTO(TestProperty);
+ TESTCASE_AUTO(TestKeywordValues);
TESTCASE_AUTO(TestOperators);
TESTCASE_AUTO(TestDuplicate);
TESTCASE_AUTO(TestCompare);