2 ******************************************************************************
\r
3 * Copyright (C) 2005-2008, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 ******************************************************************************
\r
7 package com.ibm.icu.tests;
\r
9 import junit.framework.TestCase;
\r
10 import com.ibm.icu.dev.test.TestAll;
\r
11 import com.ibm.icu.dev.test.TestFmwk;
\r
12 import com.ibm.icu.dev.test.TestFmwk.TestParams;
\r
14 //import com.ibm.icu.text.DateFormat;
\r
15 //import com.ibm.icu.util.Calendar;
\r
16 //import com.ibm.icu.util.GregorianCalendar;
\r
17 //import com.ibm.icu.util.TimeZone;
\r
18 //import com.ibm.icu.util.ULocale;
\r
20 public class UnitTest extends TestCase {
\r
22 public void testBidi() throws Exception {
\r
26 public void testCalendar() throws Exception {
\r
27 runUtility("Calendar");
\r
30 public void testCollator() throws Exception {
\r
31 runUtility("Collator");
\r
34 public void testCompression() throws Exception {
\r
35 runUtility("Compression");
\r
38 public void testDuration() throws Exception {
\r
39 runUtility("Duration");
\r
42 public void testDiagBigDecimal() throws Exception {
\r
43 runUtility("DiagBigDecimal");
\r
46 public void testFormat() throws Exception {
\r
47 runUtility("Format");
\r
50 public void testImpl() throws Exception {
\r
54 public void testNormalizer() throws Exception {
\r
55 runUtility("Normalizer");
\r
58 public void testProperty() throws Exception {
\r
59 runUtility("Property");
\r
62 public void testRBBI() throws Exception {
\r
66 public void testSearchTest() throws Exception {
\r
67 runUtility("SearchTest");
\r
70 public void testStringPrep() throws Exception {
\r
71 runUtility("StringPrep");
\r
74 public void testTestCharsetDetector() throws Exception {
\r
75 runUtility("TestCharsetDetector");
\r
78 public void testTestUCharacterIterator() throws Exception {
\r
79 runUtility("TestUCharacterIterator");
\r
82 public void testTimeScale() throws Exception {
\r
83 runUtility("TimeScale");
\r
86 public void testTimeZone() throws Exception {
\r
87 runUtility("TimeZone");
\r
90 public void testTranslit() throws Exception {
\r
91 runUtility("Translit");
\r
94 public void testUtil() throws Exception {
\r
98 public void runUtility(String testname) throws Exception {
\r
99 TestParams params = TestParams.create("-n", null);
\r
100 TestFmwk test = new TestAll();
\r
101 test.resolveTarget(params, testname).run();
\r
102 if (params.errorCount > 0) {
\r
103 fail(params.errorSummary.toString());
\r
107 // sample tests from ICU4J test suite
\r
110 // public void testCalendarSimple() throws Exception {
\r
111 // TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
\r
112 // GregorianCalendar gc = new GregorianCalendar(tz);
\r
113 // gc.set(2005,9,17,14,15,33);
\r
114 // Date time = gc.getTime();
\r
116 // final String[] calendars = {
\r
117 // "buddhist", "chinese", "coptic", "ethiopic", "gregorian",
\r
118 // "hebrew", "islamic", "islamic-civil", "japanese"
\r
120 // final String[] ustimes = {
\r
121 // "Monday, October 17, 2548 BE 2:15:33 PM PDT",
\r
122 // "Monday 22x78-9-15 2:15:33 PM PDT",
\r
123 // "Monday, Baba 7, 1722 2:15:33 PM PDT",
\r
124 // "Monday, Tekemt 7, 1998 2:15:33 PM PDT",
\r
125 // "Monday, October 17, 2005 2:15:33 PM PDT",
\r
126 // "Monday, Tishri 14, 5766 2:15:33 PM PDT",
\r
127 // "Monday, Ramadan 14, 1426 2:15:33 PM PDT",
\r
128 // "Monday, Ramadan 14, 1426 2:15:33 PM PDT",
\r
129 // "Monday, October 17, 17 Heisei 2:15:33 PM PDT",
\r
131 // final String[] detimes = {
\r
132 // "Montag, Oktober 17, 2548 BE 2:15:33 nachm. GMT-07:00",
\r
133 // "Montag 22x78-9-15 2:15:33 nachm. GMT-07:00",
\r
134 // "Montag, 7. Baba 1722 14:15 Uhr GMT-07:00",
\r
135 // "Montag, 7. Tekemt 1998 14:15 Uhr GMT-07:00",
\r
136 // "Montag, 17. Oktober 2005 14:15 Uhr GMT-07:00",
\r
137 // "Montag, 14. Tishri 5766 14:15 Uhr GMT-07:00",
\r
138 // "Montag, 14. Ramadan 1426 14:15 Uhr GMT-07:00",
\r
139 // "Montag, 14. Ramadan 1426 14:15 Uhr GMT-07:00",
\r
140 // "Montag, Oktober 17, 17 Heisei 2:15:33 nachm. GMT-07:00",
\r
143 // ULocale[] locales = {ULocale.US, ULocale.GERMANY };
\r
144 // String[][] times = { ustimes, detimes };
\r
145 // for (int j = 0; j < locales.length; ++j) {
\r
146 // ULocale ul = new ULocale("en_US");
\r
147 // for (int i = 0; i < calendars.length; ++i) {
\r
148 // ul = ul.setKeywordValue("calendar", calendars[i]);
\r
149 // Calendar cal = Calendar.getInstance(ul);
\r
150 // DateFormat fmt = cal.getDateTimeFormat(DateFormat.FULL, DateFormat.FULL, locales[j]);
\r
151 // String result = fmt.format(time);
\r
152 // System.out.println(calendars[i] + ": " + result);
\r
153 // if (!result.equals(times[j][i])) {
\r
154 // fail("calendar: " + calendars[i]);
\r