Add a test for the 2d rotation.

This commit is contained in:
Sébastien Crozet 2013-05-19 11:53:19 +00:00
parent dc0757b2e5
commit 52a769a431
1 changed files with 15 additions and 2 deletions

View File

@ -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::<Rotmat<Mat2<f64>>>();
let ang = &vec1(abs::<f64>(random()) % f64::consts::pi);
assert!(randmat.rotated(ang).rotation().fuzzy_eq(ang));
}
}