Add failing test higlighting the issue

This commit is contained in:
nathan.eckert 2021-07-08 11:23:41 +02:00
parent 0a5bd520a4
commit 639382ea49

View File

@ -1108,3 +1108,30 @@ fn partial_eq_different_types() {
// assert_ne!(static_mat, typenum_static_mat); // assert_ne!(static_mat, typenum_static_mat);
//assert_ne!(typenum_static_mat, static_mat); //assert_ne!(typenum_static_mat, static_mat);
} }
fn generic_omatrix_to_string<D>(
vector: &nalgebra::OVector<f64, D>,
matrix: &nalgebra::OMatrix<f64, D, D>) -> (String, String)
where
D: nalgebra::Dim,
nalgebra::DefaultAllocator: nalgebra::base::allocator::Allocator<f64, D>,
nalgebra::DefaultAllocator: nalgebra::base::allocator::Allocator<f64, D, D>,
{
(vector.to_string(), matrix.to_string())
}
#[test]
fn omatrix_to_string() {
let dvec: nalgebra::DVector<f64> = nalgebra::dvector![1.0, 2.0];
let dmatr: nalgebra::DMatrix<f64> = nalgebra::dmatrix![1.0, 2.0; 3.0, 4.0];
let svec: nalgebra::SVector<f64, 2> = nalgebra::vector![1.0, 2.0];
let smatr: nalgebra::SMatrix<f64, 2, 2> = 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()));
}