package lookup import "testing" // asiaticRussia stands in for cty.dat: one representative zone pair for a // country eight CQ zones wide. func asiaticRussia(cqz, ituz int) fakeDXCC { return fakeDXCC{"RU0LL": {num: 15, country: "Asiatic Russia", cont: "AS", cqz: cqz, ituz: ituz}} } // A zone is where the station SITS; an entity is what the callsign IS. Asiatic // Russia spans CQ 16-23 and ITU 20-34, and cty.dat carries one representative // pair for the whole country — so stamping it over a callbook's per-station // answer records a WAZ credit for a zone the operator never worked. // // Reported with real callsigns: RU0LL is CQ 19 / ITU 34 and was logged 17/30. func TestCallbookZonesSurviveTheEntityDefault(t *testing.T) { // What QRZ said about this very station. r := Result{Callsign: "RU0LL", CQZ: 19, ITUZ: 34} fillFromDXCC(&r, asiaticRussia(17, 30)) if r.CQZ != 19 || r.ITUZ != 34 { t.Errorf("callbook zones were overwritten: CQ%d ITU%d, want CQ19 ITU34", r.CQZ, r.ITUZ) } if r.Country != "Asiatic Russia" { t.Errorf("the ENTITY must still come from cty.dat, got %q", r.Country) } } func TestEntityZonesFillSilence(t *testing.T) { // A callbook that says nothing about zones still gets an answer. r := Result{Callsign: "RU0LL"} fillFromDXCC(&r, asiaticRussia(17, 30)) if r.CQZ != 17 || r.ITUZ != 30 { t.Errorf("empty zones were not filled: CQ%d ITU%d", r.CQZ, r.ITUZ) } }