#![allow(bad_style)] #![allow(clippy::float_cmp)] use hektor::*; #[test] fn Vec2_normalize() { for v in [ Vec2::new(3.0, 4.0), Vec2::new(1.0, 0.0), Vec2::new(0.0, 1.0), ] .iter() { let norm_len = v.normalize().length(); assert!((1.0 - norm_len).abs() < 0.000_001); } } #[test] fn Vec3_normalize() { for v in [ Vec3::new(3.0, 4.0, 5.0), Vec3::new(1.0, 0.0, 0.0), Vec3::new(0.0, 1.0, 0.0), Vec3::new(0.0, 0.0, 1.0), ] .iter() { let norm_len = v.normalize().length(); assert!((1.0 - norm_len).abs() < 0.000_001); } } #[test] fn Vec4_normalize() { for v in [ Vec4::new(3.0, 4.0, 5.0, 6.0), Vec4::new(1.0, 0.0, 0.0, 0.0), Vec4::new(0.0, 1.0, 0.0, 0.0), Vec4::new(0.0, 0.0, 1.0, 0.0), Vec4::new(0.0, 0.0, 0.0, 1.0), ] .iter() { let norm_len = v.normalize().length(); assert!((1.0 - norm_len).abs() < 0.000_001); } } #[test] fn Quat_normalize() { for q in [ Quat::new(3.0, 4.0, 5.0, 6.0), Quat::new(1.0, 0.0, 0.0, 0.0), Quat::new(0.0, 1.0, 0.0, 0.0), Quat::new(0.0, 0.0, 1.0, 0.0), Quat::new(0.0, 0.0, 0.0, 1.0), ] .iter() { let norm_len = q.normalize().length(); assert!((1.0 - norm_len).abs() < 0.000_001); } }