package lookup

import "testing"

// A grid came back empty for M0BFS/QRP while the same lookup without the suffix
// answered perfectly. The home-call pass wiped the location on the grounds that
// a portable operator is not at their registered address — true for /P and /M,
// and simply wrong for /QRP, which is a statement about power.
func TestSaysNothingAboutLocation(t *testing.T) {
	keep := []string{"M0BFS/QRP", "f4bpo/qrp", "G0ABC/QRP"}
	for _, c := range keep {
		if !saysNothingAboutLocation(c) {
			t.Errorf("%s: the home location should be kept — /QRP does not move anyone", c)
		}
	}
	// These DO move the operator, or change the entity outright.
	drop := []string{"F4BPO/P", "F4BPO/M", "F4BPO/MM", "F4BPO/AM", "JW/OR1A", "VP8/F4BPO", "F4BPO/8", "F4BPO"}
	for _, c := range drop {
		if saysNothingAboutLocation(c) {
			t.Errorf("%s: the home location must NOT be trusted", c)
		}
	}
	// A power suffix on top of a portable one still moves them.
	if saysNothingAboutLocation("F4BPO/P/QRP") {
		t.Error("F4BPO/P/QRP is portable — location must not be kept")
	}
}
