(t *testing.T)
| 2420 | } |
| 2421 | |
| 2422 | func TestBestByLocation(t *testing.T) { |
| 2423 | res := &SearchResult{ |
| 2424 | LocationArea: &camtypes.LocationBounds{ |
| 2425 | North: 90, |
| 2426 | South: -90, |
| 2427 | East: 180, |
| 2428 | West: -180, |
| 2429 | }, |
| 2430 | } |
| 2431 | locm := map[blob.Ref]camtypes.Location{} |
| 2432 | |
| 2433 | const numResults = 5000 |
| 2434 | const limit = 117 |
| 2435 | const scale = 1000 |
| 2436 | for i := 0; i < numResults; i++ { |
| 2437 | br := blob.RefFromString(fmt.Sprintf("foo %d", i)) |
| 2438 | res.Blobs = append(res.Blobs, &SearchResultBlob{Blob: br}) |
| 2439 | locm[br] = camtypes.Location{ |
| 2440 | Latitude: float64(rand.Intn(360*scale) - 180*scale), |
| 2441 | Longitude: float64(rand.Intn(180*scale) - 90*scale), |
| 2442 | } |
| 2443 | } |
| 2444 | |
| 2445 | ExportBestByLocation(res, locm, limit) |
| 2446 | if got := len(res.Blobs); got != limit { |
| 2447 | t.Errorf("got %d blobs; want %d", got, limit) |
| 2448 | } |
| 2449 | } |
nothing calls this directly
no test coverage detected