Esempio n. 1
0
        public void CheckVectorReferenceEquality()
        {
            vec2 v2_1    = new vec2(1, 0);
            vec2 v2_2    = new vec2(1, 0);
            vec2 v2_3    = new vec2(0, 0);
            vec2 v2_1ref = v2_1;

            v2_1ref.y = 1;
            Assert.AreEqual(v2_1.GetHashCode(), v2_2.GetHashCode(), "Error Hashcodes are not the Same");
            Assert.AreNotEqual(v2_1.GetHashCode(), v2_1ref.GetHashCode(), "Error Hashcodes are the Same");
            Assert.AreNotEqual(v2_1.GetHashCode(), v2_3.GetHashCode(), "Error Hashcodes are the Same");

            vec3 v3_1    = new vec3(1, 0, 1);
            vec3 v3_2    = new vec3(1, 0, 1);
            vec3 v3_3    = new vec3(0, 0, 1);
            vec3 v3_1ref = v3_1;

            v3_1ref.y = 1;

            Assert.AreEqual(v3_1.GetHashCode(), v3_2.GetHashCode(), "Error Hashcodes are not the Same");
            Assert.AreNotEqual(v3_1.GetHashCode(), v3_1ref.GetHashCode(), "Error Hashcodes are the Same");
            Assert.AreNotEqual(v3_1.GetHashCode(), v3_3.GetHashCode(), "Error Hashcodes are the Same");

            vec4 v4_1    = new vec4(1, 0, 1, 1);
            vec4 v4_2    = new vec4(1, 0, 1, 1);
            vec4 v4_3    = new vec4(0, 0, 1, 1);
            vec4 v4_1ref = v4_1;

            v4_1ref.y = 1;

            Assert.AreEqual(v4_1.GetHashCode(), v4_2.GetHashCode(), "Error Hashcodes are not the Same");
            Assert.AreNotEqual(v4_1.GetHashCode(), v4_1ref.GetHashCode(), "Error Hashcodes are the Same");
            Assert.AreNotEqual(v4_1.GetHashCode(), v4_3.GetHashCode(), "Error Hashcodes are the Same");
        }
Esempio n. 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((pos.GetHashCode() * 397) ^ rgba.GetHashCode());
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 public static int GetHashCode(vec4 v) => v.GetHashCode();