Added Implementations for Excel functions MATCH(), NA(), SUMPRODUCT(). Added junits. Rewrote 3 classes(GenericFormulaTestCase, TestEverything, TestEverything) into TestFormulasFromSpreadsheet. This served a few purposes: - to allow for more conventional structuring of the test suites - to formalise and simplify the interface between the test spreadsheet and the test code. - to identify and fix a few bugs (related to comparing expected vs actual evaluation results) Those 3 classes should be deleted. The most correct appropriate predecessor of TestFormulasFromSpreadsheet is GenericFormulaTestCase. Added cases for COUNTA, COUNTIF, MATCH, NA, and SUMPRODUCT to the spreadsheet As a result of fixing the spreadsheet and related test, a few other bugs became visible. Fixed Excel error code propagation throughout HSSFFormulaEvaluator. Fixed error code handling in ROUNDDOWN(), ROUNDUP() and T(). Added junits. Note - TestFormulasFromSpreadsheet has a disabled assert which confirms expected error codes. This can be enabled after another 45 functions like ROUNDDOWN and ROUNDUP are fixed wrt. error handling. Fixed bug (involving column area refs) in UnaryPlusEval. Added junit. Fixed FormulaParser.toFormulaString() for the case of a single no-arg function e.g. "=NOW()". Added junit.
Created attachment 21477 [details] svn diff
Created attachment 21478 [details] tar bzip2 of newly added files (5 junit classes)
Created attachment 21479 [details] new version of TestDataValidation.xls svn diff skips binary files This spreadsheet belongs here: src/testcases/org/apache/poi/hssf/data/TestDataValidation.xls
Thanks for this, it's quite the mammoth patch! I've done a visual review of the patch, and it does seem fine from that. Given the size, I'll wait a few days for other people to cast an eye over it, and if no-one shouts I'll then apply it
I exercised your code and TestFormulasFromSpreadsheet fails: ant -Dtestcase=org.apache.poi.hssf.record.formula.eval.TestFormulasFromSpreadsheet single-scratchpad-test ..... Test spreadsheet cell empty on row (79). Expected function name or '<END-OF-FUNCTIONS>' junit.framework.AssertionFailedError: Test spreadsheet cell empty on row (79). Expected function name or '<END-OF-FUNCTIONS>' at org.apache.poi.hssf.record.formula.eval.TestFormulasFromSpreadsheet.processFunctionGroup(TestFormulasFromSpreadsheet.java:205) at org.apache.poi.hssf.record.formula.eval.TestFormulasFromSpreadsheet.testFunctionsFromTestSpreadsheet(TestFormulasFromSpreadsheet.java:171) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) See the attached junit report. All other tests pass. Yegor
Created attachment 21492 [details] junit report on failing TestFormulasFromSpreadsheet
You need to copy the new version of TestDataValidation.xls to src/testcases/org/apache/poi/hssf/data/ I wasn't sure about how to include modified binary files in patch submissions. The last revision of this file seems to be 615859 (Jan 28), and my work was after that so there shouldn't be any need to merge.
Request for next time... If you are uploading a new version of TestDataValidation.xls again, any chance you could gzip / bzip it first? It's pretty beasting, and takes an age to download over GPRS, which is an issue when I decide to work on POI from a cafe! (Just doing a final review before applying now)
Thanks for this, applied to svn Had to copy the new TestDataValidation.xls to FormulaEvalTestData.xls to get it to work. I think we need to review the fact that we have these two, and also try to figure out why TestDataValidation.xls sometimes gets changed