Skip to content

Commit

Permalink
Add set tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentspitale committed Dec 8, 2021
1 parent b68b2df commit 9d5059e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion BezierKit/BezierKitTests/PathComponentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class PathComponentTests: XCTestCase {
}

func testHashing() {
// two paths that are equal
// two PathComponents that are equal
let l1 = LineSegment(p0: p1, p1: p2)
let q1 = QuadraticCurve(p0: p2, p1: p3, p2: p4)
let l2 = LineSegment(p0: p4, p1: p5)
Expand All @@ -122,6 +122,10 @@ class PathComponentTests: XCTestCase {
let pathComponent2 = PathComponent(curves: [l1, q1, l2, c1])

XCTAssert(pathComponent1.hash == pathComponent2.hash)

// PathComponent that is equal should be located in a set
let set = Set([pathComponent1])
XCTAssert(set.contains(pathComponent2))
}

func testIndexedPathComponentLocation() {
Expand Down
5 changes: 5 additions & 0 deletions BezierKit/BezierKitTests/PathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ class PathTests: XCTestCase {
let path2 = Path(cgPath: CGPath(rect: rect, transform: nil))

XCTAssert(path1.hash == path2.hash)

// path that is equal should be located in a set
let path3 = path1.copy(using: CGAffineTransform.identity)
let set = Set([path1])
XCTAssert(set.contains(path3))
}

func testEncodeDecode() {
Expand Down

0 comments on commit 9d5059e

Please sign in to comment.