MCPcopy
hub / github.com/golang/geo / TestCapAddCap

Function TestCapAddCap

s2/cap_test.go:421–452  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

419}
420
421func 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
454func TestCapContainsCell(t *testing.T) {
455 faceRadius := math.Atan(math.Sqrt2)

Callers

nothing calls this directly

Calls 4

AngleTypeAlias · 0.92
CapFromCenterAngleFunction · 0.85
AddCapMethod · 0.80
ApproxEqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…