Esempio n. 1
0
        public void TestUnsetGetTopBit()
        {
            ulong max = 0x8000000000000000;

            var bit    = Bitboard.Get(max, 63);
            var bitref = Bitboard.GetRef(ref max, 63);

            Assert.IsTrue(bit);
            Assert.IsTrue(bitref);

            var unset = Bitboard.Unset(max, 63);

            Assert.AreEqual((ulong)0, unset);
            Assert.AreEqual(0x8000000000000000, max);

            Bitboard.UnsetRef(ref max, 63);
            Assert.AreEqual((ulong)0, max);

            var set = Bitboard.Set(max, 55);

            Assert.AreEqual((ulong)0x80000000000000, set);
            Assert.AreEqual((ulong)0, max);

            set = Bitboard.Set(max, 63);
            Assert.AreEqual((ulong)0x8000000000000000, set);
            Assert.AreEqual((ulong)0, max);

            Bitboard.SetRef(ref max, 63);
            Assert.AreEqual((ulong)0x8000000000000000, max);
        }