From ea6114b9ae6bf707fbca9bfe7678b3d9dcb7a696 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Tue, 29 Jun 2021 20:51:38 -0700 Subject: [PATCH] test 4x4 equality and inequality --- rtchallenge/src/matrices.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/rtchallenge/src/matrices.rs b/rtchallenge/src/matrices.rs index 2d6d96e..cde3253 100644 --- a/rtchallenge/src/matrices.rs +++ b/rtchallenge/src/matrices.rs @@ -307,4 +307,36 @@ mod tests { assert_eq!(m[(3, 0)], 13.5); assert_eq!(m[(3, 2)], 15.5); } + #[test] + fn equality4x4() { + let a = Matrix4x4::new( + [1., 2., 3., 4.], + [5., 6., 7., 8.], + [9., 8., 7., 6.], + [5., 4., 3., 2.], + ); + let b = Matrix4x4::new( + [1., 2., 3., 4.], + [5., 6., 7., 8.], + [9., 8., 7., 6.], + [5., 4., 3., 2.], + ); + assert_eq!(a, b); + } + #[test] + fn inequality4x4() { + let a = Matrix4x4::new( + [1., 2., 3., 4.], + [5., 6., 7., 8.], + [9., 8., 7., 6.], + [5., 4., 3., 2.], + ); + let b = Matrix4x4::new( + [2., 3., 4., 5.], + [6., 7., 8., 9.], + [8., 7., 6., 5.], + [4., 3., 2., 1.], + ); + assert_ne!(a, b); + } }