Example #1
0
        public void FindLargestBinaryGap1()
        {
            var number          = 1041;
            var maxBinGapLength = BinaryGapSolution.FindLargestBinaryGap(number);

            Assert.AreEqual(5, maxBinGapLength);
        }
 public void ExceptionTest()
 {
     for (int i = 1; i < 1000; i++)
     {
         Assert.DoesNotThrow(() => BinaryGapSolution.Solution(i));
     }
 }
Example #3
0
        public void FindLargestBinaryGap5TrailingZeroes()
        {
            var number          = 6;
            var maxBinGapLength = BinaryGapSolution.FindLargestBinaryGap(number);

            Assert.AreEqual(0, maxBinGapLength);
        }
Example #4
0
        public void FindLargestBinaryGap4()
        {
            var number          = 2147483647;
            var maxBinGapLength = BinaryGapSolution.FindLargestBinaryGap(number);

            Assert.AreEqual(0, maxBinGapLength);
        }
Example #5
0
        public void FindLargestBinaryGap3()
        {
            var number          = 805306369;
            var maxBinGapLength = BinaryGapSolution.FindLargestBinaryGap(number);

            Assert.AreEqual(27, maxBinGapLength);
        }
 public void FirstTest()
 {
     Assert.AreEqual(5, BinaryGapSolution.Solution(1041));
     Assert.AreEqual(0, BinaryGapSolution.Solution(6));
     Assert.AreEqual(0, BinaryGapSolution.Solution(4));
     Assert.AreEqual(2, BinaryGapSolution.Solution(9));
     Assert.AreEqual(28, BinaryGapSolution.Solution(1610612737));
     Assert.AreEqual(4, BinaryGapSolution.Solution(74901729));
 }
Example #7
0
        static void Main(string[] args)
        {
            GeneralGreeting();

            BinaryGapSolution.FindLargestBinaryGap();
        }