MCPcopy Index your code
hub / github.com/golang/geo / TestLoopNormalizedCompatibleWithContains

Function TestLoopNormalizedCompatibleWithContains

s2/loop_test.go:1751–1779  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1749}
1750
1751func TestLoopNormalizedCompatibleWithContains(t *testing.T) {
1752 p := parsePoint("40:40")
1753
1754 tests := []*Loop{
1755 lineTriangle,
1756 skinnyChevron,
1757 }
1758
1759 // Checks that if a loop is normalized, it doesn't contain a
1760 // point outside of it, and vice versa.
1761 for _, loop := range tests {
1762 flip := cloneLoop(loop)
1763
1764 flip.Invert()
1765 if norm, contains := loop.IsNormalized(), loop.ContainsPoint(p); norm == contains {
1766 t.Errorf("loop.IsNormalized() = %t == loop.ContainsPoint(%v) = %v, want !=", norm, p, contains)
1767 }
1768 if norm, contains := flip.IsNormalized(), flip.ContainsPoint(p); norm == contains {
1769 t.Errorf("flip.IsNormalized() = %t == flip.ContainsPoint(%v) = %v, want !=", norm, p, contains)
1770 }
1771 if a, b := loop.IsNormalized(), flip.IsNormalized(); a == b {
1772 t.Errorf("a loop and it's invert can not both be normalized")
1773 }
1774 flip.Normalize()
1775 if flip.ContainsPoint(p) {
1776 t.Errorf("%v.ContainsPoint(%v) = true, want false", flip, p)
1777 }
1778 }
1779}
1780
1781func TestLoopValidateDetectsInvalidLoops(t *testing.T) {
1782 tests := []struct {

Callers

nothing calls this directly

Calls 6

parsePointFunction · 0.85
cloneLoopFunction · 0.85
ContainsPointMethod · 0.65
InvertMethod · 0.45
IsNormalizedMethod · 0.45
NormalizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…