]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/intltest/itercoll.cpp
ICU-400.38.tar.gz
[apple/icu.git] / icuSources / test / intltest / itercoll.cpp
index 8596b2a79f35e0acd3d7deb7317288e0b6f826f8..75db1125e37f6a6330f29a402e037f31c9cf777d 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2003, International Business Machines Corporation and
+ * Copyright (c) 1997-2008, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -173,10 +173,22 @@ void CollationIteratorTest::TestPrevious(/* char* par */)
 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();
 
@@ -190,7 +202,6 @@ void CollationIteratorTest::TestOffset(/* char* par */)
 
     // 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);