This commit is contained in:
2026-06-07 01:11:37 +02:00
parent 17f7a00bd7
commit 16c04fc12b
13 changed files with 418 additions and 52 deletions
+18
View File
@@ -128,6 +128,24 @@ func TestComputeMatchByDescription(t *testing.T) {
}
}
// VUCC: a grid4 award counts distinct 4-char grid squares, and a QSO on a grid
// line (VUCC_GRIDS) contributes several. grid4 derives from VUCC_GRIDS else the
// 4-char prefix of GRIDSQUARE.
func TestComputeGrid4VUCC(t *testing.T) {
def := Def{Code: "VUCC", Type: TypeGrid, Field: "grid4", Dynamic: true,
Confirm: []string{"lotw", "qsl"}, Valid: true}
qsos := []qso.QSO{
{Callsign: "K1ABC", Band: "6m", Grid: "FN31PR", LOTWRcvd: "Y"}, // → FN31
{Callsign: "W2DEF", Band: "6m", VUCCGrids: "FN20,FN21,FN30,FN31"}, // grid-line: 4 squares
{Callsign: "W3GHI", Band: "2m", Grid: "FN20XX"}, // → FN20 (dup of above)
}
r := Compute([]Def{def}, qsos, nil, nil)[0]
// Distinct squares: FN31, FN20, FN21, FN30 = 4
if r.Worked != 4 {
t.Errorf("VUCC worked = %d, want 4 (%v)", r.Worked, refCodes(r))
}
}
func refCodes(r Result) []string {
out := make([]string, 0, len(r.Refs))
for _, rf := range r.Refs {