1 /* GENERATED SOURCE. DO NOT MODIFY. */ 2 // 2016 and later: Unicode, Inc. and others. 3 // License & terms of use: http://www.unicode.org/copyright.html#License 4 /** 5 ******************************************************************************* 6 * Copyright (C) 2003-2011, International Business Machines Corporation and 7 * others. All Rights Reserved. 8 ******************************************************************************* 9 */ 10 package android.icu.dev.test; 11 12 import java.util.Calendar; 13 import java.util.Date; 14 import java.util.GregorianCalendar; 15 16 import org.junit.Assert; 17 18 import android.icu.util.VersionInfo; 19 20 public abstract class AbstractTestLog implements TestLog { 21 /** 22 * Returns true if ICU_Version < major.minor. 23 */ 24 static public boolean isICUVersionBefore(int major, int minor) { 25 return isICUVersionBefore(major, minor, 0); 26 } 27 28 /** 29 * Returns true if ICU_Version < major.minor.milli. 30 */ 31 static public boolean isICUVersionBefore(int major, int minor, int milli) { 32 return VersionInfo.ICU_VERSION.compareTo(VersionInfo.getInstance(major, minor, milli)) < 0; 33 } 34 35 /** 36 * Returns true if ICU_Version >= major.minor. 37 */ 38 static public boolean isICUVersionAtLeast(int major, int minor) { 39 return isICUVersionAtLeast(major, minor, 0); 40 } 41 42 /** 43 * Returns true if ICU_Version >= major.minor.milli. 44 */ 45 static public boolean isICUVersionAtLeast(int major, int minor, int milli) { 46 return !isICUVersionBefore(major, minor, milli); 47 } 48 49 /** 50 * Add a message. 51 */ 52 public static final void log(String message) { 53 // TODO(stuartg): turned off - causing OOM running under ant 54 // Probably temporary - must decide what to do with these 55 //System.out.print(message); 56 //msg(message, LOG, true, false); 57 } 58 59 /** 60 * Add a message and newline. 61 */ 62 public static final void logln(String message) { 63 // TODO(stuartg): turned off - causing OOM running under ant 64 // Probably temporary - must decide what to do with these 65 //System.out.println(message); 66 //msg(message, LOG, true, true); 67 } 68 69 /** 70 * Report an error. 71 */ 72 public static final void err(String message) { 73 Assert.fail(message); 74 //msg(message, ERR, true, false); 75 } 76 77 /** 78 * Report an error and newline. 79 */ 80 public static final void errln(String message) { 81 Assert.fail(message); 82 //msg(message, ERR, true, true); 83 } 84 85 /** 86 * Report a warning (generally missing tests or data). 87 */ 88 public static final void warn(String message) { 89 Assert.fail(message); 90 // TODO(stuartg): turned off - causing OOM running under ant 91 //System.out.print(message); 92 //msg(message, WARN, true, false); 93 } 94 95 /** 96 * Report a warning (generally missing tests or data) and newline. 97 */ 98 public static final void warnln(String message) { 99 Assert.fail(message); 100 // TODO(stuartg): turned off - causing OOM running under ant 101 //System.out.println(message); 102 //msg(message, WARN, true, true); 103 } 104 105 /** 106 * Vector for logging. Callers can force the logging system to 107 * not increment the error or warning level by passing false for incCount. 108 * 109 * @param message the message to output. 110 * @param level the message level, either LOG, WARN, or ERR. 111 * @param incCount if true, increments the warning or error count 112 * @param newln if true, forces a newline after the message 113 */ 114 //public abstract void msg(String message, int level, boolean incCount, boolean newln); 115 116 public boolean isDateAtLeast(int year, int month, int day){ 117 Date now = new Date(); 118 Calendar c = new GregorianCalendar(year, month, day); 119 Date dt = c.getTime(); 120 if(now.compareTo(dt)>=0){ 121 return true; 122 } 123 return false; 124 } 125 } 126