/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2003, International Business Machines Corporation and
+ * Copyright (c) 1997-2008, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
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);