poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r883167 - in /poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions: TestAverage.java TestDate.java
Date Sun, 22 Nov 2009 22:39:00 GMT
Author: josh
Date: Sun Nov 22 22:39:00 2009
New Revision: 883167

URL: http://svn.apache.org/viewvc?rev=883167&view=rev
Log:
small tweaks to junit code - enabled one test case for AVERAGE() and improved diagnostics
in TestDate

Modified:
    poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java?rev=883167&r1=883166&r2=883167&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestAverage.java
Sun Nov 22 22:39:00 2009
@@ -86,9 +86,7 @@
 
 	}
 
-	// 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 @@
 				ErrorEval.DIV_ZERO,
 		};
 		confirmAverage(values, ErrorEval.NAME_INVALID);
-
 	}
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java?rev=883167&r1=883166&r2=883167&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestDate.java Sun
Nov 22 22:39:00 2009
@@ -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 @@
     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);
     }
 }
-



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message