oficina / sheets Public

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

Plain git — no account needed to clone.

Download

Download this file

1package calc
2
3import "testing"
4
5// A formula whose range exceeds maxRangeCells still evaluates (as a
6// single #REF! argument — see TestEvalCallArgOverCapRangeIsRefError), but
7// SetFormula must not build hundreds of thousands of precedent edges for
8// it: collectRefs leaves an over-cap range untracked rather than
9// expanding it.
10func TestCollectRefsLeavesOverCapRangeUntracked(t *testing.T) {
11 overCap := &Range{From: &Ref{RowPos: 0, ColPos: 0}, To: &Ref{RowPos: maxRangeCells, ColPos: 0}}
12 refs := collectRefs(overCap)
13 if len(refs) != 0 {
14 t.Fatalf("collectRefs on an over-cap range returned %d refs, want 0 (untracked, not partially expanded)", len(refs))
15 }
16}
17
18// A range at exactly the cap is still tracked in full.
19func TestCollectRefsTracksRangeAtCap(t *testing.T) {
20 atCap := &Range{From: &Ref{RowPos: 0, ColPos: 0}, To: &Ref{RowPos: maxRangeCells - 1, ColPos: 0}}
21 refs := collectRefs(atCap)
22 if len(refs) != maxRangeCells {
23 t.Fatalf("collectRefs on a range at the cap returned %d refs, want %d", len(refs), maxRangeCells)
24 }
25}
26