diff options
Diffstat (limited to 'tests/quat.rs')
-rw-r--r-- | tests/quat.rs | 53 |
1 files changed, 6 insertions, 47 deletions
diff --git a/tests/quat.rs b/tests/quat.rs index dfa7afa..1a6f6e3 100644 --- a/tests/quat.rs +++ b/tests/quat.rs @@ -407,14 +407,14 @@ macro_rules! impl_quat_tests { glam_test!(test_sum, { let two = $new(2.0, 2.0, 2.0, 2.0); - assert_eq!([two, two].iter().sum::<$quat>(), two + two); - assert_eq!([two, two].into_iter().sum::<$quat>(), two + two); + assert_eq!(vec![two, two].iter().sum::<$quat>(), two + two); + assert_eq!(vec![two, two].into_iter().sum::<$quat>(), two + two); }); glam_test!(test_product, { let two = $new(2.0, 2.0, 2.0, 2.0).normalize(); - assert_eq!([two, two].iter().product::<$quat>(), two * two); - assert_eq!([two, two].into_iter().product::<$quat>(), two * two); + assert_eq!(vec![two, two].iter().product::<$quat>(), two * two); + assert_eq!(vec![two, two].into_iter().product::<$quat>(), two * two); }); glam_test!(test_is_finite, { @@ -507,47 +507,6 @@ macro_rules! impl_quat_tests { glam_test!(test_to_array, { assert!($new(1.0, 2.0, 3.0, 4.0).to_array() == [1.0, 2.0, 3.0, 4.0]); }); - - glam_test!(test_to_axis_angle, { - { - let q = $quat::from_xyzw( - 5.28124762e-08, - -5.12559303e-03, - 8.29266140e-08, - 9.99986828e-01, - ); - assert!(q.is_normalized()); - let (axis, angle) = q.to_axis_angle(); - assert!(axis.is_normalized()); - let q2 = $quat::from_axis_angle(axis, angle); - assert!((q.dot(q2) - 1.0).abs() < 1e-6); - } - { - let q = $quat::IDENTITY; - let (axis, angle) = q.to_axis_angle(); - assert!(axis.is_normalized()); - let q2 = $quat::from_axis_angle(axis, angle); - assert!((q.dot(q2) - 1.0).abs() < 1e-6); - } - { - let q = $quat::from_xyzw(0.0, 1.0, 0.0, 0.0); - assert!(q.is_normalized()); - let (axis, angle) = q.to_axis_angle(); - assert!(axis.is_normalized()); - let q2 = $quat::from_axis_angle(axis, angle); - assert!((q.dot(q2) - 1.0).abs() < 1e-6); - } - { - let axis = $vec3::Z; - let angle = core::$t::consts::PI * 0.25; - let q = $quat::from_axis_angle(axis, angle); - assert!(q.is_normalized()); - let (axis2, angle2) = q.to_axis_angle(); - assert!(axis.is_normalized()); - assert_approx_eq!(axis, axis2); - assert_approx_eq!(angle, angle2); - } - }); }; } @@ -641,11 +600,11 @@ mod quat { use glam::DQuat; assert_approx_eq!( DQuat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0), - Quat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0).as_dquat() + Quat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0).as_f64() ); assert_approx_eq!( Quat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0), - DQuat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0).as_quat() + DQuat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0).as_f32() ); }); |