From 3d2d763a3b6aeb065c1e47b0bc8ccd27c4f5a328 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Tue, 29 Jun 2021 20:56:08 -0700 Subject: [PATCH] test 4x4 multiplication --- rtchallenge/src/matrices.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rtchallenge/src/matrices.rs b/rtchallenge/src/matrices.rs index cde3253..dd66764 100644 --- a/rtchallenge/src/matrices.rs +++ b/rtchallenge/src/matrices.rs @@ -339,4 +339,28 @@ mod tests { ); assert_ne!(a, b); } + #[test] + fn mul4x4() { + 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., 1., 2., 3.], + [3., 2., 1., -1.], + [4., 3., 6., 5.], + [1., 2., 7., 8.], + ); + assert_eq!( + a * b, + Matrix4x4::new( + [20., 22., 50., 48.], + [44., 54., 114., 108.], + [40., 58., 110., 102.], + [16., 26., 46., 42.], + ) + ); + } }