add CHANGELOG and withinnmof test

This commit is contained in:
2026-06-26 23:03:49 -04:00
parent 26d7a2c0b7
commit 4e683e31bd
2 changed files with 40 additions and 2 deletions
+18
View File
@@ -113,6 +113,24 @@ func TestWithinNMOf(t *testing.T) {
}
}
func TestAnyOR(t *testing.T) {
// Two non-overlapping 5 nm circles; Any should keep aircraft in either.
r := &AircraftReport{Aircraft: []Aircraft{
{Hex: "nearA", Lat: 40.01, Lon: -75.0},
{Hex: "nearB", Lat: 41.0, Lon: -76.01},
{Hex: "between", Lat: 40.5, Lon: -75.5},
{Hex: "nopos"},
}}
near := r.Filter(Any(WithinNMOf(40, -75, 5), WithinNMOf(41, -76, 5)))
got := map[string]bool{}
for _, a := range near {
got[a.Hex] = true
}
if !got["nearA"] || !got["nearB"] || got["between"] || got["nopos"] || len(got) != 2 {
t.Errorf("Any(WithinNMOf...) OR mismatch, matched: %v", got)
}
}
func TestAltBaroGround(t *testing.T) {
var a AltBaro
if err := json.Unmarshal([]byte(`"ground"`), &a); err != nil {