feat: added command sent in cluster panel
This commit is contained in:
@@ -63,3 +63,57 @@ func TestParseSpotRejectsNoise(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The reply to SH/DX is a TABLE, not the "DX de …" broadcast — a completely
|
||||
// different shape. Because only the broadcast form was parsed, a SH/DX/100 reply
|
||||
// arrived, matched nothing and was dropped: the command looked like it did
|
||||
// nothing at all. These lines must now land in the grid, flagged Historical.
|
||||
func TestParseShowDX(t *testing.T) {
|
||||
cases := []struct {
|
||||
line string
|
||||
call string
|
||||
khz float64
|
||||
spotter string
|
||||
}{
|
||||
{" 14195.0 EA8DHH 3-Jul-2026 1234Z CQ DX <F5ABC>", "EA8DHH", 14195.0, "F5ABC"},
|
||||
{" 7005.5 RA3XYZ 14-Jul-2026 0912Z <DL1ABC>", "RA3XYZ", 7005.5, "DL1ABC"},
|
||||
{"21025.0 VK9/DL2XYZ 1-Jan-2026 0001Z up 2 <JA1ABC>", "VK9/DL2XYZ", 21025.0, "JA1ABC"},
|
||||
// No spotter brackets — still a spot, just without a DE.
|
||||
{" 50313.0 IK0ABC 3-Jul-2026 1500Z FT8", "IK0ABC", 50313.0, ""},
|
||||
}
|
||||
for _, c := range cases {
|
||||
got, ok := parseShowDX(c.line)
|
||||
if !ok {
|
||||
t.Errorf("parseShowDX(%q) failed — the SH/DX reply would be dropped again", c.line)
|
||||
continue
|
||||
}
|
||||
if got.DXCall != c.call || got.FreqKHz != c.khz || got.Spotter != c.spotter {
|
||||
t.Errorf("parseShowDX(%q) = call %q / %.1f / de %q, want %q / %.1f / %q",
|
||||
c.line, got.DXCall, got.FreqKHz, got.Spotter, c.call, c.khz, c.spotter)
|
||||
}
|
||||
if !got.Historical {
|
||||
t.Errorf("parseShowDX(%q): must be flagged Historical — otherwise 100 replayed spots fire 100 alerts", c.line)
|
||||
}
|
||||
if got.Band == "" {
|
||||
t.Errorf("parseShowDX(%q): band not derived from %.1f kHz", c.line, c.khz)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The SH/DX parser must not swallow ordinary cluster prose — a console full of
|
||||
// chatter turned into fake spots would be worse than no parser at all.
|
||||
func TestParseShowDXRejectsNoise(t *testing.T) {
|
||||
noise := []string{
|
||||
"DX de F5ABC: 14195.0 EA8DHH CQ DX 1234Z", // the broadcast form: spotRE owns it
|
||||
"Hello and welcome to the DXSpider cluster",
|
||||
"WWV de VE7CC <18Z> : SFI=110, A=16, K=2",
|
||||
"F4BPO de GB7DXC 12-Jul-2026 2130Z dxspider >",
|
||||
"",
|
||||
"There are 42 users online",
|
||||
}
|
||||
for _, l := range noise {
|
||||
if s, ok := parseShowDX(l); ok {
|
||||
t.Errorf("parseShowDX(%q) wrongly produced a spot: %+v", l, s)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user