forked from M-Labs/nalgebra
Fix tests and benches.
This commit is contained in:
parent
53c80bc72b
commit
ccce2f2a3f
@ -8,8 +8,8 @@ macro_rules! bench_binop(
|
|||||||
|
|
||||||
let mut rng = IsaacRng::new_unseeded();
|
let mut rng = IsaacRng::new_unseeded();
|
||||||
|
|
||||||
let elems1 = Vec::from_fn(LEN, |_| rng.gen::<$t1>());
|
let elems1: Vec<$t1> = (0us .. LEN).map(|_| rng.gen::<$t1>()).collect();
|
||||||
let elems2 = Vec::from_fn(LEN, |_| rng.gen::<$t2>());
|
let elems2: Vec<$t2> = (0us .. LEN).map(|_| rng.gen::<$t2>()).collect();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
|
||||||
bh.iter(|| {
|
bh.iter(|| {
|
||||||
@ -31,8 +31,8 @@ macro_rules! bench_binop_na(
|
|||||||
|
|
||||||
let mut rng = IsaacRng::new_unseeded();
|
let mut rng = IsaacRng::new_unseeded();
|
||||||
|
|
||||||
let elems1 = Vec::from_fn(LEN, |_| rng.gen::<$t1>());
|
let elems1: Vec<$t1> = (0us .. LEN).map(|_| rng.gen::<$t1>()).collect();
|
||||||
let elems2 = Vec::from_fn(LEN, |_| rng.gen::<$t2>());
|
let elems2: Vec<$t2> = (0us .. LEN).map(|_| rng.gen::<$t2>()).collect();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
|
||||||
bh.iter(|| {
|
bh.iter(|| {
|
||||||
@ -54,7 +54,7 @@ macro_rules! bench_unop(
|
|||||||
|
|
||||||
let mut rng = IsaacRng::new_unseeded();
|
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;
|
let mut i = 0;
|
||||||
|
|
||||||
bh.iter(|| {
|
bh.iter(|| {
|
||||||
@ -76,7 +76,7 @@ macro_rules! bench_unop_self(
|
|||||||
|
|
||||||
let mut rng = IsaacRng::new_unseeded();
|
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;
|
let mut i = 0;
|
||||||
|
|
||||||
bh.iter(|| {
|
bh.iter(|| {
|
||||||
@ -91,14 +91,14 @@ macro_rules! bench_unop_self(
|
|||||||
);
|
);
|
||||||
|
|
||||||
macro_rules! bench_construction(
|
macro_rules! bench_construction(
|
||||||
($name: ident, $constructor: path $(, $args: ident: $types: ty)*) => {
|
($name: ident, $constructor: path, $( $args: ident: $types: ty),*) => {
|
||||||
#[bench]
|
#[bench]
|
||||||
fn $name(bh: &mut Bencher) {
|
fn $name(bh: &mut Bencher) {
|
||||||
const LEN: usize = 1 << 13;
|
const LEN: usize = 1 << 13;
|
||||||
|
|
||||||
let mut rng = IsaacRng::new_unseeded();
|
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;
|
let mut i = 0;
|
||||||
|
|
||||||
bh.iter(|| {
|
bh.iter(|| {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//! Assertion macro tests
|
//! Assertion macro tests
|
||||||
|
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
#![allow(unstable)]
|
|
||||||
|
|
||||||
#[plugin]
|
#[plugin]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
10
tests/mat.rs
10
tests/mat.rs
@ -54,9 +54,9 @@ macro_rules! test_qr_impl(
|
|||||||
//
|
//
|
||||||
// let recomp = eigenvectors * diag * na::transpose(&eigenvectors);
|
// let recomp = eigenvectors * diag * na::transpose(&eigenvectors);
|
||||||
//
|
//
|
||||||
// prisizeln!("eigenvalues: {}", eigenvalues);
|
// println!("eigenvalues: {}", eigenvalues);
|
||||||
// prisizeln!(" mat: {}", randmat);
|
// println!(" mat: {}", randmat);
|
||||||
// prisizeln!("recomp: {}", recomp);
|
// println!("recomp: {}", recomp);
|
||||||
//
|
//
|
||||||
// assert!(na::approx_eq_eps(&randmat, &recomp, &1.0e-2));
|
// assert!(na::approx_eq_eps(&randmat, &recomp, &1.0e-2));
|
||||||
// }
|
// }
|
||||||
@ -200,7 +200,7 @@ fn test_transpose_dmat() {
|
|||||||
8,
|
8,
|
||||||
4,
|
4,
|
||||||
&[
|
&[
|
||||||
1us32,2, 3, 4,
|
1u32,2, 3, 4,
|
||||||
5, 6, 7, 8,
|
5, 6, 7, 8,
|
||||||
9, 10, 11, 12,
|
9, 10, 11, 12,
|
||||||
13, 14, 15, 16,
|
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);
|
assert!(mat1 == mat2);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ fn test_quat_to_axis_angle() {
|
|||||||
|
|
||||||
let q = UnitQuat::new(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))
|
assert!(na::approx_eq(&q.rotation(), &axis_angle))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user