chore: release v0.27.12
This commit is contained in:
@@ -332,3 +332,31 @@ func TestModeMapping(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A mode the rig is already in must not reach it. WSJT-X restates the mode on
|
||||
// every band change, and on a native backend each restatement is several CI-V
|
||||
// round trips with the client blocked on the answer.
|
||||
func TestSetModeSkipsWhenUnchanged(t *testing.T) {
|
||||
cases := []struct {
|
||||
rig string // what the rig reports (ADIF)
|
||||
ask string // what the client asks for (hamlib)
|
||||
want int // times the radio should be touched
|
||||
}{
|
||||
{"CW", "CW", 0},
|
||||
{"SSB", "USB", 0}, // "SSB" is reported as USB to a client
|
||||
{"FT8", "PKTUSB", 0}, // data rides on USB; both name it PKTUSB
|
||||
{"USB", "PKTUSB", 1}, // out of data mode into it: a real change
|
||||
{"CW", "USB", 1}, // a real change
|
||||
{"", "USB", 1}, // mode unknown: never assume
|
||||
}
|
||||
for _, c := range cases {
|
||||
f := &fakeRig{mode: c.rig, freq: 14074000}
|
||||
s := New(4532, f, nil)
|
||||
if got, _ := s.handle("M " + c.ask); got != "RPRT 0\n" {
|
||||
t.Fatalf("set_mode %q on a rig in %q = %q", c.ask, c.rig, got)
|
||||
}
|
||||
if n := len(f.setModes); n != c.want {
|
||||
t.Errorf("rig in %q, client asked %q: rig touched %d times, want %d", c.rig, c.ask, n, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user