Add test for formatting of empty matrix

This commit is contained in:
Owen Brooks 2022-06-17 18:23:59 +10:00
parent 7bc91d3c68
commit 6df81c2292
1 changed files with 13 additions and 1 deletions

View File

@ -80,7 +80,7 @@ fn iter() {
#[test]
fn debug_output_semicolon_delimited_rowwise() {
let m = Matrix2::new(1.0, 2.0, 3.0, 4.0);
let expected_output = "[1.0, 2.0; 3.0, 4.0]"; // Current output on the nightly channel.
let expected_output = "[1.0, 2.0; 3.0, 4.0]";
let current_output = format!("{:?}", m);
dbg!(expected_output);
dbg!(&current_output);
@ -88,6 +88,18 @@ fn debug_output_semicolon_delimited_rowwise() {
assert!(current_output == expected_output);
}
#[test]
fn format_empty_matrix() {
let empty_row: [f32; 0] = [];
let m = na::DMatrix::from_row_slice(0, 0, &empty_row);
let expected_output = "[ ]";
let current_output = format!("{}", m);
dbg!(expected_output);
dbg!(&current_output);
assert!(current_output == expected_output);
}
#[test]
fn is_column_major() {
let a = Matrix2x3::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);