#![cfg(feature = "mint")] #![allow(bad_style)] use hektor::*; use mint::*; #[test] fn Vec2_from_into_mint() { let v = Vec2::new(1.0, 2.0); let mint_v: Vector2 = v.into(); assert_eq!(v.x(), mint_v.x); assert_eq!(v.y(), mint_v.y); // let v_back: Vec2 = mint_v.into(); assert_eq!(v, v_back); } #[test] fn Vec3_from_into_mint() { let v = Vec3::new(1.0, 2.0, 3.0); let mint_v: Vector3 = v.into(); assert_eq!(v.x(), mint_v.x); assert_eq!(v.y(), mint_v.y); assert_eq!(v.z(), mint_v.z); // let v_back: Vec3 = mint_v.into(); assert_eq!(v, v_back); } #[test] fn Vec4_from_into_mint() { let v = Vec4::new(1.0, 2.0, 3.0, 4.0); let mint_v: Vector4 = v.into(); assert_eq!(v.x(), mint_v.x); assert_eq!(v.y(), mint_v.y); assert_eq!(v.z(), mint_v.z); assert_eq!(v.w(), mint_v.w); // let v_back: Vec4 = mint_v.into(); assert_eq!(v, v_back); } #[test] fn Mat2_from_into_mint() { let x_axis = Vec2::new(1.0, 2.0); let y_axis = Vec2::new(11.0, 12.0); let m = Mat2::new(x_axis, y_axis); let mint_m: ColumnMatrix2 = m.into(); assert_eq!(m.x_axis(), mint_m.x.into()); assert_eq!(m.y_axis(), mint_m.y.into()); // let m_back: Mat2 = mint_m.into(); assert_eq!(m, m_back); } #[test] fn Mat3_from_into_mint() { let x_axis = Vec3::new(1.0, 2.0, 3.0); let y_axis = Vec3::new(11.0, 12.0, 13.0); let z_axis = Vec3::new(21.0, 22.0, 23.0); let m = Mat3::new(x_axis, y_axis, z_axis); let mint_m: ColumnMatrix3 = m.into(); assert_eq!(m.x_axis(), mint_m.x.into()); assert_eq!(m.y_axis(), mint_m.y.into()); assert_eq!(m.z_axis(), mint_m.z.into()); // let m_back: Mat3 = mint_m.into(); assert_eq!(m, m_back); } #[test] fn Mat4_from_into_mint() { let x_axis = Vec4::new(1.0, 2.0, 3.0, 4.0); let y_axis = Vec4::new(11.0, 12.0, 13.0, 14.0); let z_axis = Vec4::new(21.0, 22.0, 23.0, 24.0); let w_axis = Vec4::new(31.0, 32.0, 33.0, 34.0); let m = Mat4::new(x_axis, y_axis, z_axis, w_axis); let mint_m: ColumnMatrix4 = m.into(); assert_eq!(m.x_axis(), mint_m.x.into()); assert_eq!(m.y_axis(), mint_m.y.into()); assert_eq!(m.z_axis(), mint_m.z.into()); assert_eq!(m.w_axis(), mint_m.w.into()); // let m_back: Mat4 = mint_m.into(); assert_eq!(m, m_back); } #[test] fn Quat_from_into_mint() { let q = Quat::new(1.0, 2.0, 3.0, 4.0); let mint_q: Quaternion = q.into(); assert_eq!(q.a(), mint_q.s); assert_eq!(q.b(), mint_q.v.x); assert_eq!(q.c(), mint_q.v.y); assert_eq!(q.d(), mint_q.v.z); // let q_back: Quat = mint_q.into(); assert_eq!(q, q_back); }