From 931f2e2b806377ee769e0a52b6dd50cc006cd11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sat, 18 May 2013 17:07:38 +0000 Subject: [PATCH] Removed useless loops on basis test. --- src/tests/vec.rs | 52 +++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/src/tests/vec.rs b/src/tests/vec.rs index 50d0b392..3468aea2 100644 --- a/src/tests/vec.rs +++ b/src/tests/vec.rs @@ -84,57 +84,45 @@ fn test_commut_dot_vec1() #[test] fn test_basis_vec1() { - for uint::range(0u, 10000u) |_| - { - let basis = Basis::canonical_basis::>(); + let basis = Basis::canonical_basis::>(); - // check vectors form an ortogonal basis - assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); - // check vectors form an orthonormal basis - assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); - } + // check vectors form an ortogonal basis + assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); + // check vectors form an orthonormal basis + assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); } #[test] fn test_basis_vec2() { - for uint::range(0u, 10000u) |_| - { - let basis = Basis::canonical_basis::>(); + let basis = Basis::canonical_basis::>(); - // check vectors form an ortogonal basis - assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); - // check vectors form an orthonormal basis - assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); - } + // check vectors form an ortogonal basis + assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); + // check vectors form an orthonormal basis + assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); } #[test] fn test_basis_vec3() { - for uint::range(0u, 10000u) |_| - { - let basis = Basis::canonical_basis::>(); + let basis = Basis::canonical_basis::>(); - // check vectors form an ortogonal basis - assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); - // check vectors form an orthonormal basis - assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); - } + // check vectors form an ortogonal basis + assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); + // check vectors form an orthonormal basis + assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); } #[test] fn test_basis_nvec() { - for uint::range(0u, 10000u) |_| - { - let basis = Basis::canonical_basis::>(); + let basis = Basis::canonical_basis::>(); - // check vectors form an ortogonal basis - assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); - // check vectors form an orthonormal basis - assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); - } + // check vectors form an ortogonal basis + assert!(all2(basis, basis, |e1, e2| e1 == e2 || e1.dot(e2).fuzzy_eq(&Zero::zero()))); + // check vectors form an orthonormal basis + assert!(all(basis, |e| e.norm().fuzzy_eq(&One::one()))); } #[test]