GetHashCode() 공개 메소드

public GetHashCode ( ) : int
리턴 int
예제 #1
0
            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());
            }
예제 #2
0
        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()));
        }
예제 #4
0
        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());
        }
예제 #5
0
        public void GetHashCodeTest()
        {
            Vector2D a = new Vector2D(1, 2);
            int      b = a.GetHashCode();

            Assert.IsNotNull(b);
        }
예제 #6
0
        public void GetHashCode_Does_Not_Return_Zero()
        {
            var vector = new Vector2D {
                X = 1, Y = 2
            };

            Assert.AreNotEqual(0, vector.GetHashCode());
        }
예제 #7
0
        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);
        }
예제 #8
0
        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());
        }
예제 #9
0
        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());
        }
예제 #10
0
        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());
        }
예제 #11
0
 public void HashCode()
 {
     Vector2D v = new Vector2D(1.0, 2.0);
       Assert.AreNotEqual(Vector2D.One.GetHashCode(), v.GetHashCode());
 }
예제 #12
0
 /// <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());
 }
예제 #13
0
 public override int GetHashCode()
 {
     return(Min.GetHashCode() ^ Max.GetHashCode());
 }
예제 #14
0
        public void HashCode()
        {
            Vector2D v = new Vector2D(1.0, 2.0);

            Assert.AreNotEqual(Vector2D.One.GetHashCode(), v.GetHashCode());
        }
예제 #15
0
 public override int GetHashCode()
 {
     return(Vertex1.GetHashCode() ^ Vertex2.GetHashCode());
 }
예제 #16
0
 public override int GetHashCode()
 {
     return(Origin.GetHashCode() ^ Direction.GetHashCode());
 }
예제 #17
0
        public void TestGetHashCode()
        {
            Vector2D vector = new Vector2D(1, 2);

            Assert.IsNotNull(vector.GetHashCode());
        }
예제 #18
0
 public override int GetHashCode()
 {
     return(Normal.GetHashCode() ^ D.GetHashCode());
 }
예제 #19
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());
 }
예제 #20
0
 /// <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());
 }
예제 #21
0
 /// <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());
 }
예제 #22
0
파일: Arc.cs 프로젝트: ddanninger/PLMPack
 /// <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());
 }
예제 #23
0
 /// <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();
예제 #24
0
 public override int GetHashCode()
 {
     return(Position.GetHashCode() ^ Radius.GetHashCode());
 }
예제 #25
0
 public override int GetHashCode()
 {
     return(Angular.GetHashCode() ^ Linear.GetHashCode());
 }
예제 #26
0
 public override int GetHashCode()
 {
     //// ReSharper disable NonReadonlyFieldInGetHashCode
     return(Corner1.GetHashCode() ^ Corner2.GetHashCode() ^ Corner3.GetHashCode());
 }