Advertisement
JeffGrigg

remove-character-string-make-palindrome

Apr 24th, 2018
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 2.10 KB | None | 0 0
  1. import junit.framework.TestCase;
  2.  
  3. public class DeletePanendromeTest extends TestCase {
  4.  
  5.     public boolean validPalindrome(String s) {
  6.  
  7.         // Put your code here.
  8.  
  9.     }
  10.  
  11.     public void testEmpty() {
  12.         assertEquals("No characters to delete in empty string;", false, validPalindrome(""));
  13.     }
  14.  
  15.     public void testOneChar() {
  16.         assertEquals("Delete one to get empty string;", true, validPalindrome("x"));
  17.     }
  18.  
  19.     public void test_xy() {
  20.         assertEquals("Delete either char;", true, validPalindrome("xy"));
  21.     }
  22.  
  23.     public void test_xx() {
  24.         assertEquals("Delete either char;", true, validPalindrome("xx"));
  25.     }
  26.  
  27.     public void test_xyz() {
  28.         assertEquals(false, validPalindrome("xyz"));
  29.     }
  30.  
  31.     public void test_xyx() {
  32.         assertEquals("Delete middle char;", true, validPalindrome("xyx"));
  33.     }
  34.  
  35.     public void test_xyy() {
  36.         assertEquals("Delete 1st char;", true, validPalindrome("xyy"));
  37.     }
  38.  
  39.     public void test_xxy() {
  40.         assertEquals("Delete last char;", true, validPalindrome("xxy"));
  41.     }
  42.  
  43.     public void test_abba() {
  44.         assertEquals("Delete either 'b';", true, validPalindrome("abba"));
  45.     }
  46.  
  47.     public void test_abcba() {
  48.         assertEquals("Delete the center 'c';", true, validPalindrome("abcba"));
  49.     }
  50.  
  51.     public void test_abccba() {
  52.         assertEquals("Delete either center 'c';", true, validPalindrome("abccba"));
  53.     }
  54.  
  55.     public void test_abaaaaafa() {
  56.         assertEquals("Can't delete both 'b' and 'f';", false, validPalindrome("abaaaaafa"));
  57.     }
  58.  
  59.     public void test_ababababab() {
  60.         assertEquals("Delete first or last char;", true, validPalindrome("ababababab"));
  61.     }
  62.  
  63.     public void test_abababxbabab() {
  64.         assertEquals("Must delete first char;", true, validPalindrome("abababxbabab"));
  65.     }
  66.  
  67.     public void test_ababaxababab() {
  68.         assertEquals("Must delete last char;", true, validPalindrome("ababaxababab"));
  69.     }
  70.  
  71.     public void test_abcdedcbfa() {
  72.         assertEquals("Delete the 'f';", true, validPalindrome("abcdedcbfa"));
  73.     }
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement