Beispiel #1
0
 public void GivenStringOf2Palindromes_CostIs1()
 {
     Assert.AreEqual(1, PalindromicPartition.GetPalindromePartitonCost("ab"));
     Assert.AreEqual(1, PalindromicPartition.GetPalindromePartitonCost("abb"));
     Assert.AreEqual(1, PalindromicPartition.GetPalindromePartitonCost("caba"));
     Assert.AreEqual(1, PalindromicPartition.GetPalindromePartitonCost("ccaba"));
 }
Beispiel #2
0
 public void GivenStringOf3Palindromes_CostIs2()
 {
     Assert.AreEqual(2, PalindromicPartition.GetPalindromePartitonCost("abc"));
     Assert.AreEqual(2, PalindromicPartition.GetPalindromePartitonCost("abcac"));
     Assert.AreEqual(2, PalindromicPartition.GetPalindromePartitonCost("dabacac"));
     Assert.AreEqual(2, PalindromicPartition.GetPalindromePartitonCost("ddabacac"));
     Assert.AreEqual(2, PalindromicPartition.GetPalindromePartitonCost("dadabacac"));
 }
Beispiel #3
0
 public void GivenStringOf4Palindromes_CostIs3()
 {
     Assert.AreEqual(3, PalindromicPartition.GetPalindromePartitonCost("ababbbabbababa"));
 }
Beispiel #4
0
 public void GivenStringSize1_PalindromeCostIs0()
 {
     Assert.AreEqual(0, PalindromicPartition.GetPalindromePartitonCost("a"));
 }
Beispiel #5
0
 public void GivenNullOrEmptyString_PalindromeCostIs0()
 {
     Assert.AreEqual(0, PalindromicPartition.GetPalindromePartitonCost(string.Empty));
     Assert.AreEqual(0, PalindromicPartition.GetPalindromePartitonCost(null));
 }