#![allow(bad_style)] #![allow(clippy::float_cmp)] use hektor::*; #[test] fn Mat2_transpose() { assert_eq!(Mat2::default().transpose(), Mat2::default()); // let m = Mat2::from([1.0, 2.0, 3.0, 4.0]); let m_expected = Mat2::from([1.0, 3.0, 2.0, 4.0]); assert_eq!(m.transpose(), m_expected); } #[test] fn Mat3_transpose() { assert_eq!(Mat3::default().transpose(), Mat3::default()); // let m = Mat3::from([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]); let m_expected = Mat3::from([1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0]); assert_eq!(m.transpose(), m_expected); } #[test] fn Mat4_transpose() { assert_eq!(Mat4::default().transpose(), Mat4::default()); // let m = Mat4::from([ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, ]); let m_expected = Mat4::from([ 1.0, 5.0, 9.0, 13.0, 2.0, 6.0, 10.0, 14.0, 3.0, 7.0, 11.0, 15.0, 4.0, 8.0, 12.0, 16.0, ]); assert_eq!(m.transpose(), m_expected); }