baseCode.util
Class RegressionTesting

java.lang.Object
  extended bybaseCode.util.RegressionTesting

public class RegressionTesting
extends java.lang.Object

Tools to help make regression testing easier.


Copyright (c) 2004 Columbia University

Version:
$Id: RegressionTesting.java,v 1.17 2005/02/23 23:08:53 pavlidis Exp $
Author:
pavlidis

Method Summary
static boolean closeEnough(AbstractNamedDoubleMatrix a, AbstractNamedDoubleMatrix b, double tolerance)
          Test whether two AbstractNamedDoubleMatrix are 'close enough' to call equal.
static boolean closeEnough(cern.colt.list.DoubleArrayList a, cern.colt.list.DoubleArrayList b, double tolerance)
          Test whether two DoubleArrayLists are 'close enough' to call equal.
static boolean closeEnough(cern.colt.matrix.DoubleMatrix2D a, cern.colt.matrix.DoubleMatrix2D b, double tolerance)
           
static boolean closeEnough(java.lang.Object[] a, java.lang.Object[] b)
          Test whether two object arrays are the same.
static boolean containsSame(java.util.Collection a, java.util.Collection b)
          Test whether two collections contain the same items.
static boolean containsSame(double[] a, double[] b)
          Test whether two double arrays contain the same items in any order (tolerance is ZERO)
static boolean containsSame(java.lang.Object[] a, java.lang.Object[] b)
          Test whether two object arrays contain the same items.
static java.lang.String readTestResult(java.io.InputStream istream)
           
static java.lang.String readTestResult(java.lang.String resourceName)
           
static java.lang.String readTestResultFromFile(java.lang.String fileName)
           
static void writeTestResult(java.lang.String result, java.lang.String fileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeTestResult

public static void writeTestResult(java.lang.String result,
                                   java.lang.String fileName)
                            throws java.io.IOException
Throws:
java.io.IOException

readTestResult

public static java.lang.String readTestResult(java.io.InputStream istream)
                                       throws java.io.IOException
Parameters:
istream -
Returns:
Throws:
java.io.IOException

readTestResult

public static java.lang.String readTestResult(java.lang.String resourceName)
                                       throws java.io.IOException
Parameters:
resourceName -
Returns:
the contents of the resource as a String
Throws:
java.io.IOException

readTestResultFromFile

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

closeEnough

public static boolean closeEnough(cern.colt.list.DoubleArrayList a,
                                  cern.colt.list.DoubleArrayList b,
                                  double tolerance)
Test whether two DoubleArrayLists are 'close enough' to call equal.

Parameters:
a -
b -
tolerance -
Returns:

closeEnough

public static boolean closeEnough(AbstractNamedDoubleMatrix a,
                                  AbstractNamedDoubleMatrix b,
                                  double tolerance)
Test whether two AbstractNamedDoubleMatrix are 'close enough' to call equal.

Parameters:
a -
b -
tolerance -
Returns:
try if all the values in both matrices are within 'tolerance' of each other.

closeEnough

public static boolean closeEnough(cern.colt.matrix.DoubleMatrix2D a,
                                  cern.colt.matrix.DoubleMatrix2D b,
                                  double tolerance)

closeEnough

public static boolean closeEnough(java.lang.Object[] a,
                                  java.lang.Object[] b)
Test whether two object arrays are the same.

Parameters:
a -
b -
Returns:

containsSame

public static boolean containsSame(java.util.Collection a,
                                   java.util.Collection b)
Test whether two collections contain the same items.

Parameters:
a -
b -
Returns:

containsSame

public static boolean containsSame(java.lang.Object[] a,
                                   java.lang.Object[] b)
Test whether two object arrays contain the same items. The arrays are treated as Sets - repeats are not considered.

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:


Copyright © 2003-2005 Columbia University. All Rights Reserved.