ICU-2118 improve method coverage

X-SVN-Rev: 12469
This commit is contained in:
Alan Liu 2003-06-11 20:00:12 +00:00
parent ee32ed417e
commit a319f87007
2 changed files with 41 additions and 4 deletions

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/translit/TransliteratorTest.java,v $
* $Date: 2003/06/03 18:49:31 $
* $Revision: 1.125 $
* $Date: 2003/06/11 20:00:12 $
* $Revision: 1.126 $
*
*****************************************************************************************
*/
@ -2881,6 +2881,16 @@ public class TransliteratorTest extends TestFmwk {
// NullTransliterator
Transliterator t = Transliterator.getInstance("Null", Transliterator.FORWARD);
expect(t, "a", "a");
// Source, target set
t = Transliterator.getInstance("Latin-Greek", Transliterator.FORWARD);
t.setFilter(new UnicodeSet("[A-Z]"));
logln("source = " + t.getSourceSet());
logln("target = " + t.getTargetSet());
t = Transliterator.createFromRules("x", "(.) > &Any-Hex($1);", Transliterator.FORWARD);
logln("source = " + t.getSourceSet());
logln("target = " + t.getTargetSet());
}
//======================================================================

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/translit/UnicodeSetTest.java,v $
* $Date: 2003/06/03 18:49:31 $
* $Revision: 1.49 $
* $Date: 2003/06/11 20:00:11 $
* $Revision: 1.50 $
*
*****************************************************************************************
*/
@ -509,6 +509,33 @@ public class UnicodeSetTest extends TestFmwk {
set.retain((char)0x73);
exp.applyPattern("[s]");
if (!set.equals(exp)) { errln("FAIL: retain('s')"); return; }
// ICU 2.6 coverage tests
// public final UnicodeSet retain(String s);
// public final UnicodeSet remove(int c);
// public final UnicodeSet remove(String s);
// public int hashCode();
set.applyPattern("[a-z{ab}{cd}]");
set.retain("cd");
exp.applyPattern("[{cd}]");
if (!set.equals(exp)) { errln("FAIL: retain(\"cd\")"); return; }
set.applyPattern("[a-z{ab}{cd}]");
set.remove((char)0x63);
exp.applyPattern("[abd-z{ab}{cd}]");
if (!set.equals(exp)) { errln("FAIL: remove('c')"); return; }
set.remove("cd");
exp.applyPattern("[abd-z{ab}]");
if (!set.equals(exp)) { errln("FAIL: remove(\"cd\")"); return; }
if (set.hashCode() != exp.hashCode()) {
errln("FAIL: hashCode() unequal");
}
exp.clear();
if (set.hashCode() == exp.hashCode()) {
errln("FAIL: hashCode() equal");
}
}
public void TestStrings() {