示例#1
0
        public void TestBitwiseMin_10_5()
        {
            var t = new Twiddle();

            int a = 10;
            int b = 5;
            int expected = Math.Min(a, b);
            int actual = t.BitwiseMin1(a, b);

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void TestBitwiseMin_m999_m1000()
        {
            var t = new Twiddle();

            int a = -999;
            int b = -1000;
            int expected = Math.Min(a, b);
            int actual = t.BitwiseMin1(a, b);

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void TestBitwiseMin_minval_0()
        {
            var t = new Twiddle();

            int a = int.MinValue;
            int b = 0;
            int expected = Math.Min(a, b);
            int actual = t.BitwiseMin1(a, b);

            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void TestNumberOfSetBitsBK_16()
        {
            uint n = 16;
            uint expected = 1;

            uint actual = new Twiddle().NumberOfSetBitsBK(n);

            Assert.AreEqual(expected, actual);
        }
示例#5
0
        public void TestNumberOfSetBits_15()
        {
            uint n = 15;
            uint expected = 4;

            uint actual = new Twiddle().NumberOfSetBits(n);

            Assert.AreEqual(expected, actual);
        }
示例#6
0
        public void TestBitwiseMax_2_1()
        {
            var t = new Twiddle();

            int a = 2;
            int b = 1;
            int expected = Math.Max(a, b);
            int actual = t.BitwiseMax(a, b);

            Assert.AreEqual(expected, actual);
        }