diff options
author | Nick Burch <nick@apache.org> | 2008-02-14 16:01:10 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2008-02-14 16:01:10 +0000 |
commit | 2598100690fe56d623b46352d1da6a267c26f8ed (patch) | |
tree | c44e08a753206f77c64f6a3b4f0be3b275bd8149 /src/testcases/org | |
parent | 420452b471ef3815f0ec4482958282a25a342ff7 (diff) | |
download | poi-2598100690fe56d623b46352d1da6a267c26f8ed.tar.gz poi-2598100690fe56d623b46352d1da6a267c26f8ed.zip |
Big formula update from Josh from bug #44364 - support for Match, NA and SumProduct functions, and initial error support in functions
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@627788 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls | bin | 130048 -> 134656 bytes | |||
-rw-r--r-- | src/testcases/org/apache/poi/hssf/data/TestDataValidation.xls | bin | 134656 -> 21504 bytes | |||
-rw-r--r-- | src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java | 27 |
3 files changed, 22 insertions, 5 deletions
diff --git a/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls b/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls Binary files differindex cf4b6fa501..001432f0aa 100644 --- a/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls +++ b/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls diff --git a/src/testcases/org/apache/poi/hssf/data/TestDataValidation.xls b/src/testcases/org/apache/poi/hssf/data/TestDataValidation.xls Binary files differindex 001432f0aa..5241369212 100644 --- a/src/testcases/org/apache/poi/hssf/data/TestDataValidation.xls +++ b/src/testcases/org/apache/poi/hssf/data/TestDataValidation.xls diff --git a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java index 1b41d87d4d..e7400bc351 100644 --- a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java +++ b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java @@ -18,6 +18,8 @@ package org.apache.poi.hssf.model; +import java.util.List; + import junit.framework.TestCase; import org.apache.poi.hssf.record.formula.AbstractFunctionPtg; @@ -26,6 +28,7 @@ import org.apache.poi.hssf.record.formula.AttrPtg; import org.apache.poi.hssf.record.formula.BoolPtg; import org.apache.poi.hssf.record.formula.DividePtg; import org.apache.poi.hssf.record.formula.EqualPtg; +import org.apache.poi.hssf.record.formula.FuncPtg; import org.apache.poi.hssf.record.formula.FuncVarPtg; import org.apache.poi.hssf.record.formula.IntPtg; import org.apache.poi.hssf.record.formula.LessEqualPtg; @@ -397,7 +400,7 @@ public class TestFormulaParser extends TestCase { public void testUnderscore() { HSSFWorkbook wb = new HSSFWorkbook(); - wb.createSheet("Cash_Flow");; + wb.createSheet("Cash_Flow"); HSSFSheet sheet = wb.createSheet("Test"); HSSFRow row = sheet.createRow(0); @@ -438,7 +441,7 @@ public class TestFormulaParser extends TestCase { public void testExponentialInSheet() throws Exception { HSSFWorkbook wb = new HSSFWorkbook(); - wb.createSheet("Cash_Flow");; + wb.createSheet("Cash_Flow"); HSSFSheet sheet = wb.createSheet("Test"); HSSFRow row = sheet.createRow(0); @@ -514,7 +517,7 @@ public class TestFormulaParser extends TestCase { public void testNumbers() { HSSFWorkbook wb = new HSSFWorkbook(); - wb.createSheet("Cash_Flow");; + wb.createSheet("Cash_Flow"); HSSFSheet sheet = wb.createSheet("Test"); HSSFRow row = sheet.createRow(0); @@ -553,7 +556,7 @@ public class TestFormulaParser extends TestCase { public void testRanges() { HSSFWorkbook wb = new HSSFWorkbook(); - wb.createSheet("Cash_Flow");; + wb.createSheet("Cash_Flow"); HSSFSheet sheet = wb.createSheet("Test"); HSSFRow row = sheet.createRow(0); @@ -571,5 +574,19 @@ public class TestFormulaParser extends TestCase { cell.setCellFormula("A1...A2"); formula = cell.getCellFormula(); assertEquals("A1:A2", formula); - } + } + + /** + * Test for bug observable at svn revision 618865 (5-Feb-2008)<br/> + * a formula consisting of a single no-arg function got rendered without the function braces + */ + public void testToFormulaStringZeroArgFunction() { + + Workbook book = Workbook.createWorkbook(); // not really used in this test + + Ptg[] ptgs = { + new FuncPtg(10, 0), + }; + assertEquals("NA()", FormulaParser.toFormulaString(book, ptgs)); + } } |