public void find_the_largest_palindromic_product_of_two_three_digit_numbers()
        {
            var instance          = new Problem004();
            var largestPalindrome = instance.GetLargestPalindromicProductWithFactorsOfNDigits(3);

            Assert.AreEqual(9009, largestPalindrome);
        }
        public void determine_if_number_is_a_palindrome()
        {
            var instance          = new Problem004();
            var palindromicNumber = Any.PalindromicNumber();

            var isPalindrome = instance.IsPalindrome(palindromicNumber);

            Assert.IsTrue(isPalindrome);
        }
        public void determine_if_number_is_not_a_palindrome()
        {
            var instance             = new Problem004();
            var nonPalindromicNumber = Any.PalindromicNumber() + 1;

            var isPalindrome = instance.IsPalindrome(nonPalindromicNumber);

            Assert.IsFalse(isPalindrome);
        }
Esempio n. 4
0
        public void Problem004()
        {
            var problem = new Problem004()
            {
                ConsoleOutput = false, DetailedOutput = false
            };

            Assert.AreEqual(906609, problem.Answer());
        }
        public void get_the_product_of_two_numbers()
        {
            var instance        = new Problem004();
            var firstFactor     = Any.Number(100, 999);
            var secondFactor    = Any.Number(100, 999);
            var expectedProduct = firstFactor * secondFactor;

            var actualProduct = instance.GetProduct(firstFactor, secondFactor);

            Assert.AreEqual(expectedProduct, actualProduct);
        }
Esempio n. 6
0
        public void SolveTest()
        {
            var rootNode = new BinaryTreeNode(10,
                                              new BinaryTreeNode(5,
                                                                 new BinaryTreeNode(4),
                                                                 new BinaryTreeNode(7)),
                                              new BinaryTreeNode(12));

            string pathList = Problem004.Solve(rootNode, 22);

            Assert.AreEqual("10,5,7\r\n" + "10,12\r\n", pathList);
        }
        public void Problem004_Is_Johnny_Making_Progress_Test_1()
        {
            int act = Problem004.IsJohnnyMakingProgress(new int[] { 3, 4, 1, 2 });

            Assert.True(act.Equals(2));
        }
        public void Problem004_Is_Johnny_Making_Progress_Test_6()
        {
            int act = Problem004.IsJohnnyMakingProgress(new int[] { 7, 6, 5, 4, 3, 2, 1, 0 });

            Assert.True(act.Equals(0));
        }
        public void Problem004_Is_Johnny_Making_Progress_Test_5()
        {
            int act = Problem004.IsJohnnyMakingProgress(new int[] { 9, 9 });

            Assert.True(act.Equals(0));
        }
Esempio n. 10
0
        public void Problem004_Is_Johnny_Making_Progress_Test_3()
        {
            int act = Problem004.IsJohnnyMakingProgress(new int[] { 10, 11, 12, 9, 10 });

            Assert.True(act.Equals(3));
        }
Esempio n. 11
0
        public void Problem004_Is_Johnny_Making_Progress_Test_2()
        {
            int act = Problem004.IsJohnnyMakingProgress(new int[] { 0, 3, 5, 7, 9, 11, 13 });

            Assert.True(act.Equals(6));
        }
Esempio n. 12
0
        public void IsCorrectProblem004()
        {
            var problem = new Problem004();

            Assert.Equal(Answers["4"], problem.Solve());
        }
Esempio n. 13
0
 public Problem004Test()
 {
     problem004 = new Problem004();
 }