public void TestGetHashCode() { { Vector2 a = new Vector2(10, 11); Vector2 b = new Vector2(10, 11); Assert.IsTrue(a.GetHashCode() == b.GetHashCode()); } { Vector3 a = new Vector3(10, 11, 12); Vector3 b = new Vector3(10, 11, 12); Assert.IsTrue(a.GetHashCode() == b.GetHashCode()); } { Vector4 a = new Vector4(10, 11, 12, 13); Vector4 b = new Vector4(10, 11, 12, 13); Assert.IsTrue(a.GetHashCode() == b.GetHashCode()); } { Quaternion a = new Quaternion(10, 11, 12, 13); Quaternion b = new Quaternion(10, 11, 12, 13); Assert.IsTrue(a.GetHashCode() == b.GetHashCode()); } { Matrix4X4 a = Matrix4X4.CreateRotationX(3); Matrix4X4 b = Matrix4X4.CreateRotationX(3); Assert.IsTrue(a.GetHashCode() == b.GetHashCode()); } }
public void Vector4GetHashCodeTest() { Vector4 target = new Vector4(1.0f, 2.0f, 3.0f, 4.0f); int expected = target.X.GetHashCode() + target.Y.GetHashCode() + target.Z.GetHashCode() + target.W.GetHashCode(); int actual; actual = target.GetHashCode(); Assert.AreEqual(expected, actual, "Vector4.GetHashCode did not return the expected value."); }