         )
     }
 
+    func testUnionSelf() {
+        let square = createSquare1()
+        let copy = square.independentCopy()
+        XCTAssertEqual(square.union(square), square)
+        XCTAssertEqual(square.union(copy), square)
+    }
+
     func testUnionCoincidentEdges1() {
         // a simple test of union'ing two squares where the max/min x edge are coincident
         let square1 = Path(cgPath: CGPath(rect: CGRect(x: 0, y: 0, width: 1, height: 1), transform: nil))

        )
    }

    func testSubtractingWindingDirection() {
        // this is a specific test of `subtracting` to ensure that when a component creates a "hole"
        // the order of the hole is reversed so that it is not contained in the shape when using .winding fill rule

import XCTest
import CoreGraphics
@testable import BezierKit

private extension Path {
    /// copies the path in such a way that it's impossible that optimizations would allow the copy to share the same underlying storage
    func independentCopy() -> Path {
        return self.copy(using: CGAffineTransform(translationX: 1, y: 0)).copy(using: CGAffineTransform(translationX: -1, y: 0))
    }
}

class PathTests: XCTestCase {

