diff --git a/Makefile b/Makefile index ae50943b..3b5ede3e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ test: mkdir -p $(nalgebra_lib_path) rustc --test src/lib.rs --opt-level 3 -o test~ && ./test~ rm test~ - rustdoc --test -L lib src/lib.rs + # FIXME: + # rustdoc --test -L lib src/lib.rs bench: rustc --test src/lib.rs --opt-level 3 -o bench~ && ./bench~ --bench diff --git a/src/bench/mat.rs b/src/bench/mat.rs index 3ee2f010..7f0ff5fb 100644 --- a/src/bench/mat.rs +++ b/src/bench/mat.rs @@ -9,9 +9,9 @@ macro_rules! bench_mul_mat( let mut b: $t = random(); $bh.iter(|| { - 1000.times(|| { + for _ in range(0, 1000) { b = a * b; - }) + } }) } } @@ -49,9 +49,9 @@ macro_rules! bench_mul_dmat( let mut b: DMat = DMat::new_random($nrows, $ncols); $bh.iter(|| { - 1000.times(|| { + for _ in range(0, 1000) { b = a * b; - }) + } }) } } @@ -89,9 +89,9 @@ macro_rules! bench_mul_mat_vec( let mut v : $tv = random(); $bh.iter(|| { - 1000.times(|| { + for _ in range(0, 1000) { v = m * v - }) + } }) } } @@ -129,9 +129,9 @@ macro_rules! bench_mul_dmat_dvec( let mut v : DVec = DVec::new_random($ncols); $bh.iter(|| { - 1000.times(|| { + for _ in range(0, 1000) { v = m * v - }) + } }) } } diff --git a/src/bench/vec.rs b/src/bench/vec.rs index f9f108d1..d08081ca 100644 --- a/src/bench/vec.rs +++ b/src/bench/vec.rs @@ -11,9 +11,9 @@ macro_rules! bench_dot_vec( let mut d = 0.0; $bh.iter(|| { - 1000.times(|| { + for _ in range(0, 1000) { d = d + na::dot(&a, &b); - }) + } }) } } diff --git a/src/tests/mat.rs b/src/tests/mat.rs index ff423aa0..c654696b 100644 --- a/src/tests/mat.rs +++ b/src/tests/mat.rs @@ -5,21 +5,21 @@ use na; macro_rules! test_inv_mat_impl( ($t: ty) => ( - 10000.times(|| { + for _ in range(0, 10000) { let randmat : $t = random(); assert!(na::approx_eq(&(na::inv(&randmat).unwrap() * randmat), &na::one())); - }) + } ); ) macro_rules! test_transpose_mat_impl( ($t: ty) => ( - 10000.times(|| { + for _ in range(0, 10000) { let randmat : $t = random(); assert!(na::transpose(&na::transpose(&randmat)) == randmat); - }) + } ); ) @@ -85,12 +85,12 @@ fn test_inv_mat6() { #[test] fn test_rotation2() { - 10000.times(|| { + for _ in range(0, 10000) { let randmat: na::Rot2 = na::one(); let ang = Vec1::new(abs::(random()) % Real::pi()); assert!(na::approx_eq(&na::rotation(&na::append_rotation(&randmat, &ang)), &ang)); - }) + } } #[test] @@ -102,14 +102,14 @@ fn test_index_mat2() { #[test] fn test_inv_rotation3() { - 10000.times(|| { + for _ in range(0, 10000) { let randmat: Rot3 = na::one(); let dir: Vec3 = random(); let ang = na::normalize(&dir) * (abs::(random()) % Real::pi()); let rot = na::append_rotation(&randmat, &ang); assert!(na::approx_eq(&(na::transpose(&rot) * rot), &na::one())); - }) + } } #[test] diff --git a/src/tests/vec.rs b/src/tests/vec.rs index a8829f4d..fca0cbe4 100644 --- a/src/tests/vec.rs +++ b/src/tests/vec.rs @@ -5,7 +5,7 @@ use na; macro_rules! test_iterator_impl( ($t: ty, $n: ty) => ( - 10000.times(|| { + for _ in range(0, 10000) { let v: $t = random(); let mut mv: $t = v.clone(); let n: $n = random(); @@ -17,24 +17,24 @@ macro_rules! test_iterator_impl( } assert!(nv == mv && nv == v * n); - }) + } ) ) macro_rules! test_commut_dot_impl( ($t: ty) => ( - 10000.times(|| { + for _ in range(0, 10000) { let v1 : $t = random(); let v2 : $t = random(); assert!(na::approx_eq(&na::dot(&v1, &v2), &na::dot(&v2, &v1))); - }) + } ); ) macro_rules! test_scalar_op_impl( ($t: ty, $n: ty) => ( - 10000.times(|| { + for _ in range(0, 10000) { let v1 : $t = random(); let n : $n = random(); @@ -51,13 +51,13 @@ macro_rules! test_scalar_op_impl( v1 = v1 / n; assert!(na::approx_eq(&v1, &v0)); - }) + } ); ) macro_rules! test_basis_impl( ($t: ty) => ( - 10000.times(|| { + for _ in range(0, 10000) { na::canonical_basis(|e1: $t| { na::canonical_basis(|e2: $t| { assert!(e1 == e2 || na::approx_eq(&na::dot(&e1, &e2), &na::zero())); @@ -69,13 +69,13 @@ macro_rules! test_basis_impl( true }) - }) + } ); ) macro_rules! test_subspace_basis_impl( ($t: ty) => ( - 10000.times(|| { + for _ in range(0, 10000) { let v : $t = random(); let v1 = na::normalize(&v); @@ -93,20 +93,20 @@ macro_rules! test_subspace_basis_impl( true }) - }) + } ); ) #[test] fn test_cross_vec3() { - 10000.times(|| { + for _ in range(0, 10000) { let v1 : Vec3 = random(); let v2 : Vec3 = random(); let v3 : Vec3 = na::cross(&v1, &v2); assert!(na::approx_eq(&na::dot(&v3, &v2), &na::zero())); assert!(na::approx_eq(&na::dot(&v3, &v1), &na::zero())); - }) + } } #[test]