示例#1
0
            public void same_vector_has_same_hashcode_when_mutated()
            {
                var m = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
                var expectedHashCode = m.GetHashCode();

                m.X = -1.1f;
                m.Y = 100.2f;
                m.Z = 0.1f;
                m.W = -2.2222f;

                Assert.Equal(expectedHashCode, m.GetHashCode());
            }
示例#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 = 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
 }
示例#3
0
        public void HashCode()
        {
            Vector4F v = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);

            Assert.AreNotEqual(Vector4F.One.GetHashCode(), v.GetHashCode());
        }
示例#4
0
        public void TestGetHashCode()
        {
            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.AreEqual(a.GetHashCode(), c.GetHashCode());
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
示例#5
0
 public void HashCode()
 {
     Vector4F v = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
       Assert.AreNotEqual(Vector4F.One.GetHashCode(), v.GetHashCode());
 }