         )
     }
 
+    func testIntersectingSelf() {
+        let square = createSquare1()
+        XCTAssertEqual(square.intersect(square), square)
+        XCTAssertEqual(square.intersect(square.independentCopy()), square)
+    }
+
+    func testSubtractingSelf() {
+        let square = createSquare1()
+        let expectedResult = Path()
+        XCTAssertEqual(square.subtract(square), expectedResult)
+        XCTAssertEqual(square.subtract(square.independentCopy()), expectedResult)
+    }
+
     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

        )
    }

    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))

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 {

