X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/73c04bcfe1096173b00431f0cdc742894b15eef0..e4f10fab0c078f399c9deef476d9c9b73b47dff8:/icuSources/test/intltest/canittst.cpp?ds=sidebyside diff --git a/icuSources/test/intltest/canittst.cpp b/icuSources/test/intltest/canittst.cpp index 8e97744c..5fe7c174 100644 --- a/icuSources/test/intltest/canittst.cpp +++ b/icuSources/test/intltest/canittst.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2002-2006, International Business Machines Corporation and + * Copyright (c) 2002-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************** * @@ -71,6 +71,10 @@ CanonicalIteratorTest::~CanonicalIteratorTest() void CanonicalIteratorTest::TestExhaustive() { UErrorCode status = U_ZERO_ERROR; CanonicalIterator it("", status); + if (U_FAILURE(status)) { + dataerrln("Error creating CanonicalIterator: %s", u_errorName(status)); + return; + } UChar32 i = 0; UnicodeString s; // Test static and dynamic class IDs @@ -126,7 +130,7 @@ void CanonicalIteratorTest::TestBasic() { // NOTE: we use a TreeSet below to sort the output, which is not guaranteed to be sorted! Hashtable *permutations = new Hashtable(FALSE, status); - permutations->setValueDeleter(uhash_deleteUnicodeString); + permutations->setValueDeleter(uprv_deleteUObject); UnicodeString toPermute("ABC"); CanonicalIterator::permute(toPermute, FALSE, permutations, status); @@ -140,7 +144,7 @@ void CanonicalIteratorTest::TestBasic() { // try samples logln("testing samples"); Hashtable *set = new Hashtable(FALSE, status); - set->setValueDeleter(uhash_deleteUnicodeString); + set->setValueDeleter(uprv_deleteUObject); int32_t i = 0; CanonicalIterator it("", status); if(U_SUCCESS(status)) { @@ -149,7 +153,7 @@ void CanonicalIteratorTest::TestBasic() { UnicodeString testStr = CharsToUnicodeString(testArray[i][0]); it.setSource(testStr, status); set->removeAll(); - while (TRUE) { + for (;;) { //UnicodeString *result = new UnicodeString(it.next()); UnicodeString result(it.next()); if (result.isBogus()) { @@ -159,11 +163,11 @@ void CanonicalIteratorTest::TestBasic() { //logln(++counter + ": " + hex.transliterate(result)); //logln(" = " + name.transliterate(result)); } - expectEqual(i + ": ", testStr, collectionToString(set), CharsToUnicodeString(testArray[i][1])); + expectEqual(i + UnicodeString(": "), testStr, collectionToString(set), CharsToUnicodeString(testArray[i][1])); } } else { - errln("Couldn't instantiate canonical iterator. Error: %s", u_errorName(status)); + dataerrln("Couldn't instantiate canonical iterator. Error: %s", u_errorName(status)); } delete set; } @@ -187,7 +191,7 @@ void CanonicalIteratorTest::characterTest(UnicodeString &s, UChar32 ch, Canonica it.setSource(s, status); - while (TRUE) { + for (;;) { UnicodeString item = it.next(); if (item.isBogus()) break; if (item == s) gotSource = TRUE; @@ -303,6 +307,10 @@ void CanonicalIteratorTest::TestAPI() { logln("Testing CanonicalIterator::getSource"); logln("Instantiating canonical iterator with string "+start); CanonicalIterator can(start, status); + if (U_FAILURE(status)) { + dataerrln("Error creating CanonicalIterator: %s", u_errorName(status)); + return; + } UnicodeString source = can.getSource(); logln("CanonicalIterator::getSource returned "+source); if(start != source) {