xref: /trunk/odf_docs/openformula-small-group-test-plan.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 1.4 Small Group Test Plan
21
22## Purpose
23
24Establish reproducible ODF 1.4 Part 4 Small Group conformance tests before making any
25implementation changes. Tests are prepared for later execution once the implementation
26milestones are complete. No production evaluator changes are made in this milestone.
27
28## Test Files
29
30| File | Purpose |
31|------|---------|
32| `odf_docs/openformula-small-group-1.4-tests.tsv` | Requirement-referenced test inventory (148 ReqIDs; includes E.1 corrections and added `SG-SYN-001` criteria test) |
33| `test/odf-validate/calcval-cases14.tsv` | Existing calcval cases, extended with Small Group semantic tests |
34| `openformula-small-group-test-plan.md` | This document: execution instructions and outstanding runtime requirements |
35
36## Execution Instructions
37
38### Prerequisites
39
40A configured AOO build tree is required. The `sc` and `scaddins` modules must be built:
41
421. Configure AOO (`autogen.sh`/`configure`, then `build.pl --all`)
432. Build the `sc` module (Calc core)
443. Build the `scaddins` module (Analysis Add-in for CONVERT)
45
46### Running calcval Tests
47
48The `test/odf-validate/` directory contains the calcval test harness (designed for macOS):
49
50```bash
51# Start the calcval server
52test/odf-validate/start.sh calcval <port>
53
54# Run test cases
55test/odf-validate/runpy.sh calcval.py <port> calcval-cases14.tsv <out.json>
56
57# Compare results
58python3 -I calcval.py --compare <out.json> <expected.json>
59```
60
61### Test Case Format
62
63Each calcval case has 5 tab-separated columns:
64
651. **id**: Unique test identifier
662. **formula**: AOO API syntax (English function names, ';' separators)
673. **mode**: `cell` (plain cell), `cell@N` (scratch cell), `array[:CxR]` (array formula)
684. **expected**: Expected result ('-', number with tolerance, '#N/A', '#ERR', 's:text')
695. **note**: Normative section reference and description
70
71### Priority Order for Test Execution
72
73| Priority | Area | Test Cases | Rationale |
74|----------|------|------------|-----------|
75| 1 | COUNTA/COUNTBLANK empty cells / empty string | `COUNTA.empty`, `COUNTA.emptystr`, `COUNTBLANK.empty`, `COUNTBLANK.range` (calcval14) and corresponding SG tests | ODF 1.4 §6.13.7 counts `""` as non-blank; §6.13.8 `""`-in-cell is impl-defined and not directly reproducible with current calcval fixtures |
76| 2 | DATE out-of-constraint/pre-1583 | `DATE.pre1583` / `FN-016-DATE-pre1583` | §6.10.2 constrains Year>=1904; `DATE(1500;1;1)` is impl-defined/diagnostic (not mandatory `#ERR`) |
77| 3 | INDEX row-vector | `INDEX.row.rowonly`, `INDEX.row.empty`, `INDEX.row.outrange` | Legacy rule kept as a known deviation (Milestone A change reverted) |
78| 4 | Bitwise functions | `BITLSHIFT.neg`, `BITRSHIFT.neg`, `BITAND.3params` | Parameter count and negative shift behavior |
79| 5 | Parser/operators | `SYN-005-precedence`, `SYN-005-power`, `OP-006-div0` | Operator precedence and associativity |
80
81## Outstanding Runtime Requirements
82
83The following cannot be verified until a configured AOO build tree exists:
84
85| Requirement | Reason |
86|-------------|--------|
87| All 4 Basic Limits (§3.7) | No runtime test execution possible |
88| All 11 Syntax items (§5) | No runtime test execution possible |
89| All 5 Implicit Conversions (§6.3) | No runtime test execution possible |
90| All 14 Operators (§6.4) | No runtime test execution possible |
91| All 110 Functions (§2.3.2.E) | No runtime test execution possible |
92| ODF save/reload round-trip | No built office available |
93| Excel import/export | No built office available |
94
95## Calcval Harness Portability Constraints
96
97The `test/odf-validate/` calcval launcher is macOS-only and is NOT directly Linux-compatible. It is not ported in this milestone.
98
99- **zsh `${0:A:h}` path expansion**: `start.sh`, `runpy.sh`, and `env.sh` rely on the zsh-specific `${0:A:h}` parameter expansion for path resolution; `start.sh` and `runpy.sh` use `#!/bin/zsh` shebangs, while `env.sh` (sourced, no shebang) also uses zsh-specific syntax at `test/odf-validate/env.sh:23`.
100- **macOS application bundle path**: `env.sh` sets `APP=${ODFV_APP:-$D/app/OpenOffice.app}/Contents`, and `start.sh:25` launches `$APP/MacOS/soffice` (an `.app` bundle structure that does not exist on Linux).
101- **Apple Python Framework default**: `env.sh:28` defaults `PY=/usr/local/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14` (macOS Python Framework path).
102- **External `lsof` dependency**: `start.sh:28` polls with `lsof -nP -iTCP:$2 -sTCP:LISTEN` to wait for the office socket; `lsof` itself is available on Linux, but the harness depends on its presence.
103
104No production source or runtime behavior changed. All corrections are test data/docs only.
105
106## Relationship to Milestones
107
108- **Milestone D**: Established the 110-function Small Group inventory
109- **Milestone D.1**: Corrected audit inconsistencies (statuses = IMPLEMENTED_UNVERIFIED)
110- **Milestone E (this)**: Created test inventory and test cases
111- **Milestone F**: Implement confirmed semantic corrections (narrowly scoped)
112- **Milestone G**: ODF import/export and round-trip conformance
113- **Milestone H**: Final consolidated verification
114
115## What Must NOT Change
116
117- No production evaluator changes in this milestone
118- No new runtime dependencies
119- No mandatory `sc` or `scaddins` builds during this milestone
120- Tests use existing `test/odf-validate` tooling and `calcval-cases14.tsv` conventions
121- Tests are NOT added to the normal production build
122
123## E.1 Corrections
124
125- `SG-BL-001` / `BL-001-1024chars`: formula expression length 1026 chars (`=1` + `+1`*512), expected 513.
126- `SG-BL-004` / `BL-004-7nesting`: 7 genuinely nested `IF` function levels, balanced parens, expected 1.
127- `SG-SYN-001` / `SYN-001-criteria`: added Criteria syntax §4.11.11 test using `DCOUNT(R1:T6;;V1:V2)` against existing database/criteria fixtures (expected 4).
128- `SG-SYN-009` / `SYN-009-named`: requires pre-defined named expression `MYNAME`; not directly executable in calcval harness without name setup.
129- `SG-FN-013` / `FN-016` tests updated: COUNTA covers empty cells and empty string `""`; COUNTBLANK covers truly empty cells; `""`-in-cell blankness is implementation-defined and not directly reproducible with calcval fixtures.
130- `SG-FN-016` / `FN-016-DATE-pre1583`: reclassified as impl-defined/diagnostic (Year < 1904 outside §6.10.2 constraints).
131
132**Static validation only** (no AOO build tree; calcval macOS-only): TSV structure/columns, duplicate IDs, char/nesting counts, fixture references, and count reconciliation checked. Runtime execution not performed.
133