|Summary:||[PATCH] Formula Support for TRUE/FALSE|
|Product:||POI||Reporter:||Paul Krause <pkrause>|
|Component:||HSSF||Assignee:||POI Developers List <dev>|
BoolPtg.java (new file to support boolean token group)
Patch Ptg.java to use BoolPtg.java
Patch FormulaParser to use BoolPtg
Add 2 new test cases to TestFormulaParser
Description Paul Krause 2002-09-27 14:07:14 UTC
The boolean PTG (1d) is not supported. The causes errors when reading formulas thats use the TRUE or FALSE literals.
Comment 1 Paul Krause 2002-09-27 14:14:29 UTC
Created attachment 3260 [details] BoolPtg.java (new file to support boolean token group)
Comment 2 Paul Krause 2002-09-27 14:16:55 UTC
Created attachment 3261 [details] Patch Ptg.java to use BoolPtg.java
Comment 3 Paul Krause 2002-09-27 14:18:46 UTC
Committers, please review the patch and decide whether to add it to HEAD.
Comment 4 Andy Oliver 2002-09-27 14:45:52 UTC
can you supply a unit test for these components as well? Also you may want to patch FormulaParser to add write support. Thanks!
Comment 5 Paul Krause 2002-09-27 15:03:39 UTC
Created attachment 3263 [details] Patch FormulaParser to use BoolPtg
Comment 6 Paul Krause 2002-09-27 15:06:00 UTC
FormulaParser is not much fun to work with, but I've done my best. Now how do I go about writing a testcase? I modeled BoolPtg after IntPtg, so the IntPtg test case would be the logical starting place. But I can't find one for IntPtg, or any other Ptg.
Comment 7 Paul Krause 2002-09-29 02:27:38 UTC
Created attachment 3281 [details] Add 2 new test cases to TestFormulaParser
Comment 8 Andy Oliver 2002-10-01 17:50:20 UTC
applied. In the future please put new files in directory preserving archives with context relative to jakarta-poi. (zip/tar.gz/tar.bz) Please label their type in the description (I'm a bad guesser). Patches should be created relative to jakarta-poi (and preserve the path). thanks. Please also add the appropriate tests to src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java (basically that they can be read and written and read from the file properly) You bring up a good point about the PTGs. The PTGs were actually part of an earlier prototype of formula support that I began November of last year. I did not think it would actually end up in the real thing, but I guess Avik found them useful. Probably about 50% or more of the HSSF was written in that time period. We do not yet have an official policy regarding unit tests being required, but I know at least I will vote -1 to release any new code as "production" until the unit tests are written. Old code is "grandfathered" in and we'll add unit tests as time permits or bugs necessitate. So With that in mind, how to write a testcase. Well thats pretty simple. create a file called TestBoolPtg in src/testcases/org/apache/poi/hssf/record/formula/. Create a testBla() function for each piece of functionality you want to test. At minimum you should test that the inputs yeild the expected results. So construct an instance of BoolPtg the way formula parser would and test that the results are what you would expect (all properties, etc). Then construct it as Ptg would and check the results. Its best to check all the common properties as they should be used. Thank you for your contribution.