Beispiel #1
0
        public void TestLongestPalindrome()
        {
            var sol    = new LongestPalindromeSubstring();
            var output = sol.longestPalindrome("babad");

            Assert.AreEqual(output, "bab");
        }
Beispiel #2
0
        public void TestLongestPalindromeSubstring()
        {
            var r = LongestPalindromeSubstring.Solution1("cabaabad");

            Assert.AreEqual(r, "abaaba");


            r = LongestPalindromeSubstring.Solution1("cabakabadddcf");
            Assert.AreEqual(r, "abakaba");
        }
Beispiel #3
0
        public void TestCase()
        {
            var p = new LongestPalindromeSubstring();

            Assert.AreEqual("bab", p.GetResult("babad"));
            Assert.AreEqual("abcbabcba", p.GetResult("babcbabcbaccba"));
            Assert.AreEqual("abaaba", p.GetResult("abaaba"));
            Assert.AreEqual("abababa", p.GetResult("abababa"));
            Assert.AreEqual("abcbabcbabcba", p.GetResult("abcbabcbabcba"));
            Assert.AreEqual("geeksskeeg", p.GetResult("forgeeksskeegfor"));
            Assert.AreEqual("abba", p.GetResult("abacdfgdcabba"));
        }
 public void longestPalindromeTest()
 {
     foreach (LongestPalindromeTestData testData in TestDataList)
     {
         Console.WriteLine("Testing => Input: " + testData.InputString + "; Output: " +
                           LongestPalindromeSubstring.LongestPalindromeRevised(testData.InputString) +
                           "; Expected Output: " +
                           testData.OutputString);
         Assert.AreEqual(LongestPalindromeSubstring.LongestPalindromeRevised(testData.InputString),
                         testData.OutputString, "Failed on the case: " + testData.InputString);
     }
 }