add CHANGELOG and withinnmof test
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user