Removed useless loops on basis test.

This commit is contained in:
Sébastien Crozet 2013-05-18 17:07:38 +00:00
parent 890cdb73f2
commit 931f2e2b80
1 changed files with 20 additions and 32 deletions

View File

@ -84,57 +84,45 @@ fn test_commut_dot_vec1()
#[test] #[test]
fn test_basis_vec1() fn test_basis_vec1()
{ {
for uint::range(0u, 10000u) |_| let basis = Basis::canonical_basis::<Vec1<f64>>();
{
let basis = Basis::canonical_basis::<Vec1<f64>>();
// check vectors form an ortogonal basis // check vectors form an ortogonal basis
assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero())));
// check vectors form an orthonormal basis // check vectors form an orthonormal basis
assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one())));
}
} }
#[test] #[test]
fn test_basis_vec2() fn test_basis_vec2()
{ {
for uint::range(0u, 10000u) |_| let basis = Basis::canonical_basis::<Vec2<f64>>();
{
let basis = Basis::canonical_basis::<Vec2<f64>>();
// check vectors form an ortogonal basis // check vectors form an ortogonal basis
assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero())));
// check vectors form an orthonormal basis // check vectors form an orthonormal basis
assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one())));
}
} }
#[test] #[test]
fn test_basis_vec3() fn test_basis_vec3()
{ {
for uint::range(0u, 10000u) |_| let basis = Basis::canonical_basis::<Vec3<f64>>();
{
let basis = Basis::canonical_basis::<Vec3<f64>>();
// check vectors form an ortogonal basis // check vectors form an ortogonal basis
assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero())));
// check vectors form an orthonormal basis // check vectors form an orthonormal basis
assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one())));
}
} }
#[test] #[test]
fn test_basis_nvec() fn test_basis_nvec()
{ {
for uint::range(0u, 10000u) |_| let basis = Basis::canonical_basis::<NVec<d7, f64>>();
{
let basis = Basis::canonical_basis::<NVec<d7, f64>>();
// check vectors form an ortogonal basis // check vectors form an ortogonal basis
assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero())));
// check vectors form an orthonormal basis // check vectors form an orthonormal basis
assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one())));
}
} }
#[test] #[test]