Beispiel #1
0
        public void KaprekarsDifferenceTest2()
        {
            const int number     = 2111;
            const int iterations = 5;

            Assert.AreEqual(iterations, Challenges.KaprekarsConstant(number));
        }
Beispiel #2
0
        public void SimpleAddingTest()
        {
            const int number   = 5;
            const int sumValue = 15;

            var sum = Challenges.SimpleAdding(number);

            Assert.AreEqual(sum, sumValue);
        }
Beispiel #3
0
        public void CharReplacementTest()
        {
            const string text            = "abracadabra";
            const string textReplacement = "bcsbdbEbcsb";

            var result = Challenges.GetCharReplacement(text);

            Assert.AreEqual(result, textReplacement);
        }
Beispiel #4
0
        public void FactorialTest()
        {
            const int number         = 5;
            const int factorialValue = 120;

            var factorial = Challenges.GetFactorial(number);

            Assert.AreEqual(factorialValue, factorial);
        }
Beispiel #5
0
        public void ReverseStringTest()
        {
            const string text = "abracadabra";
            const string arbacadabraInReverse = "arbadacarba";

            var reverseString = Challenges.GetReverseString(text);

            Assert.AreEqual(reverseString, arbacadabraInReverse);
        }
Beispiel #6
0
        public void LongestWordTest1()
        {
            const string sentence         = "A walk in the park";
            const string firstLongestWord = "walk";

            var longestWord = Challenges.GetLongestWord(sentence);

            Assert.AreEqual(longestWord, firstLongestWord);
        }
Beispiel #7
0
        public void LongestWordTest2()
        {
            const string sentence         = "fee fi fo fum";
            const string firstLongestWord = "fee";

            var longestWord = Challenges.GetLongestWord(sentence);

            Assert.AreEqual(longestWord, firstLongestWord);
        }
Beispiel #8
0
        public void WordCapitaliseTest()
        {
            const string sentence       = "fee fi fo fum";
            const string wordCapitalise = "Fee Fi Fo Fum";

            var result = Challenges.LetterCapitalise(sentence);

            Assert.AreEqual(result, wordCapitalise);
        }
Beispiel #9
0
        public void PentagonalNumberTest2()
        {
            const int number   = 5;
            const int sumValue = 51;

            var sum = Challenges.PentagonalNumber(number);

            Assert.AreEqual(sum, sumValue);
        }
Beispiel #10
0
        public void MaxSquareTest4()
        {
            var matrix = new[]
            {
                "0111",
                "1101",
                "0111"
            };

            Assert.AreEqual(Challenges.MaximumSquare(matrix), 1);
        }
Beispiel #11
0
        public void MaxSquareTest1()
        {
            var matrix = new[]
            {
                "10100",
                "10111",
                "11111",
                "10010"
            };

            Assert.AreEqual(Challenges.MaximumSquare(matrix), 4);
        }
Beispiel #12
0
        public void QuestionsMarksTest3()
        {
            const string text = "5??aaaaaaaaaaaaaaaaaaa?5?5";

            Assert.AreEqual("false", Challenges.QuestionsMarks(text));
        }
Beispiel #13
0
        public void ChessboardTravelingTest2()
        {
            const string text = "(1 1)(3 3)";

            Assert.AreEqual(6, Challenges.ChessboardTraveling(text));
        }
Beispiel #14
0
        public void ChessboardTravelingTest1()
        {
            const string text = "(2 2)(4 3)";

            Assert.AreEqual(3, Challenges.ChessboardTraveling(text));
        }
Beispiel #15
0
        public void PrimesTest()
        {
            var primeNumbers = new[] { 5, 7, 11, 13, 17, 19 };

            Assert.IsTrue(Challenges.GetPrimes(4, 20).All(p => primeNumbers.Contains(p)));
        }
Beispiel #16
0
        public void QuestionsMarksTest2()
        {
            const string text = "aa6?9";

            Assert.AreEqual("false", Challenges.QuestionsMarks(text));
        }
Beispiel #17
0
        public void QuestionsMarksTest1()
        {
            const string text = "acc?7??sss?3rr1??????5";

            Assert.AreEqual("true", Challenges.QuestionsMarks(text));
        }
Beispiel #18
0
        public void PlusEnclosedTest1()
        {
            const string text = "+b++a==+s+c";

            Assert.AreEqual("false", Challenges.IsPlusEnclosed(text));
        }
Beispiel #19
0
        public void AlphabetSoupTest1()
        {
            const string text = "coderbyte";

            Assert.AreEqual("bcdeeorty", Challenges.AlphabetSoup(text));
        }
Beispiel #20
0
        public void PlusEnclosedTest2()
        {
            const string text = "+b++a+=+s+c+";

            Assert.AreEqual("true", Challenges.IsPlusEnclosed(text));
        }
Beispiel #21
0
        public void FibbonachiTest()
        {
            var fibbonachiNumbers = new[] { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };

            Assert.IsTrue(Challenges.GetFibbonachi(11).All(p => fibbonachiNumbers.Contains(p)));
        }