diff --git a/tests/linalg/hessenberg.rs b/tests/linalg/hessenberg.rs index 1dc35c3b..c0783de2 100644 --- a/tests/linalg/hessenberg.rs +++ b/tests/linalg/hessenberg.rs @@ -11,8 +11,9 @@ fn hessenberg_simple() { } macro_rules! gen_tests( - ($module: ident, $scalar: expr) => { + ($module: ident, $scalar: expr, $scalar_type: ty) => { mod $module { + use na::DMatrix; #[allow(unused_imports)] use crate::core::helper::{RandScalar, RandComplex}; @@ -21,7 +22,8 @@ macro_rules! gen_tests( proptest! { #[test] - fn hessenberg(m in dmatrix_($scalar)) { + fn hessenberg(n in PROPTEST_MATRIX_DIM) { + let m = DMatrix::<$scalar_type>::new_random(n, n).map(|e| e.0); let hess = m.clone().hessenberg(); let (p, h) = hess.unpack(); prop_assert!(relative_eq!(m, &p * h * p.adjoint(), epsilon = 1.0e-7)) @@ -45,5 +47,5 @@ macro_rules! gen_tests( } ); -gen_tests!(complex, complex_f64()); -gen_tests!(f64, PROPTEST_F64); +gen_tests!(complex, complex_f64(), RandComplex); +gen_tests!(f64, PROPTEST_F64, RandScalar); diff --git a/tests/linalg/lu.rs b/tests/linalg/lu.rs index 69708e3b..58a661c4 100644 --- a/tests/linalg/lu.rs +++ b/tests/linalg/lu.rs @@ -43,7 +43,6 @@ mod proptest_tests { macro_rules! gen_tests( ($module: ident, $scalar: expr, $scalar_type: ty) => { mod $module { - use std::cmp; use na::{DMatrix, Matrix4x3, DVector, Vector4}; #[allow(unused_imports)] use crate::core::helper::{RandScalar, RandComplex}; @@ -92,8 +91,6 @@ mod proptest_tests { #[test] fn lu_solve(n in PROPTEST_MATRIX_DIM, nb in PROPTEST_MATRIX_DIM) { - let n = cmp::min(n, 50); // To avoid slowing down the test too much. - let nb = cmp::min(nb, 50); // To avoid slowing down the test too much. let m = DMatrix::<$scalar_type>::new_random(n, n).map(|e| e.0); let lu = m.clone().lu(); @@ -121,7 +118,8 @@ mod proptest_tests { } #[test] - fn lu_inverse(m in dmatrix_($scalar)) { + fn lu_inverse(n in PROPTEST_MATRIX_DIM) { + let m = DMatrix::<$scalar_type>::new_random(n, n).map(|e| e.0); let mut l = m.lower_triangle(); let mut u = m.upper_triangle(); diff --git a/tests/linalg/schur.rs b/tests/linalg/schur.rs index a4cf5361..11402770 100644 --- a/tests/linalg/schur.rs +++ b/tests/linalg/schur.rs @@ -16,8 +16,9 @@ fn schur_simpl_mat3() { #[cfg(feature = "proptest-support")] mod proptest_tests { macro_rules! gen_tests( - ($module: ident, $scalar: expr) => { + ($module: ident, $scalar: expr, $scalar_type: ty) => { mod $module { + use na::DMatrix; #[allow(unused_imports)] use crate::core::helper::{RandScalar, RandComplex}; use crate::proptest::*; @@ -25,7 +26,8 @@ mod proptest_tests { proptest! { #[test] - fn schur(m in dmatrix_($scalar)) { + fn schur(n in PROPTEST_MATRIX_DIM) { + let m = DMatrix::<$scalar_type>::new_random(n, n).map(|e| e.0); let (vecs, vals) = m.clone().schur().unpack(); prop_assert!(relative_eq!(&vecs * vals * vecs.adjoint(), m, epsilon = 1.0e-7)); } @@ -52,8 +54,8 @@ mod proptest_tests { } ); - gen_tests!(complex, complex_f64()); - gen_tests!(f64, PROPTEST_F64); + gen_tests!(complex, complex_f64(), RandComplex); + gen_tests!(f64, PROPTEST_F64, RandScalar); } #[test]