Example #1
0
 public static void isInt(long v, String argName) {
   if (SystemX.isDebugRun()) {
     if ((v & 0x7FFFFFFF) != v) {
       throwException("%s (%s) is out of bounds of an int", argName, v);
     }
   }
 }
Example #2
0
 public static void isUnsignedShort(int v, String argName) {
   if (SystemX.isDebugRun()) {
     if ((v & 0xFFFF) != v) {
       throwException("%s (%s) is out of bounds of an unsigned short", argName, v);
     }
   }
 }
Example #3
0
 public static void argIsUnsignedByte(int v, String name) {
   if (SystemX.isDebugRun()) {
     if (v < 0 || v > 255) {
       throwException("%s (%s) is outside the bounds of an unsigned byte (0-255)", name, v);
     }
   }
 }
Example #4
0
  /**
   * Fails if the supplied function returns a String. The string is a failure message. Because
   * function0 is invoked 'lazily', use this method when the arguments to a normal call to QA cannot
   * be hard coded. Thus when checks are disabled, there will be no runtime cost.
   */
  public static void assertCondition(Function0<String> function0) {
    if (SystemX.isDebugRun()) {
      String failureMessage = function0.invoke();

      if (failureMessage != null) {
        throwException(failureMessage);
      }
    }
  }