From 4771080e5e151a3ef32f5f287e686f34c62037bf Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 22 Nov 2024 19:01:18 +0900 Subject: [PATCH] Update Matrix4x4Tests.cs --- .../tests/Matrix4x4Tests.cs | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs b/src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs index d4c724e18104d..148c326c7634b 100644 --- a/src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs +++ b/src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs @@ -820,9 +820,7 @@ public void Matrix4x4CreateReflectionTest01() float d = Vector3.Dot(v, plane.Normal); Vector3 vp = point - 2.0f * d * plane.Normal; - AssertExtensions.Equal(vp.X, rp.X, 0.0f); - AssertExtensions.Equal(vp.Y, rp.Y, 0.0f); - AssertExtensions.Equal(vp.Z, rp.Z, 0.0f); + Assert.True(MathHelper.Equal(rp, vp), "Matrix4x4.CreateReflection did not provide expected value."); } } } @@ -833,25 +831,28 @@ public void Matrix4x4CreateReflectionTest02() Plane plane = new Plane(0, 1, 0, 60); Matrix4x4 actual = Matrix4x4.CreateReflection(plane); - AssertExtensions.Equal(1.0f, actual.M11, 0.0f); - AssertExtensions.Equal(0.0f, actual.M12, 0.0f); - AssertExtensions.Equal(0.0f, actual.M13, 0.0f); - AssertExtensions.Equal(0.0f, actual.M14, 0.0f); - - AssertExtensions.Equal(0.0f, actual.M21, 0.0f); - AssertExtensions.Equal(-1.0f, actual.M22, 0.0f); - AssertExtensions.Equal(0.0f, actual.M23, 0.0f); - AssertExtensions.Equal(0.0f, actual.M24, 0.0f); - - AssertExtensions.Equal(0.0f, actual.M31, 0.0f); - AssertExtensions.Equal(0.0f, actual.M32, 0.0f); - AssertExtensions.Equal(1.0f, actual.M33, 0.0f); - AssertExtensions.Equal(0.0f, actual.M34, 0.0f); - - AssertExtensions.Equal(-0.0f, actual.M41, 0.0f); - AssertExtensions.Equal(-120.0f, actual.M42, 0.0f); - AssertExtensions.Equal(-0.0f, actual.M43, 0.0f); - AssertExtensions.Equal(1.0f, actual.M44, 0.0f); + Matrix4x4 expected = new Matrix4x4(); + expected.M11 = 1.0f; + expected.M12 = 0.0f; + expected.M13 = 0.0f; + expected.M14 = 0.0f; + + expected.M21 = 0.0f; + expected.M22 = -1.0f; + expected.M23 = 0.0f; + expected.M24 = 0.0f; + + expected.M31 = 0.0f; + expected.M32 = 0.0f; + expected.M33 = 1.0f; + expected.M34 = 0.0f; + + expected.M41 = 0.0f; + expected.M42 = -120.0f; + expected.M43 = 0.0f; + expected.M44 = 1.0f; + + Assert.True(MathHelper.Equal(expected, actual), "Matrix4x4.CreateReflection did not return the expected value."); } // A test for CreateRotationZ (float)