aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2009-11-22 22:39:00 +0000
committerJosh Micich <josh@apache.org>2009-11-22 22:39:00 +0000
commit433933ab0b1a4b6b654d41d42067f4ef042ae471 (patch)
tree1f1b1bb6be81918eda92502ef420c97f1a0101f2 /src
parentb095f1d02a3026762e0bb09018c800774ca285cc (diff)
downloadpoi-433933ab0b1a4b6b654d41d42067f4ef042ae471.tar.gz
poi-433933ab0b1a4b6b654d41d42067f4ef042ae471.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java10
2 files changed, 9 insertions, 6 deletions
diff --git a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java
index e14c1db951..5b772bb0c1 100644
--- a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java
+++ b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java
@@ -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);
-
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java
index b93eb7a6c7..eac8bfd113 100644
--- a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java
+++ b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java
@@ -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);
}
}
-