Class RegressionTesting
java.lang.Object
ubic.gemma.core.util.RegressionTesting
Tools to help make regression testing easier — comparing matrices, arrays, and collections within a tolerance.
In-tree port of ubic.basecode.util.RegressionTesting (Renovations Phase 3 baseCode util batch 3).
The cern.colt-heavy overloads (DoubleArrayList, DoubleMatrix1D, DoubleMatrix2D) and the
file I/O helpers (readTestResult, writeTestResult, readTestResultFromFile) were dropped —
none are called from Gemma. The remaining overloads kept here cover every Gemma call site:
closeEnough(double[], double[], double), closeEnough(DoubleMatrix, DoubleMatrix, double), and
containsSame(Collection, Collection). Other simple overloads (Object[], int[],
double[] containsSame, sameArray) are retained because they're self-contained and trivial.
- Author:
- pavlidis
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancloseEnough(double[] expected, double[] actual, double tolerance) static booleancloseEnough(Object[] a, Object[] b) Test whether two object arrays are the same (element-wise, ordered).static booleancloseEnough(DoubleMatrix<?, ?> expected, DoubleMatrix<?, ?> actual, double tolerance) Test whether twoDoubleMatrixes 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 booleansameArray(int[] a, int[] b) Test whether two int arrays contain the same items in the same order.
-
Method Details
-
closeEnough
public static boolean closeEnough(double[] expected, double[] actual, double tolerance) - Parameters:
expected- expected valuesactual- actual valuestolerance- permitted delta between the values- Returns:
- true if all paired values agree within tolerance
-
closeEnough
public static boolean closeEnough(DoubleMatrix<?, ?> expected, DoubleMatrix<?, ?> actual, double tolerance) Test whether twoDoubleMatrixes are 'close enough' to call equal.- Returns:
- true if all the values in both matrices are within 'tolerance' of each other.
-
closeEnough
-
containsSame
Test whether two collections contain the same items. -
containsSame
public static boolean containsSame(double[] a, double[] b) Test whether two double arrays contain the same items in any order (tolerance is ZERO). -
containsSame
-
sameArray
public static boolean sameArray(int[] a, int[] b) Test whether two int arrays contain the same items in the same order.
-