From f9f7ddd08f585086d112700e141d82b5da1ac49b Mon Sep 17 00:00:00 2001 From: sebcrozet Date: Sun, 1 Sep 2019 19:52:14 +0200 Subject: [PATCH] Add test for empty matrix tr_mul. --- tests/core/empty.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/core/empty.rs b/tests/core/empty.rs index 05262cd7..a2377f2f 100644 --- a/tests/core/empty.rs +++ b/tests/core/empty.rs @@ -1,9 +1,30 @@ use na::{DMatrix, DVector}; #[test] -fn empty_mul() { +fn empty_matrix_mul_vector() { // Issue #644 let m = DMatrix::::zeros(8, 0); let v = DVector::::zeros(0); assert_eq!(m * v, DVector::zeros(8)); +} + +#[test] +fn empty_matrix_mul_matrix() { + let m1 = DMatrix::::zeros(3, 0); + let m2 = DMatrix::::zeros(0, 4); + assert_eq!(m1 * m2, DMatrix::zeros(3, 4)); +} + +#[test] +fn empty_matrix_tr_mul_vector() { + let m = DMatrix::::zeros(0, 5); + let v = DVector::::zeros(0); + assert_eq!(m.tr_mul(&v), DVector::zeros(5)); +} + +#[test] +fn empty_matrix_tr_mul_matrix() { + let m1 = DMatrix::::zeros(0, 3); + let m2 = DMatrix::::zeros(0, 4); + assert_eq!(m1.tr_mul(&m2), DMatrix::zeros(3, 4)); } \ No newline at end of file