Package ubic.basecode.util
Class RegressionTesting
java.lang.Object
ubic.basecode.util.RegressionTesting
Tools to help make regression testing easier, but also useful for other purposes.
- Author:
- pavlidis
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancloseEnough(double[] expected, double[] actual, double tolerance) static booleancloseEnough(DoubleArrayList expected, DoubleArrayList actual, double tolerance) Test whether two DoubleArrayLists are 'close enough' to call equal.static booleancloseEnough(DoubleMatrix1D expected, DoubleMatrix1D actual, double tolerance) static booleancloseEnough(DoubleMatrix2D a, DoubleMatrix2D b, double tolerance) static booleancloseEnough(Object[] a, Object[] b) Test whether two object arrays are the same.static booleancloseEnough(DoubleMatrix<?, ?> expected, DoubleMatrix<?, ?> actual, double tolerance) Test whether two AbstractNamedDoubleMatrix are 'close enough' to call equal.static booleancontainsSame(double[] a, double[] b) Test whether two double arrays contain the same items in any order (tolerance is ZERO)static booleancontainsSame(Object[] a, Object[] b) Test whether two object arrays contain the same items in any order.static booleancontainsSame(Collection<? extends Object> a, Collection<? extends Object> b) Test whether two collections contain the same items.static StringreadTestResult(File file) static StringreadTestResult(InputStream istream) static StringreadTestResult(String resourceName) static StringreadTestResultFromFile(String fileName) static booleansameArray(int[] a, int[] b) Test whether two double arrays contain the same items in the same orderstatic voidwriteTestResult(String result, String fileName)
-
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
- Parameters:
expected-actual-tolerance-- Returns:
-
closeEnough
-
closeEnough
Test whether two object arrays are the same.- Parameters:
a-b-- Returns:
-
containsSame
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
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
- Parameters:
file-- Returns:
- Throws:
IOException
-
readTestResult
- Parameters:
istream-- Returns:
- Throws:
IOException
-
readTestResult
- Parameters:
resourceName-- Returns:
- the contents of the resource as a String
- Throws:
IOException
-
readTestResultFromFile
- 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
- Throws:
IOException
-