package uls import ( "os" "testing" ) func TestGrid6(t *testing.T) { cases := []struct { lat, lon float64 want string }{ {38.90, -77.03, "FM18lw"}, // Washington DC {40.71, -74.00, "FN30xr"}, // New York {34.05, -118.24, "DM04vd"}, // Los Angeles } for _, c := range cases { if got := grid6(c.lat, c.lon); got[:4] != c.want[:4] { t.Errorf("grid6(%v,%v)=%q want field/square %q", c.lat, c.lon, got, c.want[:4]) } } } // TestParseGeoNames runs against the real GeoNames US.zip if present in the // scratchpad (downloaded during development); skipped otherwise. func TestParseGeoNames(t *testing.T) { path := os.Getenv("GEONAMES_ZIP") if path == "" { t.Skip("set GEONAMES_ZIP to the US.zip path to run") } m, err := parseGeoNames(path) if err != nil { t.Fatal(err) } if len(m) < 30000 { t.Fatalf("expected >30k ZIPs, got %d", len(m)) } // A known ZIP: 20500 = The White House, DC. if r, ok := m["20500"]; !ok || r.state != "DC" { t.Errorf("ZIP 20500 = %+v (ok=%v)", r, ok) } } // The real listing captured from data.fcc.gov on 2026-07-25, the day after the // FCC renamed complete/ to complete.07242026/ and left an empty complete/ // behind — which broke the county-database download for every user. const fccListing2026 = `
| Name | Last modified | Size |
|---|---|---|
| Parent Directory | - | |
| UAT/ | 2025-04-08 19:30 | - |
| complete.07242026/ | 2026-07-24 20:15 | - |
| complete/ | 2026-07-25 21:15 | - |
| daily/ | 2026-07-25 21:15 | - |