(t *testing.T)
| 419 | } |
| 420 | |
| 421 | func TestCapAddCap(t *testing.T) { |
| 422 | tests := []struct { |
| 423 | have Cap |
| 424 | other Cap |
| 425 | want Cap |
| 426 | }{ |
| 427 | // Identity cases. |
| 428 | {emptyCap, emptyCap, emptyCap}, |
| 429 | {fullCap, fullCap, fullCap}, |
| 430 | |
| 431 | // Anything plus empty equals itself. |
| 432 | {fullCap, emptyCap, fullCap}, |
| 433 | {emptyCap, fullCap, fullCap}, |
| 434 | {xAxis, emptyCap, xAxis}, |
| 435 | {emptyCap, xAxis, xAxis}, |
| 436 | {yAxis, emptyCap, yAxis}, |
| 437 | {emptyCap, yAxis, yAxis}, |
| 438 | |
| 439 | // Two halves make a whole. |
| 440 | {xAxis, xComp, fullCap}, |
| 441 | |
| 442 | // Two zero-height orthogonal axis caps make a half-cap. |
| 443 | {xAxis, yAxis, CapFromCenterAngle(xAxisPt, s1.Angle(math.Pi/2.0))}, |
| 444 | } |
| 445 | |
| 446 | for _, test := range tests { |
| 447 | got := test.have.AddCap(test.other) |
| 448 | if !got.ApproxEqual(test.want) { |
| 449 | t.Errorf("%v.AddCap(%v) = %v, want %v", test.have, test.other, got, test.want) |
| 450 | } |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | func TestCapContainsCell(t *testing.T) { |
| 455 | faceRadius := math.Atan(math.Sqrt2) |
nothing calls this directly
no test coverage detected
searching dependent graphs…