(t *testing.T)
| 1749 | } |
| 1750 | |
| 1751 | func 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 | |
| 1781 | func TestLoopValidateDetectsInvalidLoops(t *testing.T) { |
| 1782 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…