feat: upload to external services clublog qrz
This commit is contained in:
@@ -54,6 +54,54 @@ func TestLookup(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// cty.dat marks non-DXCC entities (Sicily *IT9, African Italy *IG9) with a
|
||||
// leading '*'; the parser must fold those into their parent DXCC entity
|
||||
// "Italy" while leaving real DXCC entities — Sardinia (IS0), no '*' — alone.
|
||||
func TestCanonicalEntityNames(t *testing.T) {
|
||||
const cty = `Italy: 15: 28: EU: 42.82: -12.58: -1.0: I:
|
||||
I,IK,IZ;
|
||||
African Italy: 33: 37: AF: 35.67: -12.67: -1.0: *IG9:
|
||||
IG9,IH9;
|
||||
Sardinia: 15: 28: EU: 40.15: -9.27: -1.0: IS0:
|
||||
IM0,IS,IW0U,IW0V;
|
||||
Sicily: 15: 28: EU: 37.50: -14.00: -1.0: *IT9:
|
||||
IT9,IW9;
|
||||
`
|
||||
db, err := Load(strings.NewReader(cty))
|
||||
if err != nil {
|
||||
t.Fatalf("load: %v", err)
|
||||
}
|
||||
cases := map[string]string{
|
||||
"IW9EZO": "Italy", // Sicily (*IT9) → Italy
|
||||
"IT9CLY": "Italy",
|
||||
"IG9A": "Italy", // African Italy (*IG9) → Italy
|
||||
"IK0ABC": "Italy",
|
||||
"IS0XYZ": "Sardinia", // real DXCC entity — must stay Sardinia
|
||||
"IM0ABC": "Sardinia",
|
||||
}
|
||||
for call, want := range cases {
|
||||
m, ok := db.Lookup(call)
|
||||
if !ok {
|
||||
t.Errorf("%s: no match", call)
|
||||
continue
|
||||
}
|
||||
if m.Entity.Name != want {
|
||||
t.Errorf("%s: country = %q, want %q", call, m.Entity.Name, want)
|
||||
}
|
||||
}
|
||||
// African Italy keeps its own zones/continent even though it reports
|
||||
// Italy as the entity.
|
||||
if m, _ := db.Lookup("IG9A"); m.CQZone != 33 || m.Continent != "AF" {
|
||||
t.Errorf("IG9A: got CQ=%d cont=%s, want 33/AF", m.CQZone, m.Continent)
|
||||
}
|
||||
if EntityDXCC("Sicily") != 248 {
|
||||
t.Errorf("EntityDXCC(Sicily) = %d, want 248 (Italy)", EntityDXCC("Sicily"))
|
||||
}
|
||||
if EntityDXCC("Sardinia") != 225 {
|
||||
t.Errorf("EntityDXCC(Sardinia) = %d, want 225", EntityDXCC("Sardinia"))
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalize(t *testing.T) {
|
||||
cases := map[string]string{
|
||||
"F4BPO": "F4BPO",
|
||||
|
||||
Reference in New Issue
Block a user