X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..151279e3792e85d0417b499c229886b3af724f55:/icuSources/test/intltest/itercoll.cpp diff --git a/icuSources/test/intltest/itercoll.cpp b/icuSources/test/intltest/itercoll.cpp index 8596b2a7..3040c456 100644 --- a/icuSources/test/intltest/itercoll.cpp +++ b/icuSources/test/intltest/itercoll.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2003, International Business Machines Corporation and + * Copyright (c) 1997-2009, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -30,7 +30,7 @@ CollationIteratorTest::CollationIteratorTest() 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; } @@ -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); @@ -628,7 +639,7 @@ void CollationIteratorTest::runIndexedTest(int32_t index, UBool exec, const char default: name = ""; break; } } else { - errln("Class iterator not instantiated"); + dataerrln("Class iterator not instantiated"); name = ""; } }