package extsvc import "testing" // Club Log matches a deletion on callsign, exact time and BAND NUMBER. A band // that maps to the wrong number does not fail — it points the delete at a // different QSO, or at nothing, silently. So the table is pinned. func TestClublogBandID(t *testing.T) { for _, c := range []struct { band string want int }{ {"160m", 160}, {"80m", 80}, {"60m", 60}, {"40m", 40}, {"30m", 30}, {"20m", 20}, {"17m", 17}, {"15m", 15}, {"12m", 12}, {"10m", 10}, {"6m", 6}, {"4m", 4}, {"2m", 2}, {"70cm", 70}, {"23cm", 23}, {"13cm", 13}, {"20M", 20}, {" 20m ", 20}, // ADIF case and stray spaces } { got, ok := clublogBandID(c.band) if !ok || got != c.want { t.Errorf("clublogBandID(%q) = %d,%v — want %d", c.band, got, ok, c.want) } } // Bands Club Log does not accept must be REFUSED, never approximated to a // neighbour: 6 cm silently becoming 13 cm would delete somebody else's QSO. for _, bad := range []string{"", "6cm", "3cm", "2200m", "630m", "9cm", "banana"} { if id, ok := clublogBandID(bad); ok { t.Errorf("clublogBandID(%q) accepted as %d — it is not a Club Log band", bad, id) } } }