Skip to content

Commit 91d21e6

Browse files
markuswntrstephentyrone
authored andcommitted
Rename transformEquals to equals(as3DTransform:)
1 parent ab8f2b7 commit 91d21e6

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

Sources/QuaternionModule/Quaternion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ extension Quaternion: Hashable {
421421
/// - Parameter other: The value to compare.
422422
/// - Returns: True if the transformation of this quaternion equals `other`.
423423
@_transparent
424-
public func transformEquals(_ other: Quaternion) -> Bool {
424+
public func equals(as3DTransform other: Quaternion) -> Bool {
425425
// Identify all numbers with either component non-finite as a single "point at infinity".
426426
guard isFinite || other.isFinite else { return true }
427427
// For finite numbers, equality is defined componentwise. Cases where only

Tests/QuaternionTests/PropertyTests.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,26 @@ final class PropertyTests: XCTestCase {
165165
),
166166
]
167167
for (lhs, rhs) in rotations {
168-
XCTAssertTrue(lhs.transformEquals(rhs))
168+
XCTAssertTrue(lhs.equals(as3DTransform: rhs))
169+
}
170+
171+
let signDifferentAxis: [(lhs: Quaternion<T>, rhs: Quaternion<T>)] = [
172+
(
173+
Quaternion<T>(real: -.pi, imaginary: -.pi, -.pi, -.pi),
174+
Quaternion<T>(real: -.pi, imaginary: .pi, .pi, .pi)
175+
), (
176+
Quaternion<T>(real: -.ulpOfOne, imaginary: .ulpOfOne, .ulpOfOne, .ulpOfOne),
177+
Quaternion<T>(real: -.ulpOfOne, imaginary: -.ulpOfOne, -.ulpOfOne, -.ulpOfOne)
178+
), (
179+
Quaternion<T>(real: -.pi, imaginary: -.pi, .pi, -.pi),
180+
Quaternion<T>(real: -.pi, imaginary: .pi, -.pi, .pi)
181+
), (
182+
Quaternion<T>(real: -.ulpOfOne, imaginary: -.ulpOfOne, .ulpOfOne, .ulpOfOne),
183+
Quaternion<T>(real: -.ulpOfOne, imaginary: .ulpOfOne, -.ulpOfOne, -.ulpOfOne)
184+
)
185+
]
186+
for (lhs, rhs) in signDifferentAxis {
187+
XCTAssertFalse(lhs.equals(as3DTransform: rhs))
169188
}
170189
}
171190

0 commit comments

Comments
 (0)