test(atu): lock IARU R1 reference table for computeCenters() (#2648)#2687
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
computeCenters(double lowMhz, double highMhz, int segmentKhz)is thepure-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
computeCentersout ofAtuPreTuneDialog.cpp's anonymousnamespace into a header-only free function (
AtuPreTuneCenters.h) sothe test can include it without dragging in the dialog.
AtuPreTuneDialog.cppkeeps using it via the new include — sameimplementation, same behavior, but now reachable from tests.
tests/atu_pretune_centers_test.cppexercises:point count).
low + seg/2) — guards the half-segmentoffset.
high - seg/2) — guards the "extra center ifroom 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.
sub-segment range (returns empty), exactly-one-segment range
(returns 1, no duplicate clamp).
Registered as
atu_pretune_centers_testin CMakeLists.txt next to theexisting
*_testexecutables; runs viactest -R atu_pretune. 20assertions; passes locally.
Closes #2648.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com