示例#1
0
        public void IsPowerOfTwoTrueLargeLong()
        {
            long l = int.MaxValue;

            ++l;
            Assert.IsTrue(IntegerMath.IsPowerOfTwo(l));
        }
示例#2
0
        public void IsPowerOfTwoTrueLoop()
        {
            ulong u = 1;

            for (int i = 0; i < 64; ++i)
            {
                Assert.IsTrue(IntegerMath.IsPowerOfTwo(u));
                u <<= 1;
            }
        }
示例#3
0
        public void IsPowerOfTwoFalseMAXulong()
        {
            ulong u = ulong.MaxValue;

            Assert.IsFalse(IntegerMath.IsPowerOfTwo(u));
        }
示例#4
0
        public void IsPowerOfTwoFalse127Sbyte()
        {
            sbyte s = 127;

            Assert.IsFalse(IntegerMath.IsPowerOfTwo(s));
        }
示例#5
0
        public void IsPowerOfTwoFalse3Short()
        {
            short s = 3;

            Assert.IsFalse(IntegerMath.IsPowerOfTwo(s));
        }
示例#6
0
        public void IsPowerOfTwoTrue1Int()
        {
            int i = 1;

            Assert.IsTrue(IntegerMath.IsPowerOfTwo(i));
        }
示例#7
0
        public void IsPowerOfTwoFalse0Uint()
        {
            uint u = 0;

            Assert.IsFalse(IntegerMath.IsPowerOfTwo(u));
        }
示例#8
0
        public void IsPowerOfTwoTrue16Byte()
        {
            byte b = 16;

            Assert.IsTrue(IntegerMath.IsPowerOfTwo(b));
        }