diff --git a/bugs_test.go b/bugs_test.go index 1d1f727..0785b48 100644 --- a/bugs_test.go +++ b/bugs_test.go @@ -71,3 +71,18 @@ func TestBug3(t *T) { t.Errorf("expected %s, got %s", exp, result) } } + +// somewhat simplified variant, for easier debugging +func TestBug3b(t *T) { + subject := polyclip.Polygon{{{1, 2}, {2, 2}, {2, 1}}} + clipping := polyclip.Polygon{ + {{2, 1}, {2, 2}, {3, 2}}, + {{1, 2}, {2, 3}, {2, 2}}, + {{2, 2}, {2, 3}, {3, 2}}} + result := dump(subject.Construct(polyclip.UNION, clipping)) + + exp := dump(polyclip.Polygon{{{1, 2}, {2, 3}, {3, 2}, {2, 1}}}) + if result != exp { + t.Errorf("expected %s, got %s", exp, result) + } +}