diff --git a/tests/core/matrix.rs b/tests/core/matrix.rs index 7befd351..60007846 100644 --- a/tests/core/matrix.rs +++ b/tests/core/matrix.rs @@ -1108,3 +1108,30 @@ fn partial_eq_different_types() { // assert_ne!(static_mat, typenum_static_mat); //assert_ne!(typenum_static_mat, static_mat); } + + + +fn generic_omatrix_to_string( + vector: &nalgebra::OVector, + matrix: &nalgebra::OMatrix) -> (String, String) +where + D: nalgebra::Dim, + nalgebra::DefaultAllocator: nalgebra::base::allocator::Allocator, + nalgebra::DefaultAllocator: nalgebra::base::allocator::Allocator, +{ + (vector.to_string(), matrix.to_string()) +} + +#[test] +fn omatrix_to_string() { + let dvec: nalgebra::DVector = nalgebra::dvector![1.0, 2.0]; + let dmatr: nalgebra::DMatrix = nalgebra::dmatrix![1.0, 2.0; 3.0, 4.0]; + let svec: nalgebra::SVector = nalgebra::vector![1.0, 2.0]; + let smatr: nalgebra::SMatrix = nalgebra::matrix![1.0, 2.0; 3.0, 4.0]; + assert_eq!( + generic_omatrix_to_string(&dvec, &dmatr), + (dvec.to_string(), dmatr.to_string())); + assert_eq!( + generic_omatrix_to_string(&svec, &smatr), + (svec.to_string(), smatr.to_string())); +}