The importer has always read an absent BAND_RX/FREQ_RX as 'not split, so RX = TX'. The logging paths never did, so what a contact carried depended on which door it came in through — and it shows outside OpsLog: the record forwarded over UDP is written from the QSO as logged, so a receiver that reads BAND_RX (Log4OM does) found nothing there. Filled at AddQSO, the one funnel every path goes through, so the database, the export and the forwarded copy agree. A genuine split contact keeps what it was given — table-tested both ways.
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"hamlog/internal/adif"
|
|
"hamlog/internal/qso"
|
|
)
|
|
|
|
// A contact that was not split still has a receive side, and the record
|
|
// forwarded to another logger has to carry it: Log4OM reads BAND_RX.
|
|
func TestFillRXDefaults(t *testing.T) {
|
|
hz := int64(14074000)
|
|
q := qso.QSO{Callsign: "F4BPO", Band: "20m", FreqHz: &hz}
|
|
fillRXDefaults(&q)
|
|
if q.BandRX != "20m" {
|
|
t.Errorf("BandRX = %q, want 20m", q.BandRX)
|
|
}
|
|
if q.FreqRXHz == nil || *q.FreqRXHz != hz {
|
|
t.Errorf("FreqRXHz = %v, want %d", q.FreqRXHz, hz)
|
|
}
|
|
rec := adif.SingleRecordADIF(q)
|
|
if !strings.Contains(strings.ToUpper(rec), "<BAND_RX:3>20M") {
|
|
t.Errorf("BAND_RX missing from the forwarded record:\n%s", rec)
|
|
}
|
|
}
|
|
|
|
// A genuine split contact keeps what it was given.
|
|
func TestFillRXDefaultsKeepsSplit(t *testing.T) {
|
|
tx, rx := int64(14195000), int64(14205000)
|
|
q := qso.QSO{Callsign: "F4BPO", Band: "20m", BandRX: "17m", FreqHz: &tx, FreqRXHz: &rx}
|
|
fillRXDefaults(&q)
|
|
if q.BandRX != "17m" || q.FreqRXHz == nil || *q.FreqRXHz != rx {
|
|
t.Errorf("split QSO was overwritten: band_rx=%q freq_rx=%v", q.BandRX, q.FreqRXHz)
|
|
}
|
|
}
|