package main import ( "testing" "hamlog/internal/autocall" ) // The entity's verdict is not the station's. // // From the air: on 10 m, where most countries are already in the log, the // engine refused twenty decodes out of twenty-one as "worked" — a watched // DXpedition calling CQ among them — because the ENTITY's status was read as // the station's. func TestCandidateWorkedIsTheCallsignNotTheEntity(t *testing.T) { d := autocall.Decode{Call: "J38DX", Band: "10m", Mode: "FT8", IsNew: true} // Grenada worked on 10 m FT8, this callsign never worked: nothing is needed // from it, and calling it is NOT a duplicate. c := candidateOf(d, SpotStatus{Status: "worked", WorkedSlot: false}) if c.Worked { t.Error("a station never worked was refused because its entity was") } if c.Need != autocall.NeedNone { t.Errorf("need = %v on a worked entity, want none", c.Need) } // The same callsign already in the log on this band and mode IS a duplicate. if c := candidateOf(d, SpotStatus{Status: "worked", WorkedSlot: true}); !c.Worked { t.Error("a callsign already worked on this band and mode was not flagged") } // And a real need still carries through, with the unconfirmed distinction. c = candidateOf(d, SpotStatus{Status: "new-band", UnconfStatus: true}) if c.Need != autocall.NeedBand || !c.Unconfirmed { t.Errorf("new-band unconfirmed came through as %v (unconf=%v)", c.Need, c.Unconfirmed) } }