/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2003, International Business Machines Corporation and
+ * Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
if(U_FAILURE(status)) {
delete en_us;
en_us = 0;
- errln("Collator creation failed with %s", u_errorName(status));
+ errcheckln(status, "Collator creation failed with %s", u_errorName(status));
return;
}
void CollationIteratorTest::TestOffset(/* char* par */)
{
CollationElementIterator *iter = en_us->createCollationElementIterator(test1);
+ UErrorCode status = U_ZERO_ERROR;
+ // testing boundaries
+ iter->setOffset(0, status);
+ if (U_FAILURE(status) || iter->previous(status) != UCOL_NULLORDER) {
+ errln("Error: After setting offset to 0, we should be at the end "
+ "of the backwards iteration");
+ }
+ iter->setOffset(test1.length(), status);
+ if (U_FAILURE(status) || iter->next(status) != UCOL_NULLORDER) {
+ errln("Error: After setting offset to end of the string, we should "
+ "be at the end of the backwards iteration");
+ }
// Run all the way through the iterator, then get the offset
int32_t orderLength = 0;
- int32_t *orders = getOrders(*iter, orderLength);
+ Order *orders = getOrders(*iter, orderLength);
int32_t offset = iter->getOffset();
// Now set the offset back to the beginning and see if it works
CollationElementIterator *pristine = en_us->createCollationElementIterator(test1);
- UErrorCode status = U_ZERO_ERROR;
iter->setOffset(0, status);
default: name = ""; break;
}
} else {
- errln("Class iterator not instantiated");
+ dataerrln("Class iterator not instantiated");
name = "";
}
}