@@ -102,27 +102,35 @@ final class PropertyTests: XCTestCase {
102
102
}
103
103
// Validate that all *normal* values hash their absolute components, so
104
104
// that rotations in *R³* of `q` and `-q` will hash to same value.
105
- let pis = [
106
- Quaternion < T > ( real: . pi, imaginary: . pi, . pi, . pi) ,
107
- Quaternion < T > ( real: . pi, imaginary: - . pi, . pi, . pi) ,
108
- Quaternion < T > ( real: . pi, imaginary: . pi, - . pi, . pi) ,
109
- Quaternion < T > ( real: . pi, imaginary: . pi, . pi, - . pi) ,
110
- Quaternion < T > ( real: . pi, imaginary: - . pi, - . pi, . pi) ,
111
- Quaternion < T > ( real: . pi, imaginary: - . pi, . pi, - . pi) ,
112
- Quaternion < T > ( real: . pi, imaginary: . pi, - . pi, - . pi) ,
113
- Quaternion < T > ( real: . pi, imaginary: - . pi, - . pi, - . pi) ,
114
-
115
- Quaternion < T > ( real: - . pi, imaginary: . pi, . pi, . pi) ,
116
- Quaternion < T > ( real: - . pi, imaginary: - . pi, . pi, . pi) ,
117
- Quaternion < T > ( real: - . pi, imaginary: . pi, - . pi, . pi) ,
118
- Quaternion < T > ( real: - . pi, imaginary: . pi, . pi, - . pi) ,
119
- Quaternion < T > ( real: - . pi, imaginary: - . pi, - . pi, . pi) ,
120
- Quaternion < T > ( real: - . pi, imaginary: - . pi, . pi, - . pi) ,
121
- Quaternion < T > ( real: - . pi, imaginary: . pi, - . pi, - . pi) ,
122
- Quaternion < T > ( real: - . pi, imaginary: - . pi, - . pi, - . pi) ,
105
+ let pairs : [ ( lhs: Quaternion < T > , rhs: Quaternion < T > ) ] = [
106
+ (
107
+ Quaternion < T > ( real: . pi, imaginary: . pi, . pi, . pi) ,
108
+ Quaternion < T > ( real: - . pi, imaginary: . pi, . pi, . pi)
109
+ ) , (
110
+ Quaternion < T > ( real: . pi, imaginary: - . pi, . pi, . pi) ,
111
+ Quaternion < T > ( real: - . pi, imaginary: - . pi, . pi, . pi)
112
+ ) , (
113
+ Quaternion < T > ( real: . pi, imaginary: . pi, - . pi, . pi) ,
114
+ Quaternion < T > ( real: - . pi, imaginary: . pi, - . pi, . pi)
115
+ ) , (
116
+ Quaternion < T > ( real: . pi, imaginary: . pi, . pi, - . pi) ,
117
+ Quaternion < T > ( real: - . pi, imaginary: . pi, . pi, - . pi)
118
+ ) , (
119
+ Quaternion < T > ( real: . pi, imaginary: - . pi, - . pi, . pi) ,
120
+ Quaternion < T > ( real: - . pi, imaginary: - . pi, - . pi, . pi)
121
+ ) , (
122
+ Quaternion < T > ( real: . pi, imaginary: - . pi, . pi, - . pi) ,
123
+ Quaternion < T > ( real: - . pi, imaginary: - . pi, . pi, - . pi)
124
+ ) , (
125
+ Quaternion < T > ( real: . pi, imaginary: . pi, - . pi, - . pi) ,
126
+ Quaternion < T > ( real: - . pi, imaginary: . pi, - . pi, - . pi)
127
+ ) , (
128
+ Quaternion < T > ( real: . pi, imaginary: - . pi, - . pi, - . pi) ,
129
+ Quaternion < T > ( real: - . pi, imaginary: - . pi, - . pi, - . pi)
130
+ )
123
131
]
124
- for pi in pis [ 1 ... ] {
125
- XCTAssertEqual ( pis [ 0 ] . hashValue, pi . hashValue)
132
+ for pair in pairs {
133
+ XCTAssertEqual ( pair . lhs . hashValue, pair . rhs . hashValue)
126
134
}
127
135
}
128
136
@@ -131,21 +139,18 @@ final class PropertyTests: XCTestCase {
131
139
testEquatableHashable ( Float64 . self)
132
140
}
133
141
134
- func testRotationEquals < T: Real & SIMDScalar > ( _ type: T . Type ) {
142
+ func testTransformationEquals < T: Real & SIMDScalar > ( _ type: T . Type ) {
135
143
let rotations : [ ( lhs: Quaternion < T > , rhs: Quaternion < T > ) ] = [
136
144
(
137
145
Quaternion < T > ( real: - . pi, imaginary: - . pi, - . pi, - . pi) ,
138
146
Quaternion < T > ( real: . pi, imaginary: . pi, . pi, . pi)
139
- ) ,
140
- (
147
+ ) , (
141
148
Quaternion < T > ( real: . ulpOfOne, imaginary: . ulpOfOne, . ulpOfOne, . ulpOfOne) ,
142
149
Quaternion < T > ( real: - . ulpOfOne, imaginary: - . ulpOfOne, - . ulpOfOne, - . ulpOfOne)
143
- ) ,
144
- (
150
+ ) , (
145
151
Quaternion < T > ( real: . pi, imaginary: - . pi, . pi, - . pi) ,
146
152
Quaternion < T > ( real: - . pi, imaginary: . pi, - . pi, . pi)
147
- ) ,
148
- (
153
+ ) , (
149
154
Quaternion < T > ( real: - . ulpOfOne, imaginary: - . ulpOfOne, . ulpOfOne, . ulpOfOne) ,
150
155
Quaternion < T > ( real: . ulpOfOne, imaginary: . ulpOfOne, - . ulpOfOne, - . ulpOfOne)
151
156
) ,
@@ -154,8 +159,7 @@ final class PropertyTests: XCTestCase {
154
159
(
155
160
Quaternion < T > . zero,
156
161
- Quaternion< T> . zero
157
- ) ,
158
- (
162
+ ) , (
159
163
- Quaternion < T > . infinity,
160
164
Quaternion< T> . infinity
161
165
) ,
@@ -165,9 +169,9 @@ final class PropertyTests: XCTestCase {
165
169
}
166
170
}
167
171
168
- func testRotationEquals ( ) {
169
- testRotationEquals ( Float32 . self)
170
- testRotationEquals ( Float64 . self)
172
+ func testTransformationEquals ( ) {
173
+ testTransformationEquals ( Float32 . self)
174
+ testTransformationEquals ( Float64 . self)
171
175
}
172
176
173
177
func testCodable< T: Real & SIMDScalar > ( _ type: T . Type ) throws {
0 commit comments