public void same_vector_has_same_hashcode_when_mutated() { var m = new Vector2F(1, 2); var expectedHashCode = m.GetHashCode(); m.X = -1.1f; m.Y = 100.2f; Assert.Equal(expectedHashCode, m.GetHashCode()); }
/// <summary> /// Returns the hash code for this instance. /// </summary> /// <returns> /// A 32-bit signed integer that is the hash code for this instance. /// </returns> public override int GetHashCode() { // ReSharper disable NonReadonlyFieldInGetHashCode unchecked { int hashCode = Origin.GetHashCode(); hashCode = (hashCode * 397) ^ Scale.GetHashCode(); hashCode = (hashCode * 397) ^ Rotation.GetHashCode(); hashCode = (hashCode * 397) ^ Translation.GetHashCode(); return(hashCode); } // ReSharper restore NonReadonlyFieldInGetHashCode }
/// <summary> /// Returns the hash code for this instance. /// </summary> /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns> public override int GetHashCode() { // ReSharper disable NonReadonlyFieldInGetHashCode unchecked { int hashCode = Pixel.GetHashCode(); hashCode = (hashCode * 397) ^ Minimum.GetHashCode(); hashCode = (hashCode * 397) ^ Maximum.GetHashCode(); hashCode = (hashCode * 397) ^ Position.GetHashCode(); hashCode = (hashCode * 397) ^ Scale.GetHashCode(); hashCode = (hashCode * 397) ^ MaxDistance.GetHashCode(); return(hashCode); } // ReSharper restore NonReadonlyFieldInGetHashCode }
/// <summary> /// Returns the hash code for this instance. /// </summary> /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns> public override int GetHashCode() { // ReSharper disable NonReadonlyFieldInGetHashCode unchecked { int hashCode = Position.GetHashCode(); hashCode = (hashCode * 397) ^ Normal.GetHashCode(); hashCode = (hashCode * 397) ^ Axis.GetHashCode(); hashCode = (hashCode * 397) ^ Color.GetHashCode(); hashCode = (hashCode * 397) ^ TextureCoordinate.GetHashCode(); hashCode = (hashCode * 397) ^ Args0.GetHashCode(); hashCode = (hashCode * 397) ^ Args1.GetHashCode(); hashCode = (hashCode * 397) ^ Args2.GetHashCode(); hashCode = (hashCode * 397) ^ Args3.GetHashCode(); return(hashCode); } // ReSharper restore NonReadonlyFieldInGetHashCode }
public void HashCode() { Vector2F v = new Vector2F(1.0f, 2.0f); Assert.AreNotEqual(Vector2F.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(_min.GetHashCode() ^ _max.GetHashCode()); }
/// <summary> /// Returns the hashcode for this instance. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return(_center.GetHashCode() ^ _axis1.GetHashCode() ^ _axis2.GetHashCode() ^ _extent1.GetHashCode() ^ _extent2.GetHashCode()); }
/// <summary> /// Get the hashcode for this vector instance. /// </summary> /// <returns>Returns the hash code for this vector instance.</returns> public override int GetHashCode() { return(_origin.GetHashCode() ^ _direction.GetHashCode()); }
public void TestGetHashCode() { Vector2F a = new Vector2F(1.0f, 2.0f); Vector2F b = new Vector2F(4.0f, 5.0f); Vector2F c = new Vector2F(1.0f, 2.0f); Assert.AreEqual(a.GetHashCode(), c.GetHashCode()); Assert.AreNotEqual(a.GetHashCode(), b.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() ^ _p2.GetHashCode()); }
/// <summary> /// Returns the hashcode for this instance. /// </summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() { return(_c.GetHashCode() ^ _r.GetHashCode()); }