package udp import "testing" // A compound or non-standard callsign does not fit in a 77-bit FT8 message, so // it travels as a hash and is printed between angle brackets. Those decodes // used to be discarded whole — including the one message an operator is waiting // for, the reply that says a station answered them. func TestWsjtSenderHashedCallsign(t *testing.T) { for _, c := range []struct { msg, call string cq bool grid string }{ // The reply that went missing: the sender is the bracketed call. {"F4BPO -24", "ZA/IW2JOP", false, ""}, {"F4BPO R-14", "ZA/IW2JOP", false, ""}, // The other way round: we are the hashed one, the sender is plain. {" F4BPO R-14", "F4BPO", false, ""}, // A CQ from a hashed call, with and without a grid. {"CQ KM09", "ZA/IW2JOP", true, "KM09"}, {"CQ ", "ZA/IW2JOP", true, ""}, {"CQ DX KM09", "ZA/IW2JOP", true, "KM09"}, // The compound form: one station signs off with another while answering a // third. The sender is after the semicolon — reading from the left names // OK1UA, who did not send it. {"OK1UA RR73; DH1HRN -08", "ZA/IW2JOP", false, ""}, {"K1ABC RR73; W9XYZ -08", "KH1/KH7Z", false, ""}, // Unchanged: the ordinary forms. {"F4BPO W6YGO R-03", "W6YGO", false, ""}, {"CQ N2BJ EN61", "N2BJ", true, "EN61"}, // A hash the receiver could not resolve is NOT a callsign, and must not // become one. {"F4BPO <...> -24", "", false, ""}, } { call, cq, grid := wsjtSender(c.msg) if call != c.call || cq != c.cq || grid != c.grid { t.Errorf("wsjtSender(%q) = (%q, %v, %q), want (%q, %v, %q)", c.msg, call, cq, grid, c.call, c.cq, c.grid) } } }