public void same_components_are_equal() { var a = new Vector4D(5.0, -1.1, 99.9, -8.5); var b = new Vector4D(5.0, -1.1, 99.9, -8.5); Assert.True(a.Equals((object)b)); Assert.True(b.Equals((object)a)); }
public void different_components_are_not_equal() { var a = new Vector4D(5.0, -1.1, 0.0, 78.1); var b = new Vector4D(-1.1, 5.0, 5.0, 78.1); var c = new Vector4D(5.0, -1.1, 0.0, 78.2); var d = new Vector4D(-1.1, -1.1, -1.1, -1.1); var e = new Vector4D(); 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() { Vector4D v0 = new Vector4D(678.0, 234.8, -123.987, 4.0); Vector4D v1 = new Vector4D(678.0, 234.8, -123.987, 4.0); Vector4D v2 = new Vector4D(67.0, 234.8, -123.987, 4.0); Vector4D v3 = new Vector4D(678.0, 24.8, -123.987, 4.0); Vector4D v4 = new Vector4D(678.0, 234.8, 123.987, 4.0); Vector4D v5 = new Vector4D(678.0, 234.8, 123.987, 4.1); 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 Vector4D(-1.0, 5.0, -0.5, 0.1); Assert.False(v.Equals((object)"not-a-matrix")); }
public void self_not_equal_to_null() { var v = new Vector4D(-1.0, 5.0, -0.5, 0.1); Assert.False(v.Equals((object)null)); }
public void self_equal_to_self() { var v = new Vector4D(-1.0, 5.0, -0.5, 0.1); Assert.True(v.Equals((object)v)); }
public void self_equal_to_self() { var v = new Vector4D(1.0, 2.0, 3.0, 4.0); Assert.True(v.Equals(v)); }
public void TestEquals() { Vector4D a = new Vector4D(1.0, 2.0, 3.0, 4.0); Vector4D b = new Vector4D(4.0, 5.0, 6.0, 7.0); Vector4D c = new Vector4D(1.0, 2.0, 3.0, 4.0); 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)); }