<pathelement location="${icu4j.tools.jar}"/>
</path>
- <target name="_all.core-tests" depends="_all.core, _all.test-framework, _all.tools">
+ <target name="_all.core-tests" depends="_all.core, _all.test-framework">
<ant dir="${icu4j.core-tests.dir}" inheritAll="false"/>
</target>
<!-- charset-tests -->
<path id="javac.classpathref.charset-tests">
<pathelement location="${icu4j.core.jar}"/>
+ <pathelement location="${icu4j.core-tests.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.test-framework.jar}"/>
</path>
<!-- translit-tests -->
<path id="javac.classpathref.translit-tests">
<pathelement location="${icu4j.core.jar}"/>
+ <pathelement location="${icu4j.core-tests.jar}"/>
<pathelement location="${icu4j.translit.jar}"/>
<pathelement location="${icu4j.test-framework.jar}"/>
</path>
<!-- perf -->
<path id="javac.classpathref.perf-tests">
<pathelement location="${icu4j.core.jar}"/>
+ <pathelement location="${icu4j.core-tests.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.collate.jar}"/>
<pathelement location="${icu4j.tools.jar}"/>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/.svn/" kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-charset"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-core"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-test-framework"/>
<attribute name="javadoc_location" value="jar:platform:/resource/external-libraries/JUnitParams-1.0.5-javadoc.jar!/"/>
</attributes>
</classpathentry>
+ <classpathentry combineaccessrules="false" kind="src" path="/icu4j-core-tests"/>
<classpathentry kind="output" path="out/bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/.svn/" kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-core"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-test-framework"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-langdata"/>
<attribute name="javadoc_location" value="jar:platform:/resource/external-libraries/JUnitParams-1.0.5-javadoc.jar!/"/>
</attributes>
</classpathentry>
- <classpathentry kind="src" path="/icu4j-tools"/>
<classpathentry kind="output" path="out/bin"/>
</classpath>
*/
@Test
public void Test4162587() {
- TimeZone tz = TimeZone.getTimeZone("PST");
- TimeZone.setDefault(tz);
- GregorianCalendar cal = new GregorianCalendar(tz);
- Date d;
+ TimeZone saveZone = TimeZone.getDefault();
- for (int i=0; i<5; ++i) {
- if (i>0) logln("---");
+ try {
+ TimeZone tz = TimeZone.getTimeZone("PST");
+ TimeZone.setDefault(tz);
+ GregorianCalendar cal = new GregorianCalendar(tz);
+ Date d;
- cal.clear();
- cal.set(1998, Calendar.APRIL, 5, i, 0);
- d = cal.getTime();
- String s0 = d.toString();
- logln("0 " + i + ": " + s0);
+ for (int i=0; i<5; ++i) {
+ if (i>0) logln("---");
- cal.clear();
- cal.set(1998, Calendar.APRIL, 4, i+24, 0);
- d = cal.getTime();
- String sPlus = d.toString();
- logln("+ " + i + ": " + sPlus);
+ cal.clear();
+ cal.set(1998, Calendar.APRIL, 5, i, 0);
+ d = cal.getTime();
+ String s0 = d.toString();
+ logln("0 " + i + ": " + s0);
- cal.clear();
- cal.set(1998, Calendar.APRIL, 6, i-24, 0);
- d = cal.getTime();
- String sMinus = d.toString();
- logln("- " + i + ": " + sMinus);
+ cal.clear();
+ cal.set(1998, Calendar.APRIL, 4, i+24, 0);
+ d = cal.getTime();
+ String sPlus = d.toString();
+ logln("+ " + i + ": " + sPlus);
+
+ cal.clear();
+ cal.set(1998, Calendar.APRIL, 6, i-24, 0);
+ d = cal.getTime();
+ String sMinus = d.toString();
+ logln("- " + i + ": " + sMinus);
- if (!s0.equals(sPlus) || !s0.equals(sMinus)) {
- errln("Fail: All three lines must match");
+ if (!s0.equals(sPlus) || !s0.equals(sMinus)) {
+ errln("Fail: All three lines must match");
+ }
}
+ } finally {
+ TimeZone.setDefault(saveZone);
}
}
*/
@Test
public void TestPatterns() {
+
final String[][] EXPECTED = {
{DateFormat.YEAR, "y","en","y"},
logln("time zone ex3 ok");
}
catch (Exception e) {
- // hmmm... this shouldn't happen. don't want to exit this
- // fn with timezone improperly set, so just in case
- TimeZone.setDefault(oldtz);
+ // hmmm... this shouldn't happen.
throw new IllegalStateException(e.getMessage());
+ } finally {
+ TimeZone.setDefault(oldtz);
}
}
import org.junit.runners.JUnit4;
import com.ibm.icu.dev.test.TestFmwk;
-import com.ibm.icu.dev.test.TestUtil;
import com.ibm.icu.impl.breakiter.LSTMBreakEngine;
import com.ibm.icu.lang.UScript;
import com.ibm.icu.text.BreakIterator;
private void runTestFromFile(String filename, int script) {
// The expectation in this test depends on LSTM, skip the test if the
// configuration is not build with LSTM data.
- org.junit.Assume.assumeTrue(!TestUtil.skipLSTMTest());
+ org.junit.Assume.assumeTrue(!RBBITstUtils.skipLSTMTest());
BreakIterator bi = BreakIterator.getWordInstance();
String testString;
import org.junit.runners.JUnit4;
import com.ibm.icu.dev.test.TestFmwk;
-import com.ibm.icu.dev.test.TestUtil;
import com.ibm.icu.impl.RBBIDataWrapper;
import com.ibm.icu.text.BreakIterator;
import com.ibm.icu.text.RuleBasedBreakIterator;
public void TestThaiDictionaryBreakIterator() {
// The expectations in this test heavily depends on the Thai dictionary.
// Therefore, we skip this test under the LSTM configuration.
- org.junit.Assume.assumeTrue(!TestUtil.skipDictionaryTest());
+ org.junit.Assume.assumeTrue(!RBBITstUtils.skipDictionaryTest());
int position;
int index;
int result[] = { 1, 2, 5, 10, 11, 12, 11, 10, 5, 2, 1, 0 };
import org.junit.runners.JUnit4;
import com.ibm.icu.dev.test.TestFmwk;
-import com.ibm.icu.dev.test.TestUtil;
import com.ibm.icu.impl.ICUConfig;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.lang.UCharacter;
public void TestExtended() {
// The expectations in this test heavily depends on the Thai dictionary.
// Therefore, we skip this test under the LSTM configuration.
- org.junit.Assume.assumeTrue(!TestUtil.skipDictionaryTest());
+ org.junit.Assume.assumeTrue(!RBBITstUtils.skipDictionaryTest());
TestParams tp = new TestParams();
--- /dev/null
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+ *******************************************************************************
+ * Copyright (C) 1996-2012, International Business Machines Corporation and *
+ * others. All Rights Reserved. *
+ *******************************************************************************
+ */
+package com.ibm.icu.dev.test.rbbi;
+
+import java.util.MissingResourceException;
+
+import com.ibm.icu.impl.breakiter.LSTMBreakEngine;
+import com.ibm.icu.lang.UScript;
+
+public class RBBITstUtils {
+ static boolean lstmDataIsBuilt() {
+ try {
+ LSTMBreakEngine.createData(UScript.THAI);
+ return true;
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+ try {
+ LSTMBreakEngine.createData(UScript.MYANMAR);
+ return true;
+ } catch (MissingResourceException e) {
+ // do nothing
+ }
+ return false;
+ }
+
+ static boolean skipLSTMTest() {
+ return ! lstmDataIsBuilt();
+ }
+
+ public static boolean skipDictionaryTest() {
+ return lstmDataIsBuilt();
+ }
+}
// Override default TimeZone, so serialized data always use
// the consistent zone if not specified.
- TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
+ TimeZone savedZone = TimeZone.getDefault();
+ try {
+ TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
- SerializableWriter writer = new SerializableWriter(outDir);
+ SerializableWriter writer = new SerializableWriter(outDir);
- writer.serialize();
+ writer.serialize();
+ } finally {
+ TimeZone.setDefault(savedZone);
+ }
}
public void serialize() throws IOException {
// support historic transitions, therefore, the test below
// will fail on such environment (with the latest TimeZone
// patch for US 2007+ rule).
- if (TestUtil.getJavaVendor() == JavaVendor.Android || TestUtil.getJavaVersion() > 3) {
- // This only works in PST/PDT
- TimeZone.setDefault(safeGetTimeZone("PST"));
- logln("========================================");
- tempcal.set(1997, 0, 1);
- findDaylightBoundaryUsingDate(tempcal.getTime(), "PST", PST_1997_BEG);
- logln("========================================");
- tempcal.set(1997, 6, 1);
- findDaylightBoundaryUsingDate(tempcal.getTime(), "PDT", PST_1997_END);
+ try {
+ if (TestUtil.getJavaVendor() == JavaVendor.Android || TestUtil.getJavaVersion() > 3) {
+ // This only works in PST/PDT
+ TimeZone.setDefault(safeGetTimeZone("PST"));
+ logln("========================================");
+ tempcal.set(1997, 0, 1);
+ findDaylightBoundaryUsingDate(tempcal.getTime(), "PST", PST_1997_BEG);
+ logln("========================================");
+ tempcal.set(1997, 6, 1);
+ findDaylightBoundaryUsingDate(tempcal.getTime(), "PDT", PST_1997_END);
+ }
+ } finally {
+ TimeZone.setDefault(save);
}
// if (true)
findBoundariesStepwise(1997, ONE_DAY, safeGetTimeZone("America/Phoenix"), 0); // Added 3Jan01
findBoundariesStepwise(1997, ONE_DAY, safeGetTimeZone(AUSTRALIA), 2);
}
+
+ private static TimeZone safeGetTimeZone(String id) {
+ TimeZone tz = TimeZone.getTimeZone(id);
+ if (tz == null) {
+ // should never happen
+ errln("FAIL: TimeZone.getTimeZone(" + id + ") => null");
+ }
+ if (!tz.getID().equals(id)) {
+ warnln("FAIL: TimeZone.getTimeZone(" + id + ") => " + tz.getID());
+ }
+ return tz;
+ }
}
TimeZone initialZone = TimeZone.getDefault();
Calendar cal = Calendar.getInstance();
TimeZone tz = TimeZone.getTimeZone("PST");
- TimeZone.setDefault(tz);
+ TimeZone.setDefault(tz);
cal.setTimeZone(tz);
java.util.Calendar tempcal = java.util.Calendar.getInstance();
@Test
public void TestZoneMeta() {
java.util.TimeZone save = java.util.TimeZone.getDefault();
- java.util.TimeZone newZone = java.util.TimeZone.getTimeZone("GMT-08:00");
- com.ibm.icu.util.TimeZone.setDefault(null);
- java.util.TimeZone.setDefault(newZone);
- SimpleTimeZone zone = new SimpleTimeZone(0, "GMT");
- com.ibm.icu.util.TimeZone defaultZone = com.ibm.icu.util.TimeZone.getDefault();
- if(defaultZone==null){
- errln("TimeZone.getDefault() failed for GMT-08:00");
- }
- if(zone==null){
- errln("SimpleTimeZone(0, GMT-08:00) failed for GMT-08:00");
- }
- //reset
- java.util.TimeZone.setDefault(save);
+ com.ibm.icu.util.TimeZone icuTzSave = com.ibm.icu.util.TimeZone.getDefault();
+ try {
+ java.util.TimeZone newZone = java.util.TimeZone.getTimeZone("GMT-08:00");
+ com.ibm.icu.util.TimeZone.setDefault(null);
+ java.util.TimeZone.setDefault(newZone);
+ SimpleTimeZone zone = new SimpleTimeZone(0, "GMT");
+ com.ibm.icu.util.TimeZone defaultZone = com.ibm.icu.util.TimeZone.getDefault();
+ if(defaultZone==null){
+ errln("TimeZone.getDefault() failed for GMT-08:00");
+ }
+ if(zone==null){
+ errln("SimpleTimeZone(0, GMT-08:00) failed for GMT-08:00");
+ }
+ } finally {
+ // reset timezones
+ java.util.TimeZone.setDefault(save);
+ com.ibm.icu.util.TimeZone.setDefault(icuTzSave);
+ }
}
// Copied from the protected constant in TimeZone.
@Test
public void TestSetDefault() {
java.util.TimeZone save = java.util.TimeZone.getDefault();
+ TimeZone icuSave = TimeZone.getDefault();
/*
* America/Caracs (Venezuela) changed the base offset from -4:00 to
}
// Restore the original JDK time zone
+ TimeZone.setDefault(icuSave);
java.util.TimeZone.setDefault(save);
}
*/
package com.ibm.icu.dev.test.util;
+import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.lang.UCharacter;
import com.ibm.icu.lang.UScript;
-import com.ibm.icu.text.DecimalFormat;
import com.ibm.icu.text.UnicodeSet;
import com.ibm.icu.util.StringTrieBuilder.Option;
import com.ibm.icu.util.ULocale;
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/.svn/" kind="src" path="src"/>
- <classpathentry combineaccessrules="false" kind="src" path="/icu4j-core"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="lib" path="/external-libraries/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="/external-libraries/junit-4.12.jar" sourcepath="/external-libraries/junit-4.12-sources.jar">
<attributes>
import org.junit.Assert;
-import com.ibm.icu.util.VersionInfo;
-
public abstract class AbstractTestLog implements TestLog {
- /**
- * Returns true if ICU_Version < major.minor.
- */
- static public boolean isICUVersionBefore(int major, int minor) {
- return isICUVersionBefore(major, minor, 0);
- }
-
- /**
- * Returns true if ICU_Version < major.minor.milli.
- */
- static public boolean isICUVersionBefore(int major, int minor, int milli) {
- return VersionInfo.ICU_VERSION.compareTo(VersionInfo.getInstance(major, minor, milli)) < 0;
- }
-
- /**
- * Returns true if ICU_Version >= major.minor.
- */
- static public boolean isICUVersionAtLeast(int major, int minor) {
- return isICUVersionAtLeast(major, minor, 0);
- }
-
- /**
- * Returns true if ICU_Version >= major.minor.milli.
- */
- static public boolean isICUVersionAtLeast(int major, int minor, int milli) {
- return !isICUVersionBefore(major, minor, milli);
- }
-
/**
* Add a message.
*/
import java.util.Locale;
import java.util.Properties;
import java.util.Random;
+import java.util.TimeZone;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
-import com.ibm.icu.util.TimeZone;
-import com.ibm.icu.util.ULocale;
-
/**
* TestFmwk is a base class for tests that can be run conveniently from the
* command line as well as under the Java test harness.
return getParams().getIntProperty(key, defVal, maxVal);
}
- protected static TimeZone safeGetTimeZone(String id) {
- TimeZone tz = TimeZone.getTimeZone(id);
- if (tz == null) {
- // should never happen
- errln("FAIL: TimeZone.getTimeZone(" + id + ") => null");
- }
- if (!tz.getID().equals(id)) {
- warnln("FAIL: TimeZone.getTimeZone(" + id + ") => " + tz.getID());
- }
- return tz;
- }
-
-
// Utility Methods
protected static String hex(char[] s){
* Check the given array to see that all the locales in the expected array
* are present.
*
+ * @param <T>
+ * the type of the objects to check, must have a toString method,
+ * so anything will do
* @param msg
* string message, for log output
* @param array
* array of locales names we expect to see, or null
* @return the length of 'array'
*/
- protected static int checkArray(String msg, Locale array[], String expected[]) {
- String strs[] = new String[array.length];
- for (int i = 0; i < array.length; ++i) {
- strs[i] = array[i].toString();
- }
- return checkArray(msg, strs, expected);
- }
-
- /**
- * Check the given array to see that all the locales in the expected array
- * are present.
- *
- * @param msg
- * string message, for log output
- * @param array
- * array of locales to check
- * @param expected
- * array of locales names we expect to see, or null
- * @return the length of 'array'
- */
- protected static int checkArray(String msg, ULocale array[], String expected[]) {
+ protected static <T> int checkArray(String msg, T array[], String expected[]) {
String strs[] = new String[array.length];
for (int i = 0; i < array.length; ++i) {
strs[i] = array[i].toString();
// System.out.println();
// }
}
-
}
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Locale;
-import java.util.MissingResourceException;
-
-import com.ibm.icu.impl.breakiter.LSTMBreakEngine;
-import com.ibm.icu.lang.UScript;
public final class TestUtil {
/**
}
return ver;
}
-
- private static boolean lstmDataIsBuilt() {
- try {
- LSTMBreakEngine.createData(UScript.THAI);
- return true;
- } catch (MissingResourceException e) {
- // do nothing
- }
- try {
- LSTMBreakEngine.createData(UScript.MYANMAR);
- return true;
- } catch (MissingResourceException e) {
- // do nothing
- }
- return false;
- }
-
- public static boolean skipLSTMTest() {
- return ! lstmDataIsBuilt();
- }
-
- public static boolean skipDictionaryTest() {
- return lstmDataIsBuilt();
- }
}
import java.util.TreeSet;
import java.util.regex.Matcher;
-import com.ibm.icu.text.UTF16;
-import com.ibm.icu.text.UnicodeSet;
-import com.ibm.icu.text.UnicodeSetIterator;
-
/**
* Utilities that ought to be on collections, but aren't
*
return result;
}
- public static String remove(String source, UnicodeSet removals) {
- StringBuffer result = new StringBuffer();
- int cp;
- for (int i = 0; i < source.length(); i += UTF16.getCharCount(cp)) {
- cp = UTF16.charAt(source, i);
- if (!removals.contains(cp)) UTF16.append(result, cp);
- }
- return result.toString();
- }
-
/**
* Does one string contain another, starting at a specific offset?
* @param text
return i;
}
- /**
- * Returns the ending offset found by matching characters with testSet, until a position is found that doen't match
- * @param string
- * @param offset
- * @param testSet
- * @return
- */
- public int span(CharSequence string, int offset, UnicodeSet testSet) {
- while (true) {
- int newOffset = testSet.matchesAt(string, offset);
- if (newOffset < 0) return offset;
- }
- }
-
- /**
- * Returns the ending offset found by matching characters with testSet, until a position is found that does match
- * @param string
- * @param offset
- * @param testSet
- * @return
- */
- public int spanNot(CharSequence string, int offset, UnicodeSet testSet) {
- while (true) {
- int newOffset = testSet.matchesAt(string, offset);
- if (newOffset >= 0) return offset;
- ++offset; // try next character position
- // we don't have to worry about surrogates for this.
- }
- }
-
- /**
- * Modifies Unicode set to flatten the strings. Eg [abc{da}] => [abcd]
- * Returns the set for chaining.
- * @param exemplar1
- * @return
- */
- public static UnicodeSet flatten(UnicodeSet exemplar1) {
- UnicodeSet result = new UnicodeSet();
- boolean gotString = false;
- for (UnicodeSetIterator it = new UnicodeSetIterator(exemplar1); it.nextRange();) {
- if (it.codepoint == UnicodeSetIterator.IS_STRING) {
- result.addAll(it.string);
- gotString = true;
- } else {
- result.add(it.codepoint, it.codepointEnd);
- }
- }
- if (gotString) exemplar1.set(result);
- return exemplar1;
- }
-
/**
* For producing filtered iterators
*/
+++ /dev/null
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-//
-// ElapsedTimer.java
-//
-// Created by Steven R. Loomis on 11/11/2005.
-// Copyright 2005-2012 IBM. All rights reserved.
-//
-
-package com.ibm.icu.dev.util;
-
-import java.util.Locale;
-
-import com.ibm.icu.text.MessageFormat;
-import com.ibm.icu.text.NumberFormat;
-import com.ibm.icu.text.RuleBasedNumberFormat;
-
-
-/**
- * Simple stopwatch timer.
- * Usage: { ElapsedTimer et = new ElapsedTimer();
- * do_some_stuff;
- * System.out.println("It took " + et + " to do stuff."); }
- *
- * Advanced: { ElapsedTimer et = new ElapsedTimer("Thing2's time: {0}"); // messageformat pattern
- * do_thing_2();
- * System.out.println(et.toString()); }
- *
- * More advanced: NumberFormat and/or MessageFormat can be provided in the constructor
- *
- * @internal CLDR
- */
-public final class ElapsedTimer {
-
- /**
- * Convenience method to print the elasped time (in milliseconds)
- */
- public static String elapsedTime(long start, long end) {
- return diffTime(getFormat(), start, end);
- }
-
- public static String elapsedTime(long start) {
- return diffTime(getFormat(), start, System.currentTimeMillis());
- }
-
- // class
-
- private long startTime = System.currentTimeMillis();
- private NumberFormat myDurationFormat = null;
- private MessageFormat myMsgFormat = null;
-
- public ElapsedTimer() {
- }
-
- public ElapsedTimer(MessageFormat aMsgFmt) {
- myMsgFormat = aMsgFmt;
- }
-
- public ElapsedTimer(NumberFormat aNumFmt) {
- myDurationFormat = aNumFmt;
- }
-
- public ElapsedTimer(MessageFormat aMsgFmt, NumberFormat aNumFmt) {
- myMsgFormat = aMsgFmt;
- myDurationFormat = aNumFmt;
- }
-
- public ElapsedTimer(String pattern) {
- myMsgFormat = new MessageFormat(pattern);
- }
-
- public ElapsedTimer(String pattern, NumberFormat aNumFmt) {
- myMsgFormat = new MessageFormat(pattern);
- myDurationFormat = aNumFmt;
- }
-
- /**
- * @return elapsed time in seconds since object creation
- */
- public final String toString() {
- long endTime = System.currentTimeMillis();
- String duration = diffTime(myDurationFormat, startTime, endTime);
- if(myMsgFormat == null) {
- return duration;
- } else {
- return myMsgFormat.format(new Object[] {duration});
- }
- }
-
- private static NumberFormat gFormat = null;
-
- private static NumberFormat getFormat() {
- if(gFormat == null) {
- gFormat = new RuleBasedNumberFormat(Locale.US,
- RuleBasedNumberFormat.DURATION);
- }
- return gFormat;
- }
-
- private static String diffTime(NumberFormat fmt, long start, long end) {
- if(fmt==null) {
- fmt = getFormat();
- }
- synchronized(fmt) {
- long age = end - start;
- long diff = age/1000; // millis per second. Workaround ticket:7936 by using whole number seconds.
- return fmt.format(diff);
- }
- }
-}
*/
package com.ibm.icu.dev.util;
-import com.ibm.icu.text.DecimalFormat;
-import com.ibm.icu.text.NumberFormat;
-import com.ibm.icu.util.ULocale;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.Locale;
public final class Timer {
public static final long SECONDS = 100000000;
return nf.format(getDuration()/iterations) + "\tns\t" + pf.format((double)getDuration()/other - 1D) + "";
}
- private DecimalFormat nf = (DecimalFormat) NumberFormat.getNumberInstance(ULocale.ENGLISH);
- private DecimalFormat pf = (DecimalFormat) NumberFormat.getPercentInstance(ULocale.ENGLISH);
+ private DecimalFormat nf = (DecimalFormat) NumberFormat.getNumberInstance(Locale.ENGLISH);
+ private DecimalFormat pf = (DecimalFormat) NumberFormat.getPercentInstance(Locale.ENGLISH);
{
pf.setMaximumFractionDigits(1);
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-translit"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-core"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-test-framework"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-langdata"/>
<classpathentry kind="lib" path="/external-libraries/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="/external-libraries/junit-4.12.jar" sourcepath="/external-libraries/junit-4.12-sources.jar">
<attribute name="javadoc_location" value="jar:platform:/resource/external-libraries/JUnitParams-1.0.5-javadoc.jar!/"/>
</attributes>
</classpathentry>
+ <classpathentry combineaccessrules="false" kind="src" path="/icu4j-core-tests"/>
<classpathentry kind="output" path="out/bin"/>
</classpath>
+++ /dev/null
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
- *******************************************************************************
- * Copyright (C) 2016, International Business Machines Corporation and *
- * others. All Rights Reserved. *
- *******************************************************************************
- */
-package com.ibm.icu.dev.test.translit;
-
-import java.util.List;
-
-import org.junit.Test;
-
-import com.ibm.icu.dev.test.TestBoilerplate;
-
-/**
- * Moved from UnicodeMapTest
- */
-public class StringBoilerplateTest extends TestBoilerplate<String> {
- public void TestStringBoilerplate() throws Exception {
- }
-
- @Test
- public void test() throws Exception {
- _test();
- }
-
- /* (non-Javadoc)
- * @see com.ibm.icu.dev.test.TestBoilerplate#_hasSameBehavior(java.lang.Object, java.lang.Object)
- */
- @Override
- protected boolean _hasSameBehavior(String a, String b) {
- // we are pretty confident in the equals method, so won't bother with this right now.
- return true;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.icu.dev.test.TestBoilerplate#_addTestObject(java.util.List)
- */
- @Override
- protected boolean _addTestObject(List<String> list) {
- if (list.size() > 31) return false;
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < 10; ++i) {
- result.append((char)random.nextInt(0xFF));
- }
- list.add(result.toString());
- return true;
- }
-}
import com.ibm.icu.text.UnicodeSetIterator;
import com.ibm.icu.util.CaseInsensitiveString;
import com.ibm.icu.util.ULocale;
+import com.ibm.icu.dev.test.rbbi.RBBITstUtils;
/***********************************************************************
public void TestThai() {
// The expectations in this test heavily depends on the Thai dictionary.
// Therefore, we skip this test under the LSTM configuration.
- org.junit.Assume.assumeTrue(!TestUtil.skipDictionaryTest());
+ org.junit.Assume.assumeTrue(!RBBITstUtils.skipDictionaryTest());
Transliterator tr = Transliterator.getInstance("Any-Latin", Transliterator.FORWARD);
String thaiText =
"\u0e42\u0e14\u0e22\u0e1e\u0e37\u0e49\u0e19\u0e10\u0e32\u0e19\u0e41\u0e25\u0e49\u0e27, \u0e04\u0e2d" +
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>com.ibm.icu</groupId>
+ <artifactId>icu4j</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</manifestEntries>
</archive>
</configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-currdata"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-langdata"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-regiondata"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/icu4j-core-tests"/>
<classpathentry combineaccessrules="false" kind="src" path="/icu4j-tools"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="out/bin"/>
</classpath>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true