]> granicus.if.org Git - icu/commitdiff
ICU-7973 fix & rename skipIfBeforeICU() -> isICUVersionBefore() & isICUVersionAtLeast()
authorMarkus Scherer <markus.icu@gmail.com>
Thu, 15 Dec 2011 16:57:46 +0000 (16:57 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Thu, 15 Dec 2011 16:57:46 +0000 (16:57 +0000)
X-SVN-Rev: 31121

icu4j/main/tests/collate/src/com/ibm/icu/dev/test/search/SearchTest.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateTimeGeneratorTest.java
icu4j/main/tests/framework/src/com/ibm/icu/dev/test/AbstractTestLog.java
icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/RoundTripTest.java

index e88ce5b0297f15e291d3fb8e5f902dbbee0a9341..e6b6f2174e4fae9e4a7712a0390fb9a618672eb8 100644 (file)
@@ -1790,7 +1790,7 @@ public class SearchTest extends TestFmwk {
     }
 
     public void TestSupplementary() {
-        if (skipIfBeforeICU(49,0,2)) { // ticket#8080
+        if (isICUVersionBefore(49, 1)) { // ticket#8080
             return;
         }
         int count = 0;
@@ -1803,7 +1803,7 @@ public class SearchTest extends TestFmwk {
     }
 
     public void TestSupplementaryCanonical() {
-        if (skipIfBeforeICU(49,0,2)) { // ticket#8080
+        if (isICUVersionBefore(49, 1)) { // ticket#8080
             return;
         }
         int count = 0;
index 5cf4d1d319df4d5a5428ecf3f688b8a49575d9e8..db618bc3ee6d860840b353580ba35484358857cd 100644 (file)
@@ -551,7 +551,7 @@ public class DateTimeGeneratorTest extends TestFmwk {
         DateOrder order2 = getOrdering(style2, uLocale);
         if (!order1.hasSameOrderAs(order2)) {
             if (order1.monthLength == order2.monthLength) { // error if have same month length, different ordering
-                if (skipIfBeforeICU(49,0,2)) { // ticket#6806
+                if (isICUVersionBefore(49, 1)) { // ticket#6806
                     logln(showOrderComparison(uLocale, style1, style2, order1, order2));
                 } else {
                     errln(showOrderComparison(uLocale, style1, style2, order1, order2));
index 6e40cf38059d1019aec954c401875dc3c27cb758..f2b3d16d0c8b06eb6b53d38e99a6cd5076ec9b76 100644 (file)
@@ -1,7 +1,7 @@
 /**
  *******************************************************************************
- * Copyright (C) 2003-2010, International Business Machines Corporation and         *
- * others. All Rights Reserved.                                                *
+ * Copyright (C) 2003-2011, International Business Machines Corporation and
+ * others. All Rights Reserved.
  *******************************************************************************
  */
 package com.ibm.icu.dev.test;
@@ -13,21 +13,34 @@ import java.util.GregorianCalendar;
 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);
+    }
 
-    public static boolean dontSkipForVersion = false;
     /**
-     * Returns true if the current ICU version is before, or equal to, the specified major.minor.micro version.
-     * TODO: Why is this called "before" when it returns true for "before or equal"? Can we fix it?
+     * Returns true if ICU_Version >= major.minor.milli.
      */
-    public boolean skipIfBeforeICU(int major, int minor, int micro) {
-        if (dontSkipForVersion || VersionInfo.ICU_VERSION.compareTo(VersionInfo.getInstance(major, minor, micro)) > 0) {
-            return false;
-        } 
-        logln("Test skipped before ICU release " + major + "." + minor + "." + micro);
-        return true;
+    static public boolean isICUVersionAtLeast(int major, int minor, int milli) {
+        return !isICUVersionBefore(major, minor, milli);
     }
 
-    
     /**
      * Add a message.
      */
index 5f5244b3bfd17e38d0738831090868d134097d9e..14536fbb995d8c517867c40330b44cdadf8e7ee3 100644 (file)
@@ -82,7 +82,7 @@ public class RoundTripTest extends TestFmwk {
     public void init() {
         // TODO(Mark): Fix ticket #8989, transliterate U+0970.
         // Remove this method?
-        beforeICU49 = skipIfBeforeICU(49, 0, 2);  // actually tests <= 49m2 not <
+        beforeICU49 = isICUVersionBefore(49, 1);
         minusDevAbbBefore49 = beforeICU49 ? "-[\u0970]" : "";
     }