The boolean PTG (1d) is not supported. The causes errors when reading formulas thats use the TRUE or FALSE literals.
Created attachment 3260 [details] BoolPtg.java (new file to support boolean token group)
Created attachment 3261 [details] Patch Ptg.java to use BoolPtg.java
Committers, please review the patch and decide whether to add it to HEAD.
can you supply a unit test for these components as well? Also you may want to patch FormulaParser to add write support. Thanks!
Created attachment 3263 [details] Patch FormulaParser to use BoolPtg
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.
Created attachment 3281 [details] Add 2 new test cases to TestFormulaParser
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.