Exemplo n.º 1
0
        public void Equality_WhenTrue()
        {
            var c1 = new Rgba64(100, 2000, 3000, 40000);
            var c2 = new Rgba64(100, 2000, 3000, 40000);

            Assert.True(c1.Equals(c2));
            Assert.True(c1.GetHashCode() == c2.GetHashCode());
        }
Exemplo n.º 2
0
 public void TestMemberFn_GetHashCode_i ()
 {
     HashSet<Int32> hs = new HashSet<Int32>();
     var rand = new System.Random();
     var buff = new Byte[4];
     UInt32 collisions = 0;
     for(Int32 i = 0; i < Settings.NumTests; ++i)
     {
         rand.NextBytes(buff);
         UInt32 packed = BitConverter.ToUInt32(buff, 0);
         var packedObj = new Rgba64();
         packedObj.PackedValue = packed;
         Int32 hc = packedObj.GetHashCode ();
         if(hs.Contains(hc)) ++collisions;
         hs.Add(hc);
     }
     Assert.That(collisions, Is.LessThan(10));
 }