xref: /trunk/odf_docs/openformula-test-gap-analysis.md (revision 1354dfcdad4129e7cc561fdcfbb4f6c8958f0428) !
1<!--
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements.  See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership.  The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"); you may not use this file except in compliance
8 with the License.  You may obtain a copy of the License at
9
10   http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied.  See the License for the
16 specific language governing permissions and limitations
17 under the License.
18-->
19
20# OpenFormula Test Gap Analysis — Apache OpenOffice Calc
21
22Source-of-truth: `test/aoo-test/`, `test/odf-validate/`, and AOO source. Findings marked **[CONFIRMED]** have file:line evidence; **[UNVERIFIED]** require runtime execution.
23
24## 1. Existing test inventories
25
26### test/aoo-test/data/openformula-functions.txt
27
28- 414 lines: 391 function names after a 23-line license header. `test/odf-validate/openformula-functions.txt` has the same 391 names.
29- Header: "Names of the functions defined in OpenDocument 1.2 Part 2 (OpenFormula) chapter 6, one per line. Used by formulacheck.py to tell standard functions from nonstandard ones (Part 2 5.7)."
30- **[CONFIRMED]** Includes IFNA (line 183), SKEWP (line 350), BITAND/BITOR/BITXOR/BITLSHIFT/BITRSHIFT (lines 59-63).
31- **[CONFIRMED]** Does NOT include EASTERSUNDAY — despite EASTERSUNDAY being an implemented ODF 1.3/1.4 function (`interpr2.cxx:261`, `core_resource.src:333`).
32
33### test/odf-validate/openformula-functions.txt
34
35- 393 lines.
36- Same header (ODF 1.2 Part 2 chapter 6).
37- **[CONFIRMED]** Includes IFNA (line 162), SKEWP (line 329), BIT functions.
38- **[CONFIRMED]** Does NOT include EASTERSUNDAY.
39
40**[CONFIRMED] Both inventories are ODF 1.2-based baselines.** They are stale relative to ODF 1.4 (2025-10-06): EASTERSUNDAY (ODF 1.3/1.4) is absent from both. They list IFNA/SKEWP as "standard" — IFNA and SKEWP were implemented in Milestone B and are no longer missing, so this is no longer a false-negative for conformance.
41
42### test/aoo-test/data/calcval-cases.tsv
43
44- Present (test/aoo-test/data/). Formula evaluation test cases.
45
46### test/odf-validate/calcval-cases.tsv and calcval-cases14.tsv
47
48- Present. `calcval-cases14.tsv` is ODF 1.4-specific.
49
50### test/odf-validate tooling
51
52- `formulacheck.py`, `calcval.py`, `cmp7.py`, `compare.py`, `diff7.py`, `dump7.py`, `dump14.py`, `roundtrip.py`, `cov_*.py`, `crosscheck.py`, `gate.py`, `report.py`.
53
54## 2. Identified gaps
55
56### Outdated specification inventories
57
58- Both `openformula-functions.txt` files are explicitly ODF 1.2 chapter 6. No ODF 1.3 or ODF 1.4 function inventory exists in test data.
59- **[GAP]** No machine-readable ODF 1.4 Part 4 function/operator/requirements inventory in `test/`.
60
61### Missing function tests
62
63- **[CONFIRMED]** IFNA: listed in inventories; implemented in Milestone B (`SC_OPCODE_IFNA=409`, `ScIfna` in `interpr1.cxx`, dispatch in `interpr4.cxx:3451`). Regression tests added to `calcval-cases14.tsv` (IFNA.num, IFNA.text, IFNA.na.num, IFNA.na.text, IFNA.otherr, IFNA.lazy.ok, IFNA.lazy.err, IFNA.nested, IFNA.ref, IFNA.ref.text, IFNA.range).
64- **[CONFIRMED]** SKEWP: listed in inventories; implemented in Milestone B (`SC_OPCODE_SKEWP=410`, `ScSkewP` in `interpr3.cxx`, dispatch in `interpr4.cxx:3695`). Regression tests added to `calcval-cases14.tsv` (SKEWP.sym, SKEWP.pos, SKEWP.neg, SKEWP.vs.skew, SKEWP.one, SKEWP.zero, SKEWP.two, SKEWP.range, SKEWP.array, SKEWP.mixed, SKEWP.err).
65- **[CONFIRMED]** EASTERSUNDAY: implemented (`interpr2.cxx:261`) but NOT in either function inventory. No dedicated test coverage confirmed.
66
67**[CONFIRMED] IFNA and SKEWP are no longer missing functions.** Both were implemented in Milestone B. The test inventories list them as standard ODF functions, which is now correct. IFERROR, on the same lists, was missing until 2026-11-16 and is implemented now; the `IFERROR.*` calcval rows cover it.
68
69### Missing semantic tests
70
71- No confirmed semantic test for CONVERT `atm` (fixed in Milestone C: 101325.1 Pa vs old 101324.996583 Pa).
72- No confirmed semantic test for INDEX row-vector single-argument (fixed in Milestone A: ODF 1.4 error vs old column return).
73- DATE `DATE(1500;1;1)` is out of §6.10.2 constraints (Year>=1904) and impl-defined/diagnostic (AOO observed #VALUE!); E.1 reclassified tests to reflect this (not a mandatory #ERR).
74- No confirmed semantic test for BITAND/BITOR/BITXOR/BITLSHIFT/BITRSHIFT variadic params or negative-shift handling (interpr1.cxx:1231-1234 appears inverted).
75- No confirmed semantic test for short-circuit AND/OR.
76
77### Missing parser tests
78
79- No confirmed parser test inventory for operator precedence/associativity (e.g. `2+3*4`, `2^3^2`).
80- No confirmed parser test for automatic intersection (whitespace), reference union `~`, intersection `!`, range `:`.
81- Quoted labels as implicit intersection (ODF 1.4 §3.9) — UNVERIFIED whether tested.
82
83### Missing ODF round-trip tests
84
85- No confirmed round-trip test verifying function names written on ODF export (e.g. `ORG.OPENOFFICE.CURRENT` vs `CURRENT`, `ORG.OPENOFFICE.ERRORTYPE` vs `ERROR.TYPE`, `ORG.OPENOFFICE.EASTERSUNDAY` vs `EASTERSUNDAY`, `ORG.OPENOFFICE.STYLE` vs `STYLE`, `ORG.OPENOFFICE.MULTIRANGE` vs `~`, `MULTIRANGE` legacy).
86- `odf_docs/ODF14-KNOWN-LIMITATIONS-PUBLIC.md` notes formula cells with error results written as `office:value-type="string"` (ODF 1.4 adds `error` type) — no confirmed round-trip test for error value type.
87
88### Existing tests that produce false confidence
89
90- `openformula-functions.txt` lists IFNA/SKEWP as standard ODF 1.2 functions; AOO now implements them (Milestone B), so this is no longer a false-negative for conformance.
91- Inventories are ODF 1.2, so they do not flag ODF 1.4 regressions (INDEX row-vector fixed in Milestone A, CONVERT atm fixed in Milestone C, COUNTA empty cells/empty string).
92
93## 3. Proposed versioned test inventory
94
95| File | Version | Content | Source |
96|------|---------|---------|--------|
97| openformula-functions-1.4.txt | ODF 1.4 | Full normative function list from Part 4 chapter 6 | To be extracted from ODF 1.4 Part 4 |
98| openformula-functions-1.3.txt | ODF 1.3 | ODF 1.3 function list | To be extracted |
99| openformula-functions-1.2.txt | ODF 1.2 | Existing baseline (rename current files) | Current test files |
100| openformula-operators-1.4.txt | ODF 1.4 | Operator/grammar inventory | To be extracted |
101| openformula-semantics-1.4.tsv | ODF 1.4 | Conversion/error/short-circuit/array cases | To be derived from spec |
102
103## 4. Strategy for auto-generating tests from normative data
104
105- Parse ODF 1.4 Part 4 (or a machine-readable rendering) to extract function names, signatures, parameter classifications, and operator definitions.
106- Emit versioned `openformula-functions-<ver>.txt` inventories for formulacheck.py consumption.
107- Emit calcval-style cases from normative examples (each spec section's examples become expected-result cases).
108- Do NOT add tests to the normal production build (per audit constraint); keep in `test/odf-validate/` or a separate conformance suite.
109
110## 5. Gap summary
111
112| Category | Gap | Severity |
113|----------|-----|----------|
114| Spec inventory | No ODF 1.3/1.4 function/operator inventory in test/ | High |
115| Missing functions | None — IFNA and SKEWP implemented in Milestone B, IFERROR on 2026-11-16 | None |
116| Implemented but uninventoried | EASTERSUNDAY not in either test inventory | Medium |
117| Semantic tests | CONVERT atm (fixed Milestone C), INDEX row-vector (fixed Milestone A), DATE pre-1583, bit ops, short-circuit | High |
118| Parser tests | Precedence, intersection, union, quoted labels | Medium |
119| Round-trip tests | Function-name export aliases, error value type | Medium |
120| False confidence | None — IFNA/SKEWP now implemented, matching inventory | None |
121
122## E.1 Small Group corrections
123
124- Corrected `BL-001-1024chars` to 1026-char formula expression (`=1`+`+1`*512, result 513) and `BL-004-7nesting` to 7 genuinely nested IF levels.
125- Added `SG-SYN-001` Criteria syntax (§4.11.11) coverage in the Small Group test inventory.
126- Clarified `SG-SYN-009` named-expression test requires pre-defined name (`MYNAME`) not provided by calcval harness.
127- Updated COUNTA/COUNTBLANK fixtures for empty cells and empty string semantics per §6.13.7/§6.13.8; documented `""`-in-cell COUNTBLANK limitation of calcval fixtures.
128- Reclassified `FN-016-DATE-pre1583` / `DATE.pre1583` as implementation-defined/diagnostic for out-of-constraint input.
129