Ejemplo n.º 1
0
            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());
            }
Ejemplo n.º 2
0
 /// <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
 }
Ejemplo n.º 3
0
 /// <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
 }
Ejemplo n.º 4
0
 /// <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
 }
Ejemplo n.º 5
0
 public void HashCode()
 {
     Vector2F v = new Vector2F(1.0f, 2.0f);
       Assert.AreNotEqual(Vector2F.One.GetHashCode(), v.GetHashCode());
 }
Ejemplo n.º 6
0
        public void HashCode()
        {
            Vector2F v = new Vector2F(1.0f, 2.0f);

            Assert.AreNotEqual(Vector2F.One.GetHashCode(), v.GetHashCode());
        }
Ejemplo n.º 7
0
 /// <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());
 }
Ejemplo n.º 8
0
 /// <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());
 }
Ejemplo n.º 9
0
 /// <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());
 }
Ejemplo n.º 10
0
        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());
        }
Ejemplo n.º 11
0
 /// <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());
 }
Ejemplo n.º 12
0
 /// <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());
 }