@@ -217,4 +217,50 @@ describe('Vector3 operations', () => {
217
217
expect ( result . z ) . toBeCloseTo ( 0 ) ;
218
218
} ) ;
219
219
} ) ;
220
+
221
+ describe ( 'Vector3 add partial' , ( ) => {
222
+ it ( `add a single axis` , ( ) => {
223
+ const result = Vector3Utils . add ( VECTOR3_UP , { z : 4 } ) ;
224
+ expect ( result . x ) . toBeCloseTo ( 0 ) ;
225
+ expect ( result . y ) . toBeCloseTo ( 1 ) ;
226
+ expect ( result . z ) . toBeCloseTo ( 4 ) ;
227
+ } ) ;
228
+
229
+ it ( `add two axis` , ( ) => {
230
+ const result = Vector3Utils . add ( VECTOR3_UP , { z : 7 , x : 2 } ) ;
231
+ expect ( result . x ) . toBeCloseTo ( 2 ) ;
232
+ expect ( result . y ) . toBeCloseTo ( 1 ) ;
233
+ expect ( result . z ) . toBeCloseTo ( 7 ) ;
234
+ } ) ;
235
+
236
+ it ( `add all three axis` , ( ) => {
237
+ const result = Vector3Utils . add ( VECTOR3_UP , { x : 8 , y : 2 , z : 3 } ) ;
238
+ expect ( result . x ) . toBeCloseTo ( 8 ) ;
239
+ expect ( result . y ) . toBeCloseTo ( 3 ) ;
240
+ expect ( result . z ) . toBeCloseTo ( 3 ) ;
241
+ } ) ;
242
+ } ) ;
243
+
244
+ describe ( 'Vector3 subtract partial' , ( ) => {
245
+ it ( `subtract a single axis` , ( ) => {
246
+ const result = Vector3Utils . subtract ( VECTOR3_UP , { z : 4 } ) ;
247
+ expect ( result . x ) . toBeCloseTo ( 0 ) ;
248
+ expect ( result . y ) . toBeCloseTo ( 1 ) ;
249
+ expect ( result . z ) . toBeCloseTo ( - 4 ) ;
250
+ } ) ;
251
+
252
+ it ( `subtract two axis` , ( ) => {
253
+ const result = Vector3Utils . subtract ( VECTOR3_UP , { z : 7 , x : 2 } ) ;
254
+ expect ( result . x ) . toBeCloseTo ( - 2 ) ;
255
+ expect ( result . y ) . toBeCloseTo ( 1 ) ;
256
+ expect ( result . z ) . toBeCloseTo ( - 7 ) ;
257
+ } ) ;
258
+
259
+ it ( `subtract all three axis` , ( ) => {
260
+ const result = Vector3Utils . subtract ( VECTOR3_UP , { x : 8 , y : 2 , z : 3 } ) ;
261
+ expect ( result . x ) . toBeCloseTo ( - 8 ) ;
262
+ expect ( result . y ) . toBeCloseTo ( - 1 ) ;
263
+ expect ( result . z ) . toBeCloseTo ( - 3 ) ;
264
+ } ) ;
265
+ } ) ;
220
266
} ) ;
0 commit comments