From 52a769a431161a061a2f6cb17d7c328e08aba340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 19 May 2013 11:53:19 +0000 Subject: [PATCH] Add a test for the 2d rotation. --- src/tests/mat.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/tests/mat.rs b/src/tests/mat.rs index 45124236..fca18dd0 100644 --- a/src/tests/mat.rs +++ b/src/tests/mat.rs @@ -1,5 +1,5 @@ #[test] -use core::num::{One}; +use core::num::{One, abs}; #[test] use core::rand::{random}; #[test] @@ -9,11 +9,17 @@ use std::cmp::FuzzyEq; #[test] use traits::inv::Inv; #[test] +use traits::rotation::Rotation; +#[test] +use dim1::vec1::vec1; +#[test] use dim1::mat1::Mat1; #[test] use dim2::mat2::Mat2; #[test] use dim3::mat3::Mat3; +#[test] +use adaptors::rotmat::Rotmat; // #[test] // use traits::dim::d7; @@ -60,6 +66,13 @@ fn test_inv_mat3() } #[test] -fn test_rot2() +fn test_rotation2() { + for uint::range(0u, 10000u) |_| + { + let randmat = One::one::>>(); + let ang = &vec1(abs::(random()) % f64::consts::pi); + + assert!(randmat.rotated(ang).rotation().fuzzy_eq(ang)); + } }