diff --git a/tests/matrix.rs b/tests/matrix.rs index d6286a98..4564d06c 100644 --- a/tests/matrix.rs +++ b/tests/matrix.rs @@ -237,7 +237,7 @@ fn no_rows_rotated_twice() { } #[test] -fn flip() { +fn flip_square() { let m1 = Matrix::square_from_vec(vec![0, 1, 2, 3]).unwrap(); let m2 = Matrix::square_from_vec(vec![1, 0, 3, 2]).unwrap(); let m3 = Matrix::square_from_vec(vec![2, 3, 0, 1]).unwrap(); @@ -250,6 +250,15 @@ fn flip() { assert_eq!(m1.flipped_ud(), m3); } +#[test] +fn flip_non_square() { + let m1 = Matrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]).unwrap(); + let m2 = Matrix::from_vec(2, 3, vec![3, 4, 5, 0, 1, 2]).unwrap(); + let m3 = Matrix::from_vec(2, 3, vec![2, 1, 0, 5, 4, 3]).unwrap(); + assert_eq!(m1.flipped_ud(), m2); + assert_eq!(m1.flipped_lr(), m3); +} + #[test] fn transpose() { let m1 = Matrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]).unwrap();