/***************************************************************************
*
-* Copyright (C) 2000-2003, International Business Machines
+* Copyright (C) 2000-2005, International Business Machines
* Corporation and others. All Rights Reserved.
*
************************************************************************
#if !UCONFIG_NO_TRANSLITERATION
-#include "ittrans.h"
#include "cpdtrtst.h"
#include "unicode/utypes.h"
#include "unicode/translit.h"
+#include "unicode/uniset.h"
#include "cpdtrans.h"
-#include "intltest.h"
#include "cmemory.h"
-#include <string.h>
-#include <stdio.h>
//---------------------------------------------
// runIndexedTest
CompoundTransliterator *ct1=new CompoundTransliterator("Halfwidth-Fullwidth;Fullwidth-Halfwidth", parseError, status);
CompoundTransliterator *ct2=new CompoundTransliterator("Any-Hex;Hex-Any;Cyrillic-Latin;Latin-Cyrillic", parseError, status);
CompoundTransliterator *ct3=(CompoundTransliterator*)ct1;
+ if (U_FAILURE(status)) {
+ errln("FAILED: CompoundTransliterator constructor failed");
+ return;
+ }
CompoundTransliterator *ct4=new CompoundTransliterator("Latin-Devanagari", parseError, status);
CompoundTransliterator *ct5=new CompoundTransliterator(*ct4);
if (U_FAILURE(status)) {
errln("FAILED: CompoundTransliterator constructor failed");
- } else
+ return;
+ }
if(ct1->getCount() == ct2->getCount() || ct1->getCount() != ct3->getCount() ||
ct2->getCount() == ct3->getCount() ||
ct4->getCount() != ct5->getCount() || ct4->getCount() == ct1->getCount() ||
ct5->getCount() == ct2->getCount() || ct5->getCount() == ct3->getCount() ) {
errln("Error: getCount() failed");
}
+
+ /* Quick test getTargetSet(), only test that it doesn't die. TODO: a better test. */
+ UnicodeSet ts;
+ UnicodeSet *retUS = NULL;
+ retUS = &ct1->getTargetSet(ts);
+ if (retUS != &ts || ts.size() == 0) {
+ errln("CompoundTransliterator::getTargetSet() failed.\n");
+ }
+
+ /* Quick test getSourceSet(), only test that it doesn't die. TODO: a better test. */
+ UnicodeSet ss;
+ retUS = NULL;
+ retUS = &ct1->getSourceSet(ss);
+ if (retUS != &ss || ss.size() == 0) {
+ errln("CompoundTransliterator::getSourceSet() failed.\n");
+ }
+
delete ct1;
delete ct2;
delete ct4;
errln("CompoundTransliterator construction failed");
}else {
#if 0
- // handleTransliterate is a protected method that was erroneously made
- // public. It is not public API that needs to be tested.
+ // handleTransliterate is a protected method that was erroneously made
+ // public. It is not public API that needs to be tested.
UnicodeString s("abcabc");
expect(*ct1, s, s);
UTransPosition index = { 0, 0, 0, 0 };