Skip to content

Commit

Permalink
Move to test bundle Shape equality
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriyvan committed Dec 15, 2023
1 parent 4a4f116 commit bf070d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
7 changes: 0 additions & 7 deletions Sources/geometrize/Shapes/Shape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,3 @@ extension Shape {
}

}

func == (lhs: any Shape, rhs: any Shape) -> Bool {
switch (lhs, rhs) {
case (let lhs as Rectangle, let rhs as Rectangle): return lhs == rhs
default: return false
}
}
8 changes: 0 additions & 8 deletions Sources/geometrize/State.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,3 @@ struct State {
}

}

extension State: Equatable {

static func == (lhs: State, rhs: State) -> Bool {
lhs.score == rhs.score && lhs.alpha == rhs.alpha && lhs.shape == rhs.shape
}

}
13 changes: 13 additions & 0 deletions Tests/geometrizeTests/CoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,16 @@ final class CoreTests: XCTestCase {
}

}

func == (lhs: any Shape, rhs: any Shape) -> Bool {
switch (lhs, rhs) {
case (let lhs as Circle, let rhs as Circle): return lhs == rhs
case (let lhs as Ellipse, let rhs as Ellipse): return lhs == rhs
case (let lhs as Line, let rhs as Line): return lhs == rhs
case (let lhs as Polyline, let rhs as Polyline): return lhs == rhs
case (let lhs as QuadraticBezier, let rhs as QuadraticBezier): return lhs == rhs
case (let lhs as Rectangle, let rhs as Rectangle): return lhs == rhs
case (let lhs as RotatedRectangle, let rhs as RotatedRectangle): return lhs == rhs
default: return false
}
}

0 comments on commit bf070d4

Please sign in to comment.