Fix tests and benches.

This commit is contained in:
Sébastien Crozet 2015-01-09 22:52:44 +01:00
parent 53c80bc72b
commit ccce2f2a3f
4 changed files with 14 additions and 15 deletions

View File

@ -8,8 +8,8 @@ macro_rules! bench_binop(
let mut rng = IsaacRng::new_unseeded();
let elems1 = Vec::from_fn(LEN, |_| rng.gen::<$t1>());
let elems2 = Vec::from_fn(LEN, |_| rng.gen::<$t2>());
let elems1: Vec<$t1> = (0us .. LEN).map(|_| rng.gen::<$t1>()).collect();
let elems2: Vec<$t2> = (0us .. LEN).map(|_| rng.gen::<$t2>()).collect();
let mut i = 0;
bh.iter(|| {
@ -31,8 +31,8 @@ macro_rules! bench_binop_na(
let mut rng = IsaacRng::new_unseeded();
let elems1 = Vec::from_fn(LEN, |_| rng.gen::<$t1>());
let elems2 = Vec::from_fn(LEN, |_| rng.gen::<$t2>());
let elems1: Vec<$t1> = (0us .. LEN).map(|_| rng.gen::<$t1>()).collect();
let elems2: Vec<$t2> = (0us .. LEN).map(|_| rng.gen::<$t2>()).collect();
let mut i = 0;
bh.iter(|| {
@ -54,7 +54,7 @@ macro_rules! bench_unop(
let mut rng = IsaacRng::new_unseeded();
let elems = Vec::from_fn(LEN, |_| rng.gen::<$t>());
let elems: Vec<$t> = (0us .. LEN).map(|_| rng.gen::<$t>()).collect();
let mut i = 0;
bh.iter(|| {
@ -76,7 +76,7 @@ macro_rules! bench_unop_self(
let mut rng = IsaacRng::new_unseeded();
let mut elems = Vec::from_fn(LEN, |_| rng.gen::<$t>());
let mut elems: Vec<$t> = (0us .. LEN).map(|_| rng.gen::<$t>()).collect();
let mut i = 0;
bh.iter(|| {
@ -91,14 +91,14 @@ macro_rules! bench_unop_self(
);
macro_rules! bench_construction(
($name: ident, $constructor: path $(, $args: ident: $types: ty)*) => {
($name: ident, $constructor: path, $( $args: ident: $types: ty),*) => {
#[bench]
fn $name(bh: &mut Bencher) {
const LEN: usize = 1 << 13;
let mut rng = IsaacRng::new_unseeded();
$(let $args = Vec::from_fn(LEN, |_| rng.gen::<$types>());)*
$(let $args: Vec<$types> = (0us .. LEN).map(|_| rng.gen::<$types>()).collect();)*
let mut i = 0;
bh.iter(|| {

View File

@ -1,7 +1,6 @@
//! Assertion macro tests
#![feature(plugin)]
#![allow(unstable)]
#[plugin]
#[macro_use]

View File

@ -54,9 +54,9 @@ macro_rules! test_qr_impl(
//
// let recomp = eigenvectors * diag * na::transpose(&eigenvectors);
//
// prisizeln!("eigenvalues: {}", eigenvalues);
// prisizeln!(" mat: {}", randmat);
// prisizeln!("recomp: {}", recomp);
// println!("eigenvalues: {}", eigenvalues);
// println!(" mat: {}", randmat);
// println!("recomp: {}", recomp);
//
// assert!(na::approx_eq_eps(&randmat, &recomp, &1.0e-2));
// }
@ -200,7 +200,7 @@ fn test_transpose_dmat() {
8,
4,
&[
1us32,2, 3, 4,
1u32,2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16,
@ -242,7 +242,7 @@ fn test_dmat_from_vec() {
]
);
prisizeln!("mat1: {:?}, mat2: {:?}", mat1, mat2);
println!("mat1: {:?}, mat2: {:?}", mat1, mat2);
assert!(mat1 == mat2);
}

View File

@ -52,7 +52,7 @@ fn test_quat_to_axis_angle() {
let q = UnitQuat::new(axis_angle);
prisizeln!("{:?} {:?}", q.rotation(), axis_angle);
println!("{:?} {:?}", q.rotation(), axis_angle);
assert!(na::approx_eq(&q.rotation(), &axis_angle))
}
}