oficina / sheets Public

Clone
git clone https://amadan.net/oficina/sheets

Plain git — no account needed to clone.

Download

Download this file

1{
2 "note": "GENERATED by tools/gencorpus from a real headless LibreOffice 26.8.0.3 run: each entry's \"want\" is what that LibreOffice computed for that exact formula, exported via `--convert-to csv`, not a value anyone reasoned out. Recalculation on export is proven per run, not assumed: every formula cell is written with a poisoned office:value cache (999999) and the run fails if that value comes back. Two honest caveats. (1) The values come through LibreOffice's CSV export, which renders a number at roughly 15 significant digits with trailing zeros stripped -- SQRT(2) is recorded as 1.4142135623731, not the full 1.4142135623730951; corpus_test.go's valuesMatch compares numbers with a 1e-9 epsilon, so this is a rendering artifact, not a disagreement. (2) LibreOffice Calc is not Excel. Where the two are known to differ, the difference is recorded and reasoned about in internal/sheets/xlsx/oracle_divergences_test.go, cross-checked against excelize's independent formula engine -- this file records Calc's answer. Regenerate with `go run ./tools/gencorpus -out /home/paulca/.cache/tmp/c4.json` (add -soffice /path/to/soffice if it is not on PATH) whenever a case is added; commit the result and update corpusSHA256 in internal/sheets/calc/corpus_test.go.",
3 "entries": [
4 {"function": "SUM", "expr": "SUM(1,2,3)", "want": {"kind": "num", "num": 6}},
5 {"function": "SUM", "expr": "SUM(1,2,3,4,5)", "want": {"kind": "num", "num": 15}},
6 {"function": "SUM", "expr": "SUM(-5,5)", "want": {"kind": "num", "num": 0}},
7 {"function": "SUM", "expr": "SUM(1.5,2.5)", "want": {"kind": "num", "num": 4}},
8 {"function": "AVERAGE", "expr": "AVERAGE(2,4,6)", "want": {"kind": "num", "num": 4}},
9 {"function": "AVERAGE", "expr": "AVERAGE(1,2,3,4)", "want": {"kind": "num", "num": 2.5}},
10 {"function": "COUNT", "expr": "COUNT(1,2,\"a\",TRUE)", "want": {"kind": "num", "num": 3}},
11 {"function": "COUNTA", "expr": "COUNTA(1,2,\"a\",TRUE)", "want": {"kind": "num", "num": 4}},
12 {"function": "MIN", "expr": "MIN(4,2,9,1)", "want": {"kind": "num", "num": 1}},
13 {"function": "MAX", "expr": "MAX(4,2,9,1)", "want": {"kind": "num", "num": 9}},
14 {"function": "ROUND", "expr": "ROUND(3.14159,2)", "want": {"kind": "num", "num": 3.14}},
15 {"function": "ROUND", "expr": "ROUND(2.5,0)", "want": {"kind": "num", "num": 3}},
16 {"function": "ROUND", "expr": "ROUND(-2.5,0)", "want": {"kind": "num", "num": -3}},
17 {"function": "ROUNDUP", "expr": "ROUNDUP(3.14159,2)", "want": {"kind": "num", "num": 3.15}},
18 {"function": "ROUNDUP", "expr": "ROUNDUP(3.001,0)", "want": {"kind": "num", "num": 4}},
19 {"function": "ROUNDDOWN", "expr": "ROUNDDOWN(3.99,0)", "want": {"kind": "num", "num": 3}},
20 {"function": "ROUNDDOWN", "expr": "ROUNDDOWN(-3.99,0)", "want": {"kind": "num", "num": -3}},
21 {"function": "ABS", "expr": "ABS(-7)", "want": {"kind": "num", "num": 7}},
22 {"function": "ABS", "expr": "ABS(7)", "want": {"kind": "num", "num": 7}},
23 {"function": "SQRT", "expr": "SQRT(16)", "want": {"kind": "num", "num": 4}},
24 {"function": "SQRT", "expr": "SQRT(2)", "want": {"kind": "num", "num": 1.4142135623731}},
25 {"function": "POWER", "expr": "POWER(2,10)", "want": {"kind": "num", "num": 1024}},
26 {"function": "POWER", "expr": "POWER(9,0.5)", "want": {"kind": "num", "num": 3}},
27 {"function": "MOD", "expr": "MOD(10,3)", "want": {"kind": "num", "num": 1}},
28 {"function": "MOD", "expr": "MOD(-10,3)", "want": {"kind": "num", "num": 2}},
29 {"function": "MOD", "expr": "MOD(10,-3)", "want": {"kind": "num", "num": -2}},
30 {"function": "IF", "expr": "IF(TRUE,\"yes\",\"no\")", "want": {"kind": "str", "str": "yes"}},
31 {"function": "IF", "expr": "IF(FALSE,\"yes\",\"no\")", "want": {"kind": "str", "str": "no"}},
32 {"function": "IF", "expr": "IF(FALSE,1/0,5)", "want": {"kind": "num", "num": 5}},
33 {"function": "IFS", "expr": "IFS(FALSE,1,TRUE,2,TRUE,3)", "want": {"kind": "num", "num": 2}},
34 {"function": "AND", "expr": "AND(TRUE,TRUE,TRUE)", "want": {"kind": "bool", "bool": true}},
35 {"function": "AND", "expr": "AND(TRUE,FALSE)", "want": {"kind": "bool", "bool": false}},
36 {"function": "OR", "expr": "OR(FALSE,FALSE,TRUE)", "want": {"kind": "bool", "bool": true}},
37 {"function": "OR", "expr": "OR(FALSE,FALSE)", "want": {"kind": "bool", "bool": false}},
38 {"function": "NOT", "expr": "NOT(TRUE)", "want": {"kind": "bool", "bool": false}},
39 {"function": "NOT", "expr": "NOT(FALSE)", "want": {"kind": "bool", "bool": true}},
40 {"function": "IFERROR", "expr": "IFERROR(1/0,\"fallback\")", "want": {"kind": "str", "str": "fallback"}},
41 {"function": "IFERROR", "expr": "IFERROR(5,\"fallback\")", "want": {"kind": "num", "num": 5}},
42 {"function": "CONCAT", "expr": "CONCAT(\"foo\",\"bar\")", "want": {"kind": "str", "str": "foobar"}},
43 {"function": "CONCAT", "expr": "CONCAT(\"a\",1,\"b\")", "want": {"kind": "str", "str": "a1b"}},
44 {"function": "LEFT", "expr": "LEFT(\"hello\",3)", "want": {"kind": "str", "str": "hel"}},
45 {"function": "LEFT", "expr": "LEFT(\"hello\")", "want": {"kind": "str", "str": "h"}},
46 {"function": "RIGHT", "expr": "RIGHT(\"hello\",3)", "want": {"kind": "str", "str": "llo"}},
47 {"function": "RIGHT", "expr": "RIGHT(\"hello\")", "want": {"kind": "str", "str": "o"}},
48 {"function": "MID", "expr": "MID(\"hello\",2,3)", "want": {"kind": "str", "str": "ell"}},
49 {"function": "LEN", "expr": "LEN(\"hello\")", "want": {"kind": "num", "num": 5}},
50 {"function": "LEN", "expr": "LEN(\"\")", "want": {"kind": "num", "num": 0}},
51 {"function": "TRIM", "expr": "TRIM(\" a b \")", "want": {"kind": "str", "str": "a b"}},
52 {"function": "UPPER", "expr": "UPPER(\"MixedCase\")", "want": {"kind": "str", "str": "MIXEDCASE"}},
53 {"function": "LOWER", "expr": "LOWER(\"MixedCase\")", "want": {"kind": "str", "str": "mixedcase"}},
54 {"function": "VLOOKUP", "expr": "VLOOKUP(20,A1:B3,2,FALSE)", "want": {"kind": "str", "str": "twenty"}},
55 {"function": "VLOOKUP", "expr": "VLOOKUP(25,A1:B3,2,TRUE)", "want": {"kind": "str", "str": "twenty"}},
56 {"function": "VLOOKUP", "expr": "VLOOKUP(99,A1:B3,2,FALSE)", "want": {"kind": "err", "err": "#N/A"}},
57 {"function": "INDEX", "expr": "INDEX(A1:B3,2,2)", "want": {"kind": "str", "str": "twenty"}},
58 {"function": "INDEX", "expr": "INDEX(A1:B3,3,1)", "want": {"kind": "num", "num": 30}},
59 {"function": "MATCH", "expr": "MATCH(20,A1:A3,0)", "want": {"kind": "num", "num": 2}},
60 {"function": "MATCH", "expr": "MATCH(25,A1:A3,1)", "want": {"kind": "num", "num": 2}},
61 {"function": "COUNT", "expr": "COUNT(A1,C1)", "want": {"kind": "num", "num": 1}},
62 {"function": "COUNTA", "expr": "COUNTA(A1,C1)", "want": {"kind": "num", "num": 1}},
63 {"function": "AVERAGE", "expr": "AVERAGE(A1,A2,A3)", "want": {"kind": "num", "num": 20}},
64 {"function": "SUMIF", "expr": "SUMIF(A1:A3,\"\u003e15\")", "want": {"kind": "num", "num": 50}},
65 {"function": "SUMIF", "expr": "SUMIF(A1:A3,\"\u003e=20\")", "want": {"kind": "num", "num": 50}},
66 {"function": "SUMIF", "expr": "SUMIF(B1:B3,\"ten\",A1:A3)", "want": {"kind": "num", "num": 10}},
67 {"function": "SUMIF", "expr": "SUMIF(B1:B3,\"t*\",A1:A3)", "want": {"kind": "num", "num": 60}},
68 {"function": "COUNTIF", "expr": "COUNTIF(B1:B3,\"t*\")", "want": {"kind": "num", "num": 3}},
69 {"function": "COUNTIF", "expr": "COUNTIF(B1:B3,\"t??\")", "want": {"kind": "num", "num": 1}},
70 {"function": "COUNTIF", "expr": "COUNTIF(B1:B3,\"t?n\")", "want": {"kind": "num", "num": 1}},
71 {"function": "COUNTIF", "expr": "COUNTIF(B1:B3,\"*y\")", "want": {"kind": "num", "num": 2}},
72 {"function": "SUMIFS", "expr": "SUMIFS(A1:A3,B1:B3,\"t*\")", "want": {"kind": "num", "num": 60}},
73 {"function": "COUNTIFS", "expr": "COUNTIFS(A1:A3,\"\u003e=20\",B1:B3,\"t*\")", "want": {"kind": "num", "num": 2}},
74 {"function": "COUNTIF", "expr": "COUNTIF(A1:A3,\"\u003e15\")", "want": {"kind": "num", "num": 2}},
75 {"function": "COUNTIF", "expr": "COUNTIF(A1:A3,\"\u003c\u003e20\")", "want": {"kind": "num", "num": 2}},
76 {"function": "AVERAGEIF", "expr": "AVERAGEIF(A1:A3,\"\u003e15\")", "want": {"kind": "num", "num": 25}},
77 {"function": "AVERAGEIF", "expr": "AVERAGEIF(B1:B3,\"\u003c\u003eten\",A1:A3)", "want": {"kind": "num", "num": 25}},
78 {"function": "SUMIFS", "expr": "SUMIFS(A1:A3,A1:A3,\"\u003e10\",A1:A3,\"\u003c30\")", "want": {"kind": "num", "num": 20}},
79 {"function": "COUNTIFS", "expr": "COUNTIFS(A1:A3,\"\u003e100\")", "want": {"kind": "num", "num": 0}},
80 {"function": "AVERAGEIFS", "expr": "AVERAGEIFS(A1:A3,B1:B3,\"\u003c\u003eten\")", "want": {"kind": "num", "num": 25}},
81 {"function": "COUNTIF", "expr": "COUNTIF(A1:C3,\"\u003c\u003e20\")", "want": {"kind": "num", "num": 8}},
82 {"function": "COUNTIF", "expr": "COUNTIF(B1:B3,\"\u003c\u003e20\")", "want": {"kind": "num", "num": 3}},
83 {"function": "COUNTIF", "expr": "COUNTIF(A1:C3,\"\u003e5\")", "want": {"kind": "num", "num": 3}},
84 {"function": "COUNTIF", "expr": "COUNTIF(A1:C3,\"\u003c\u003e\")", "want": {"kind": "num", "num": 6}},
85 {"function": "COUNTIF", "expr": "COUNTIF(A1:C3,\"=\")", "want": {"kind": "num", "num": 3}},
86 {"function": "SUMIF", "expr": "SUMIF(A1:C3,\"\u003c\u003e20\")", "want": {"kind": "num", "num": 40}},
87 {"function": "AVERAGEIF", "expr": "AVERAGEIF(A1:C3,\"\u003e5\")", "want": {"kind": "num", "num": 20}},
88 {"function": "COUNTIF", "expr": "COUNTIF(A1:C3,\"ten\")", "want": {"kind": "num", "num": 1}},
89 {"function": "ISBLANK", "expr": "ISBLANK(C1)", "want": {"kind": "bool", "bool": true}},
90 {"function": "ISBLANK", "expr": "ISBLANK(A1)", "want": {"kind": "bool", "bool": false}},
91 {"function": "ISNUMBER", "expr": "ISNUMBER(A1)", "want": {"kind": "bool", "bool": true}},
92 {"function": "ISNUMBER", "expr": "ISNUMBER(B1)", "want": {"kind": "bool", "bool": false}},
93 {"function": "ISTEXT", "expr": "ISTEXT(B1)", "want": {"kind": "bool", "bool": true}},
94 {"function": "ISTEXT", "expr": "ISTEXT(A1)", "want": {"kind": "bool", "bool": false}},
95 {"function": "ISERROR", "expr": "ISERROR(1/0)", "want": {"kind": "bool", "bool": true}},
96 {"function": "ISERROR", "expr": "ISERROR(A1)", "want": {"kind": "bool", "bool": false}},
97 {"function": "YEAR", "expr": "YEAR(DATE(2026,9,3))", "want": {"kind": "num", "num": 2026}},
98 {"function": "MONTH", "expr": "MONTH(DATE(2026,9,3))", "want": {"kind": "num", "num": 9}},
99 {"function": "DAY", "expr": "DAY(DATE(2026,9,3))", "want": {"kind": "num", "num": 3}},
100 {"function": "MONTH", "expr": "MONTH(DATE(2026,13,1))", "want": {"kind": "num", "num": 1}},
101 {"function": "YEAR", "expr": "YEAR(DATE(2026,13,1))", "want": {"kind": "num", "num": 2027}},
102 {"function": "DAY", "expr": "DAY(DATE(2026,3,0))", "want": {"kind": "num", "num": 28}},
103 {"function": "MONTH", "expr": "MONTH(EOMONTH(DATE(2026,1,31),1))", "want": {"kind": "num", "num": 2}},
104 {"function": "DAY", "expr": "DAY(EOMONTH(DATE(2026,1,31),1))", "want": {"kind": "num", "num": 28}},
105 {"function": "DAY", "expr": "DAY(EOMONTH(DATE(2024,1,15),1))", "want": {"kind": "num", "num": 29}},
106 {"function": "YEAR", "expr": "YEAR(EOMONTH(DATE(2026,12,1),1))", "want": {"kind": "num", "num": 2027}},
107 {"function": "VALUE", "expr": "VALUE(\"42\")", "want": {"kind": "num", "num": 42}},
108 {"function": "VALUE", "expr": "VALUE(\"3.5\")", "want": {"kind": "num", "num": 3.5}},
109 {"function": "VALUE", "expr": "VALUE(\"50%\")", "want": {"kind": "num", "num": 0.5}},
110 {"function": "SUBSTITUTE", "expr": "SUBSTITUTE(\"a-b-c\",\"-\",\"+\")", "want": {"kind": "str", "str": "a+b+c"}},
111 {"function": "SUBSTITUTE", "expr": "SUBSTITUTE(\"a-b-c\",\"-\",\"+\",2)", "want": {"kind": "str", "str": "a-b+c"}},
112 {"function": "SUBSTITUTE", "expr": "SUBSTITUTE(\"aaa\",\"a\",\"b\",3)", "want": {"kind": "str", "str": "aab"}},
113 {"function": "FIND", "expr": "FIND(\"n\",\"ten\")", "want": {"kind": "num", "num": 3}},
114 {"function": "FIND", "expr": "FIND(\"e\",\"seventeen\",4)", "want": {"kind": "num", "num": 4}},
115 {"function": "SEARCH", "expr": "SEARCH(\"T\",\"ten\")", "want": {"kind": "num", "num": 1}},
116 {"function": "SEARCH", "expr": "SEARCH(\"e?e\",\"seventeen\")", "want": {"kind": "num", "num": 2}},
117 {"function": "LEN", "expr": "LEN(SUBSTITUTE(\"a-b-c\",\"-\",\"\"))", "want": {"kind": "num", "num": 3}}
118 ]
119}
120