fix: bug correction in awards where a reference regex was not checked
This commit is contained in:
@@ -128,6 +128,28 @@ func TestComputeMatchByDescription(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A description-match award must also honour a REFERENCE's own regex (used to
|
||||
// broaden matching past the plain name) AND match case-insensitively — a log
|
||||
// QTH "ITABASHIKU, TOKIO" (uppercase, "Tokio" spelling) must count for Tokyo
|
||||
// via its `\bTok[iy]o\b` pattern, which the plain name "Tokyo" can't catch.
|
||||
func TestComputeDescriptionRefPattern(t *testing.T) {
|
||||
def := Def{Code: "WAJA", Type: TypeQSOFields, Field: "qth", MatchBy: "description",
|
||||
DXCCFilter: []int{339}, Confirm: []string{"lotw", "qsl"}, Valid: true}
|
||||
qsos := []qso.QSO{
|
||||
{Callsign: "JA1LZB", Band: "10m", DXCC: ip(339), QTH: "ITABASHIKU, TOKIO"}, // pattern + case
|
||||
{Callsign: "JA3DEF", Band: "40m", DXCC: ip(339), QTH: "osaka pref"}, // lowercase name
|
||||
}
|
||||
refMetas := map[string][]RefMeta{"WAJA": {
|
||||
{Code: "13", Name: "Tokyo", Pattern: `\bTok[iy]o\b`, Valid: true},
|
||||
{Code: "27", Name: "Osaka", Valid: true},
|
||||
{Code: "01", Name: "Hokkaido", Valid: true},
|
||||
}}
|
||||
r := Compute([]Def{def}, qsos, refMetas, nil)[0]
|
||||
if r.Worked != 2 {
|
||||
t.Errorf("WAJA worked = %d, want 2 (Tokyo via pattern + Osaka via lowercase name); got %v", r.Worked, refCodes(r))
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user