Class RegressionTesting

java.lang.Object
ubic.basecode.util.RegressionTesting

public class RegressionTesting extends Object
Tools to help make regression testing easier, but also useful for other purposes.
Author:
pavlidis
  • Method Details

    • closeEnough

      public static boolean closeEnough(double[] expected, double[] actual, double tolerance)
      Parameters:
      expected -
      actual -
      tolerance - permitted delta between the values
    • closeEnough

      public static boolean closeEnough(DoubleArrayList expected, DoubleArrayList actual, double tolerance)
      Test whether two DoubleArrayLists are 'close enough' to call equal.
      Parameters:
      expected -
      actual -
      tolerance -
      Returns:
    • closeEnough

      public static boolean closeEnough(DoubleMatrix<?,?> expected, DoubleMatrix<?,?> actual, double tolerance)
      Test whether two AbstractNamedDoubleMatrix are 'close enough' to call equal.
      Parameters:
      expected -
      actual -
      tolerance -
      Returns:
      try if all the values in both matrices are within 'tolerance' of each other.
    • closeEnough

      public static boolean closeEnough(DoubleMatrix1D expected, DoubleMatrix1D actual, double tolerance)
      Parameters:
      expected -
      actual -
      tolerance -
      Returns:
    • closeEnough

      public static boolean closeEnough(DoubleMatrix2D a, DoubleMatrix2D b, double tolerance)
    • closeEnough

      public static boolean closeEnough(Object[] a, Object[] b)
      Test whether two object arrays are the same.
      Parameters:
      a -
      b -
      Returns:
    • containsSame

      public static boolean containsSame(Collection<? extends Object> a, Collection<? extends Object> b)
      Test whether two collections contain the same items.
      Parameters:
      a -
      b -
      Returns:
    • containsSame

      public static boolean containsSame(double[] a, double[] b)
      Test whether two double arrays contain the same items in any order (tolerance is ZERO)
      Parameters:
      a -
      b -
      Returns:
    • containsSame

      public static boolean containsSame(Object[] a, Object[] b)
      Test whether two object arrays contain the same items in any order. The arrays are treated as Sets - repeats are not considered.
      Parameters:
      a -
      b -
      Returns:
    • readTestResult

      public static String readTestResult(File file) throws IOException
      Parameters:
      file -
      Returns:
      Throws:
      IOException
    • readTestResult

      public static String readTestResult(InputStream istream) throws IOException
      Parameters:
      istream -
      Returns:
      Throws:
      IOException
    • readTestResult

      public static String readTestResult(String resourceName) throws IOException
      Parameters:
      resourceName -
      Returns:
      the contents of the resource as a String
      Throws:
      IOException
    • readTestResultFromFile

      public static String readTestResultFromFile(String fileName) throws IOException
      Parameters:
      fileName - - the full path of the file to be read.
      Returns:
      Throws:
      IOException
    • sameArray

      public static boolean sameArray(int[] a, int[] b)
      Test whether two double arrays contain the same items in the same order
      Parameters:
      a -
      b -
      Returns:
    • writeTestResult

      public static void writeTestResult(String result, String fileName) throws IOException
      Throws:
      IOException