public void same_vector_has_same_hashcode_when_mutated() { var m = new Vector2D(1, 2); var expectedHashCode = m.GetHashCode(); m.X = -1.1; m.Y = 100.2; Assert.Equal(expectedHashCode, m.GetHashCode()); }
public void GetHashCode_Returns_A_Consistent_Hashcode() { var random = new Random(); for (int i = 0; i < 10; i++) { var vector = new Vector2D { X = random.Next(), Y = random.Next() }; Assert.AreEqual(vector.GetHashCode(), vector.GetHashCode()); } }
public void SameVectorSameHashcode() { Vector2D aVector = new Vector2D(7, 7); Vector2D bVector = new Vector2D(7, 7); Assert.IsTrue(aVector.GetHashCode().Equals(bVector.GetHashCode())); }
public void GetHashCode_For_Opposite_Vectors_Do_Not_Collide() { var v1 = new Vector2D(2, 8); var v2 = new Vector2D(8, 2); Assert.AreNotEqual(v1.GetHashCode(), v2.GetHashCode()); }
public void GetHashCodeTest() { Vector2D a = new Vector2D(1, 2); int b = a.GetHashCode(); Assert.IsNotNull(b); }
public void GetHashCode_Does_Not_Return_Zero() { var vector = new Vector2D { X = 1, Y = 2 }; Assert.AreNotEqual(0, vector.GetHashCode()); }
public void Simple() { var vector = new Vector2D { X = 1, Y = 2 }; Assert.AreNotEqual(0, vector.GetHashCode()); Assert.AreEqual(1, vector.X); Assert.AreEqual(2, vector.Y); }
public void Vector2GetHashCodeTest() { Vector2D <float> v1 = new Vector2D <float>(2.0f, 3.0f); Vector2D <float> v2 = new Vector2D <float>(2.0f, 3.0f); Vector2D <float> v3 = new Vector2D <float>(3.0f, 2.0f); Assert.Equal(v1.GetHashCode(), v1.GetHashCode()); Assert.Equal(v1.GetHashCode(), v2.GetHashCode()); Assert.NotEqual(v1.GetHashCode(), v3.GetHashCode()); Vector2D <float> v4 = new Vector2D <float>(0.0f, 0.0f); Vector2D <float> v6 = new Vector2D <float>(1.0f, 0.0f); Vector2D <float> v7 = new Vector2D <float>(0.0f, 1.0f); Vector2D <float> v8 = new Vector2D <float>(1.0f, 1.0f); Assert.NotEqual(v4.GetHashCode(), v6.GetHashCode()); Assert.NotEqual(v4.GetHashCode(), v7.GetHashCode()); Assert.NotEqual(v4.GetHashCode(), v8.GetHashCode()); Assert.NotEqual(v7.GetHashCode(), v6.GetHashCode()); Assert.NotEqual(v8.GetHashCode(), v6.GetHashCode()); Assert.NotEqual(v8.GetHashCode(), v7.GetHashCode()); }
public void Vector2GetHashCodeTest() { Vector2D v1 = new Vector2D(2.0f, 3.0f); Vector2D v2 = new Vector2D(2.0f, 3.0f); Vector2D v3 = new Vector2D(3.0f, 2.0f); Assert.AreEqual(v1.GetHashCode(), v1.GetHashCode()); Assert.AreEqual(v1.GetHashCode(), v2.GetHashCode()); Assert.AreNotEqual(v1.GetHashCode(), v3.GetHashCode()); Vector2D v4 = new Vector2D(0.0f, 0.0f); Vector2D v6 = new Vector2D(1.0f, 0.0f); Vector2D v7 = new Vector2D(0.0f, 1.0f); Vector2D v8 = new Vector2D(1.0f, 1.0f); Assert.AreNotEqual(v4.GetHashCode(), v6.GetHashCode()); Assert.AreNotEqual(v4.GetHashCode(), v7.GetHashCode()); Assert.AreNotEqual(v4.GetHashCode(), v8.GetHashCode()); Assert.AreNotEqual(v7.GetHashCode(), v6.GetHashCode()); Assert.AreNotEqual(v8.GetHashCode(), v6.GetHashCode()); Assert.AreNotEqual(v8.GetHashCode(), v7.GetHashCode()); }
public void TestGetHashCode() { Vector2D a = new Vector2D(1.0, 2.0); Vector2D b = new Vector2D(4.0, 5.0); Vector2D c = new Vector2D(1.0, 2.0); Assert.AreEqual(a.GetHashCode(), c.GetHashCode()); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void HashCode() { Vector2D v = new Vector2D(1.0, 2.0); Assert.AreNotEqual(Vector2D.One.GetHashCode(), v.GetHashCode()); }
/// <summary> /// Returns the hashcode for this instance. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return(_ptOrigin.GetHashCode() ^ _dimensions.GetHashCode()); }
public override int GetHashCode() { return(Min.GetHashCode() ^ Max.GetHashCode()); }
public override int GetHashCode() { return(Vertex1.GetHashCode() ^ Vertex2.GetHashCode()); }
public override int GetHashCode() { return(Origin.GetHashCode() ^ Direction.GetHashCode()); }
public void TestGetHashCode() { Vector2D vector = new Vector2D(1, 2); Assert.IsNotNull(vector.GetHashCode()); }
public override int GetHashCode() { return(Normal.GetHashCode() ^ D.GetHashCode()); }
/// <summary> /// Returns the hashcode for this instance. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return(_p0.GetHashCode() ^ _p1.GetHashCode()); }
/// <summary> /// Returns the hashcode for this instance. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return(_origin.GetHashCode() ^ _direction.GetHashCode()); }
/// <summary> /// Returns the hashcode for this instance. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return(_ptMin.GetHashCode() ^ _ptMax.GetHashCode()); }
/// <summary> /// Returns the hashcode for this instance. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return(_pCenter.GetHashCode() ^ _radius.GetHashCode() ^ _angle0.GetHashCode() ^ _angle1.GetHashCode()); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns> public override int GetHashCode() => Position.GetHashCode();
public override int GetHashCode() { return(Position.GetHashCode() ^ Radius.GetHashCode()); }
public override int GetHashCode() { return(Angular.GetHashCode() ^ Linear.GetHashCode()); }
public override int GetHashCode() { //// ReSharper disable NonReadonlyFieldInGetHashCode return(Corner1.GetHashCode() ^ Corner2.GetHashCode() ^ Corner3.GetHashCode()); }