Skip to content

test(atu): lock IARU R1 reference table for computeCenters() (#2648)#2687

Merged
ten9876 merged 1 commit into
mainfrom
auto/fix2648-atu-centers-test
May 15, 2026
Merged

test(atu): lock IARU R1 reference table for computeCenters() (#2648)#2687
ten9876 merged 1 commit into
mainfrom
auto/fix2648-atu-centers-test

Conversation

@ten9876

@ten9876 ten9876 commented May 15, 2026

Copy link
Copy Markdown
Collaborator

computeCenters(double lowMhz, double highMhz, int segmentKhz) is the
pure-math kernel that drives the ATU pre-tune sweep — it generates the
evenly-spaced tune centers for each selected band. It had no test
coverage; the IARU R1 per-band point counts from issue #2624 (160m=23,
80m=34, 60m=2, 40m=8, 30m=2, 20m=7, 17m=2, 15m=6, 12m=2, 10m=23,
6m=20 — 129 total) were verified by hand at PR-review time and would
silently regress on a rounding/clamping change.

Lift computeCenters out of AtuPreTuneDialog.cpp's anonymous
namespace into a header-only free function (AtuPreTuneCenters.h) so
the test can include it without dragging in the dialog.
AtuPreTuneDialog.cpp keeps using it via the new include — same
implementation, same behavior, but now reachable from tests.

tests/atu_pretune_centers_test.cpp exercises:

  • All 11 IARU R1 reference points (band, range, segment, expected
    point count).
  • First-center spacing (low + seg/2) — guards the half-segment
    offset.
  • Last-segment clamp (high - seg/2) — guards the "extra center if
    room at the top" path that produces Add ATU Band Pre-Tune Sweep with IARU-Region Band Stepping and Memory Clear #2624's expected 60m count.
  • Edge cases: zero range, inverted range, segmentKhz ≤ 0,
    sub-segment range (returns empty), exactly-one-segment range
    (returns 1, no duplicate clamp).

Registered as atu_pretune_centers_test in CMakeLists.txt next to the
existing *_test executables; runs via ctest -R atu_pretune. 20
assertions; passes locally.

Closes #2648.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

`computeCenters(double lowMhz, double highMhz, int segmentKhz)` is the
pure-math kernel that drives the ATU pre-tune sweep — it generates the
evenly-spaced tune centers for each selected band.  It had no test
coverage; the IARU R1 per-band point counts from issue #2624 (160m=23,
80m=34, 60m=2, 40m=8, 30m=2, 20m=7, 17m=2, 15m=6, 12m=2, 10m=23,
6m=20 — 129 total) were verified by hand at PR-review time and would
silently regress on a rounding/clamping change.

Lift `computeCenters` out of `AtuPreTuneDialog.cpp`'s anonymous
namespace into a header-only free function (`AtuPreTuneCenters.h`) so
the test can include it without dragging in the dialog.
`AtuPreTuneDialog.cpp` keeps using it via the new include — same
implementation, same behavior, but now reachable from tests.

`tests/atu_pretune_centers_test.cpp` exercises:
  * All 11 IARU R1 reference points (band, range, segment, expected
    point count).
  * First-center spacing (`low + seg/2`) — guards the half-segment
    offset.
  * Last-segment clamp (`high - seg/2`) — guards the "extra center if
    room at the top" path that produces #2624's expected 60m count.
  * Edge cases: zero range, inverted range, segmentKhz ≤ 0,
    sub-segment range (returns empty), exactly-one-segment range
    (returns 1, no duplicate clamp).

Registered as `atu_pretune_centers_test` in CMakeLists.txt next to the
existing `*_test` executables; runs via `ctest -R atu_pretune`.  20
assertions; passes locally.

Closes #2648.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ten9876 ten9876 enabled auto-merge (squash) May 15, 2026 15:15
@ten9876 ten9876 merged commit 5650583 into main May 15, 2026
5 checks passed
@ten9876 ten9876 deleted the auto/fix2648-atu-centers-test branch May 15, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ATU Pre-Tune: unit test for computeCenters() against IARU R1 reference table

1 participant