public void same_components_are_equal() { var a = new Vector4F(5.0f, -1.1f, 99.9f, -8.5f); var b = new Vector4F(5.0f, -1.1f, 99.9f, -8.5f); Assert.True(a.Equals((object)b)); Assert.True(b.Equals((object)a)); }
public void different_components_are_not_equal() { var a = new Vector4F(5.0f, -1.1f, 0.0f, 78.1f); var b = new Vector4F(-1.1f, 5.0f, 5.0f, 78.1f); var c = new Vector4F(5.0f, -1.1f, 0.0f, 78.2f); var d = new Vector4F(-1.1f, -1.1f, -1.1f, -1.1f); var e = new Vector4F(); Assert.False(a.Equals((object)b)); Assert.False(b.Equals((object)a)); Assert.False(a.Equals((object)c)); Assert.False(c.Equals((object)a)); Assert.False(a.Equals((object)d)); Assert.False(d.Equals((object)a)); Assert.False(a.Equals((object)e)); Assert.False(e.Equals((object)a)); }
public void TestEquals() { Vector4F v0 = new Vector4F(678.0f, 234.8f, -123.987f, 4.0f); Vector4F v1 = new Vector4F(678.0f, 234.8f, -123.987f, 4.0f); Vector4F v2 = new Vector4F(67.0f, 234.8f, -123.987f, 4.0f); Vector4F v3 = new Vector4F(678.0f, 24.8f, -123.987f, 4.0f); Vector4F v4 = new Vector4F(678.0f, 234.8f, 123.987f, 4.0f); Vector4F v5 = new Vector4F(678.0f, 234.8f, 123.987f, 4.1f); Assert.IsTrue(v0.Equals(v0)); Assert.IsTrue(v0.Equals(v1)); Assert.IsFalse(v0.Equals(v2)); Assert.IsFalse(v0.Equals(v3)); Assert.IsFalse(v0.Equals(v4)); Assert.IsFalse(v0.Equals(v5)); Assert.IsFalse(v0.Equals(v0.ToString())); }
public void self_not_equal_to_unknown_type() { var v = new Vector4F(-1.0f, 5.0f, -0.5f, 0.1f); Assert.False(v.Equals((object)"not-a-matrix")); }
public void self_not_equal_to_null() { var v = new Vector4F(-1.0f, 5.0f, -0.5f, 0.1f); Assert.False(v.Equals((object)null)); }
public void self_equal_to_self() { var v = new Vector4F(-1.0f, 5.0f, -0.5f, 0.1f); Assert.True(v.Equals((object)v)); }
public void self_equal_to_self() { var v = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f); Assert.True(v.Equals(v)); }
public void TestEquals() { Vector4F a = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f); Vector4F b = new Vector4F(4.0f, 5.0f, 6.0f, 7.0f); Vector4F c = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f); Assert.IsTrue(a.Equals(c)); Assert.IsTrue(c.Equals(a)); Assert.IsTrue(a == c); Assert.IsTrue(c == a); Assert.IsFalse(c != a); Assert.IsFalse(c != a); Assert.IsFalse(a.Equals(b)); Assert.IsFalse(b.Equals(a)); Assert.IsFalse(a == b); Assert.IsFalse(b == a); Assert.IsTrue(a != b); Assert.IsTrue(b != a); object objA = a; object objB = b; object objC = c; Assert.IsTrue(a.Equals(objA)); Assert.IsTrue(a.Equals(objC)); Assert.IsFalse(a.Equals(objB)); Assert.IsTrue(objA.Equals(objC)); Assert.IsFalse(objA.Equals(objB)); Assert.IsFalse(a.Equals(null)); Assert.IsFalse(a.Equals(5)); }