mirror of https://github.com/apache/poi.git
small tweaks to junit code - enabled one test case for AVERAGE() and improved diagnostics in TestDate
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@883167 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b095f1d02a
commit
433933ab0b
|
@ -86,9 +86,7 @@ public final class TestAverage extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
// currently disabled because MultiOperandNumericFunction.getNumberArray(Eval[], int, short)
|
||||
// does not handle error values properly yet
|
||||
public void XtestErrors() {
|
||||
public void testErrors() {
|
||||
ValueEval[] values = {
|
||||
new NumberEval(1),
|
||||
ErrorEval.NAME_INVALID,
|
||||
|
@ -96,6 +94,5 @@ public final class TestAverage extends TestCase {
|
|||
ErrorEval.DIV_ZERO,
|
||||
};
|
||||
confirmAverage(values, ErrorEval.NAME_INVALID);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,15 @@
|
|||
|
||||
package org.apache.poi.hssf.record.formula.functions;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellValue;
|
||||
|
||||
/**
|
||||
* @author Pavel Krupets (pkrupets at palmtreebusiness dot com)
|
||||
|
@ -77,8 +80,11 @@ public final class TestDate extends TestCase {
|
|||
private void confirm(String formulaText, double expectedResult) {
|
||||
cell11.setCellFormula(formulaText);
|
||||
evaluator.clearAllCachedResultValues();
|
||||
double actualValue = evaluator.evaluate(cell11).getNumberValue();
|
||||
CellValue cv = evaluator.evaluate(cell11);
|
||||
if (cv.getCellType() != Cell.CELL_TYPE_NUMERIC) {
|
||||
throw new AssertionFailedError("Wrong result type: " + cv.formatAsString());
|
||||
}
|
||||
double actualValue = cv.getNumberValue();
|
||||
assertEquals(expectedResult, actualValue, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue