package main

import "testing"

// Which class of power a mode falls into.
//
// This decides how much power leaves the amplifier, so an error here is not a
// display bug: a digital mode sorted as phone gets the SSB setting, which is
// exactly the 1.5 kW into a 100% duty cycle this feature exists to prevent.
func TestFlexPowerClass(t *testing.T) {
	for _, c := range []struct{ mode, want string }{
		{"SSB", "phone"}, {"USB", "phone"}, {"LSB", "phone"}, {"AM", "phone"}, {"FM", "phone"},
		{"CW", "cw"}, {"cw", "cw"}, {" CW ", "cw"},
		{"FT8", "digi"}, {"FT4", "digi"}, {"RTTY", "digi"}, {"PSK31", "digi"},
		{"JS8", "digi"}, {"Q65", "digi"}, {"MSK144", "digi"}, {"DATA", "digi"},
		{"DIGU", "digi"}, {"DIGL", "digi"}, {"WSPR", "digi"},
		// Unknown or empty: no class, and the caller changes nothing. Setting a
		// transmit power from a name we do not recognise is not a good guess.
		{"", ""}, {"SSTV", ""}, {"BANANA", ""},
	} {
		if got := flexPowerClass(c.mode); got != c.want {
			t.Errorf("flexPowerClass(%q) = %q, want %q", c.mode, got, c.want)
		}
	}
}
