(t *testing.T)
| 393 | } |
| 394 | |
| 395 | func TestLoopContainsPoint(t *testing.T) { |
| 396 | north := Point{r3.Vector{X: 0, Y: 0, Z: 1}} |
| 397 | south := Point{r3.Vector{X: 0, Y: 0, Z: -1}} |
| 398 | east := PointFromCoords(0, 1, 0) |
| 399 | west := PointFromCoords(0, -1, 0) |
| 400 | |
| 401 | if EmptyLoop().ContainsPoint(north) { |
| 402 | t.Errorf("empty loop should not have any points") |
| 403 | } |
| 404 | if !FullLoop().ContainsPoint(south) { |
| 405 | t.Errorf("full loop should have full point vertex") |
| 406 | } |
| 407 | |
| 408 | for _, tc := range []struct { |
| 409 | name string |
| 410 | l *Loop |
| 411 | in Point |
| 412 | out Point |
| 413 | }{ |
| 414 | { |
| 415 | "north hemisphere", |
| 416 | northHemi, |
| 417 | north, |
| 418 | south, |
| 419 | }, |
| 420 | { |
| 421 | "south hemisphere", |
| 422 | southHemi, |
| 423 | south, |
| 424 | north, |
| 425 | }, |
| 426 | { |
| 427 | "west hemisphere", |
| 428 | westHemi, |
| 429 | west, |
| 430 | east, |
| 431 | }, |
| 432 | { |
| 433 | "east hemisphere", |
| 434 | eastHemi, |
| 435 | east, |
| 436 | west, |
| 437 | }, |
| 438 | { |
| 439 | "candy cane", |
| 440 | candyCane, |
| 441 | PointFromLatLng(LatLngFromDegrees(5, 71)), |
| 442 | PointFromLatLng(LatLngFromDegrees(-8, 71)), |
| 443 | }, |
| 444 | } { |
| 445 | l := tc.l |
| 446 | for i := range 4 { |
| 447 | if !l.ContainsPoint(tc.in) { |
| 448 | t.Errorf("%s loop should contain %v at rotation %d", tc.name, tc.in, i) |
| 449 | } |
| 450 | if l.ContainsPoint(tc.out) { |
| 451 | t.Errorf("%s loop shouldn't contain %v at rotation %d", tc.name, tc.out, i) |
| 452 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…