ICU-2118 improve coverage; add CurrencyTest

X-SVN-Rev: 10733
This commit is contained in:
Alan Liu 2002-12-18 19:58:25 +00:00
parent 9be5d1a24e
commit fa5567b3be
2 changed files with 51 additions and 2 deletions

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/TestAll.java,v $
* $Date: 2002/11/25 22:11:47 $
* $Revision: 1.43 $
* $Date: 2002/12/18 19:58:25 $
* $Revision: 1.44 $
*
*****************************************************************************************
*/
@ -216,6 +216,7 @@ public class TestAll extends TestFmwk {
new com.ibm.icu.dev.test.util.ICUListResourceBundleTest(),
new com.ibm.icu.dev.test.util.CompactArrayTest(),
new com.ibm.icu.dev.test.util.StringTokenizerTest(),
new com.ibm.icu.dev.test.util.CurrencyTest(),
});
}
public void TestMath() throws Exception{

View File

@ -0,0 +1,48 @@
/*
**********************************************************************
* Copyright (c) 2002, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
* Created: December 18 2002
* Since: ICU 2.4
**********************************************************************
*/
package com.ibm.icu.dev.test.util;
import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.util.*;
import java.util.Locale;
/**
* @test
* @summary General test of Currency
*/
public class CurrencyTest extends TestFmwk {
public static void main(String[] args) throws Exception {
new CurrencyTest().run(args);
}
/**
* Test of basic API.
*/
public void TestAPI() {
Currency usd = Currency.getInstance("USD");
int hash = usd.hashCode();
Currency jpy = Currency.getInstance("JPY");
if (usd.equals(jpy)) {
errln("FAIL: USD == JPY");
}
if (usd.equals("abc")) {
errln("FAIL: USD == (String)");
}
if (usd.equals(null)) {
errln("FAIL: USD == (null)");
}
if (!usd.equals(usd)) {
errln("FAIL: USD != USD");
}
Locale[] avail = Currency.getAvailableLocales();
}
}