feat: While importing ADIF, update MY fields
This commit is contained in:
@@ -138,6 +138,50 @@ func TestDecodeFirstCharStrong(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeWithAmplitudeRipple(t *testing.T) {
|
||||
const fs = 16000
|
||||
// A real signal's tone amplitude wobbles within a mark; if the floor chases
|
||||
// it, dashes fragment into dots ("all dots" garbage). Apply ±30% ripple.
|
||||
samples := keyMessageAmp("CQ TEST DE OM", fs, 24, 800, 10000)
|
||||
rp := 0.0
|
||||
for i := range samples {
|
||||
rp += 2 * math.Pi * 35 / float64(fs) // 35 Hz amplitude wobble
|
||||
samples[i] = int16(float64(samples[i]) * (1 + 0.3*math.Sin(rp)))
|
||||
}
|
||||
var sb strings.Builder
|
||||
d := New(fs, func(s string) { sb.WriteString(s) }, nil)
|
||||
for i := 0; i < len(samples); i += 256 {
|
||||
end := i + 256
|
||||
if end > len(samples) {
|
||||
end = len(samples)
|
||||
}
|
||||
d.Process(samples[i:end])
|
||||
}
|
||||
got := strings.ToUpper(sb.String())
|
||||
if !strings.Contains(got, "TEST DE OM") {
|
||||
t.Fatalf("dashes fragmented under amplitude ripple: decoded %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeCQFixedPitch(t *testing.T) {
|
||||
const fs = 16000
|
||||
var sb strings.Builder
|
||||
d := New(fs, func(s string) { sb.WriteString(s) }, nil)
|
||||
d.SetTarget(700) // fixed pitch like the user's manual override
|
||||
samples := keyMessageAmp("CQ CQ CQ DE OM", fs, 26, 700, 9000)
|
||||
for i := 0; i < len(samples); i += 200 {
|
||||
end := i + 200
|
||||
if end > len(samples) {
|
||||
end = len(samples)
|
||||
}
|
||||
d.Process(samples[i:end])
|
||||
}
|
||||
got := strings.ToUpper(sb.String())
|
||||
if n := strings.Count(got, "CQ"); n < 2 {
|
||||
t.Fatalf("first element of CQ dropped: decoded %q (only %d CQ)", got, n)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeNumbersAndProsign(t *testing.T) {
|
||||
const fs = 16000
|
||||
var sb strings.Builder
|
||||
|
||||
Reference in New Issue
Block a user