Files
meshcore-analyzer/cmd/server
efiten 58c937c462 test(planner): trim the 30 km viewshed equivalence cases (#2431)
Refs #2424. Second step after #2426: `TestViewshedMatchesReference` is
the slowest test in the server package.

## What changes

Only `cmd/server/planner_viewshed_test.go`.

1. **30 km equivalence cases.** Of the three 30 km terrains (fake, flat,
ridge) only the ridge case stays. Up to 30 km the cell size is the 0.2
km floor (`viewshedCellKm` = `max(0.2, r/150)`,
`planner_viewshed.go:50`), so the 30 km cases add a bigger grid and
longer rays (more samples per profile, `planProfileSamples`), not a
different cell size. The ridge case keeps one full-size grid in the
regular suite, with level ground west of the ridge and shadow east of
it.
2. **Missing-tile case.** The old case could not reach its missing tile.
The tile `{31,-98}` starts at lat 31; the 30 km bbox around lat 30.5,
expanded by 1 km, ends near lat 30.78. So it was a second copy of the 30
km fake case. It now uses a site at lat 30.95 (0.05 degrees, about 5.6
km, south of the tile edge) with a 12 km range.
3. **New guard `TestViewshedMissingTileCaseReachesTheTile`.** It checks
that the case touches the missing tile (`MissingTiles()` = 1 of at least
2), that every in-range cell north of the edge is NoData, and that cells
south of it have data. With the old site (lat 30.5) it fails:
`MissingTiles() = 0 of 1, want 1 of at least 2`.

## Measured

Native, Windows, Go 1.26.1, `go test -count=1 -run
'^TestViewshedMatchesReference$' -v .` with a temporary timer per case:

| case | before | after |
|---|---|---|
| fake/30km | 3.49 s | removed |
| flat/30km | 3.07 s | removed |
| ridge/30km | 2.78 s | kept |
| missing-tile | 4.05 s (30 km) | 12 km |
| whole test | 17.0 s | 6.2 s |

Before this change the test was 16.1 of 101 s for the whole server
package in a local `-json` run (16%). `go test -count=1 -run
'TestViewshed|TestPlanner|TestClearance|TestCoverage' .` passes; `gofmt`
and `go vet` are clean.

## Not done

- Not measured under `-race` and coverage, the way CI runs it. The CI
time comes from the hosted run of this PR.
- No equivalence case above 30 km, where the cell grows past 0.2 km. The
old suite had none either; `TestViewshedCellKm` covers the formula and
`BenchmarkViewshedWorkCount` the 60 km counts.
- The CI job split (running `-race` in shards next to the coverage run)
is a separate PR.
2026-11-18 23:06:06 +01:00
..