public void LongestPalindromeSuccess() { string input = "babad"; string expectedResult = "bab"; var result = new LongestPalindrome().LongestPalindromeString(input); Assert.AreEqual(result, expectedResult); input = "cbbd"; expectedResult = "bb"; result = new LongestPalindrome().LongestPalindromeString(input); Assert.AreEqual(result, expectedResult); }
public void LongestPalindromeTestMethod() { LongestPalindrome lp = new LongestPalindrome(); int expected = 7; int actual = lp.FindLongestPalindrome("abccccdd"); Assert.AreEqual(expected, actual); //case 2 int expected2 = 3; int actual2 = lp.FindLongestPalindrome("ccc"); Assert.AreEqual(expected2, actual2); //case 3 string input = "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth"; int expected3 = 983; int actual3 = lp.FindLongestPalindrome(input); Assert.AreEqual(expected3, actual3); }
public void LongestPalindrome_Smoke_Tests() { var longestPalindrome = new LongestPalindrome(); var length = longestPalindrome.FindPalindrome("aacecaaa"); Assert.IsTrue(length == 7); length = longestPalindrome.FindPalindrome("baab"); Assert.IsTrue(length == 4); length = longestPalindrome.FindPalindrome("abaab"); Assert.IsTrue(length == 4); length = longestPalindrome.FindPalindrome("abaxabaxabb"); Assert.IsTrue(length == 9); length = longestPalindrome.FindPalindrome("abaxabaxabybaxabyb"); Assert.IsTrue(length == 11); length = longestPalindrome.FindPalindrome("abaxabaxabbaxabyb"); Assert.IsTrue(length == 10); }
public void Test(string s, string[] possibleResults) { string result = LongestPalindrome.Run(s); Assert.Contains(possibleResults, str => str == result); }
private static void TestLongestPalindrome() { LongestPalindrome instance = new LongestPalindrome(); Console.WriteLine(instance.Solution("a")); }
void InternalTest(string s, int expected) { int actual = LongestPalindrome.Solve(s); Assert.Equal(expected, actual); }
public void Palyndrome() { LongestPalindrome longestPalindrome = new LongestPalindrome(); string result = longestPalindrome.Find("qrrc"); }
public int SampleTest(string str) { return(LongestPalindrome.GetLongestPalindrome(str)); }