package main import ( "testing" "hamlog/internal/cat" ) // Three band tables exist in Go — cat.BandFromHz (the rig/CAT one), bandForHz // (awards) and the cluster's own — plus one in App.tsx. They must agree, and // nothing checked it: the CAT one stopped at 23 cm, so a 10 GHz QSO came back // with an EMPTY band. An empty band is not a cosmetic problem — it is not // logged, not counted in any award slot, and exports without a BAND field. // // One frequency per band, taken inside the range, plus the edges that used to be // missing entirely. func TestBandPlansAgree(t *testing.T) { cases := []struct { hz int64 want string }{ {137000, "2190m"}, {475000, "630m"}, {1840000, "160m"}, {3650000, "80m"}, {7100000, "40m"}, {10120000, "30m"}, {14200000, "20m"}, {18100000, "17m"}, {21200000, "15m"}, {24940000, "12m"}, {28400000, "10m"}, {50150000, "6m"}, {70200000, "4m"}, {144300000, "2m"}, {223500000, "1.25m"}, {432000000, "70cm"}, {1296000000, "23cm"}, // The microwave bands that were missing. 3 cm is the one an operator // reported: 10 GHz is worked and spotted, and resolved to nothing. {2320000000, "13cm"}, {3400000000, "9cm"}, {5760000000, "6cm"}, {10368000000, "3cm"}, {24048000000, "1.25cm"}, {47088000000, "6mm"}, {76032000000, "4mm"}, {122250000000, "2.5mm"}, {134928000000, "2mm"}, {241920000000, "1mm"}, } for _, c := range cases { if got := cat.BandFromHz(c.hz); got != c.want { t.Errorf("cat.BandFromHz(%d) = %q, want %q", c.hz, got, c.want) } if got := bandForHz(c.hz); got != c.want { t.Errorf("bandForHz(%d) = %q, want %q — the award band plan disagrees with the CAT one", c.hz, got, c.want) } } } // A frequency in no amateur band must resolve to "" everywhere, not to the // nearest band: guessing here would put a QSO in a band the operator never used. func TestBandPlanRejectsOutOfBand(t *testing.T) { for _, hz := range []int64{100_000_000, 1_000_000_000, 15_000_000_000} { if got := cat.BandFromHz(hz); got != "" { t.Errorf("cat.BandFromHz(%d) = %q, want empty", hz, got) } if got := bandForHz(hz); got != "" { t.Errorf("bandForHz(%d) = %q, want empty", hz, got) } } }