FileDocCategorySizeDatePackage
AbstractNumericTestCase.javaAPI DocApache Poi 3.0.12696Sun Mar 11 12:59:30 GMT 2007org.apache.poi.hssf.record.formula.functions

AbstractNumericTestCase

public abstract class AbstractNumericTestCase extends TestCase
author
Amol S. Deshmukh < amolweb at ya hoo dot com >

Fields Summary
public static final double
POS_ZERO
public static final double
DIFF_TOLERANCE_FACTOR
Constructors Summary
Methods Summary
public static voidassertEquals(java.lang.String message, double baseval, double checkval, double almostZero, double diffToleranceFactor)
Why doesnt JUnit have a method like this for doubles? The current impl (3.8.1) of Junit has a retar*** method for comparing doubles. DO NOT use that. TODO: This class should really be in an abstract super class to avoid code duplication across this project.

param
message
param
baseval
param
checkval

        double posZero = Math.abs(almostZero);
        double negZero = -1 * posZero;
        if (Double.isNaN(baseval)) {
            assertTrue(message+": Expected " + baseval + " but was " + checkval
                    , Double.isNaN(baseval));
        }
        else if (Double.isInfinite(baseval)) {
            assertTrue(message+": Expected " + baseval + " but was " + checkval
                    , Double.isInfinite(baseval) && ((baseval<0) == (checkval<0)));
        }
        else {
            assertTrue(message+": Expected " + baseval + " but was " + checkval
                ,baseval != 0
                    ? Math.abs(baseval - checkval) <= Math.abs(diffToleranceFactor * baseval)
                    : checkval < posZero && checkval > negZero);
        }
    
public static voidassertEquals(java.lang.String msg, double baseval, double checkval)

        assertEquals(msg, baseval, checkval, POS_ZERO, DIFF_TOLERANCE_FACTOR);
    
public voidsetUp()


       
    
public voidtearDown()