package cat

import "testing"

// Reported on an FTDX101MP: the power slider sprang back to 100 W. The console
// already knew the rig could do 200 — yaesuMaxPower says so — but the SET path
// clamped to 100, so the radio was politely given half what was asked for.
func TestYaesuPowerCeilingFollowsTheModel(t *testing.T) {
	cases := []struct {
		model string
		want  int
	}{
		{"FTDX101MP", 200},
		{"FT-DX5000", 200},
		{"FTDX9000", 200},
		{"FTDX101D", 100},
		{"FTDX10", 100},
		{"Yaesu (0999)", 100}, // unknown: ask for too little, never too much
	}
	for _, c := range cases {
		if got := yaesuMaxPower(c.model, 0); got != c.want {
			t.Errorf("%s ceiling = %d W, want %d", c.model, got, c.want)
		}
	}
	// A rig REPORTING more than the table expects has just proved what it can do.
	if got := yaesuMaxPower("FTDX10", 150); got != 150 {
		t.Errorf("a rig reporting 150 W was capped at %d", got)
	}
}
