/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2002-2006, International Business Machines Corporation and
+ * Copyright (c) 2002-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************
*
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
// 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);
// 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)) {
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()) {
//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;
}
it.setSource(s, status);
- while (TRUE) {
+ for (;;) {
UnicodeString item = it.next();
if (item.isBogus()) break;
if (item == s) gotSource = TRUE;
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) {