Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import junit.framework.TestCase;
- public class DeletePanendromeTest extends TestCase {
- public boolean validPalindrome(String s) {
- // Put your code here.
- }
- public void testEmpty() {
- assertEquals("No characters to delete in empty string;", false, validPalindrome(""));
- }
- public void testOneChar() {
- assertEquals("Delete one to get empty string;", true, validPalindrome("x"));
- }
- public void test_xy() {
- assertEquals("Delete either char;", true, validPalindrome("xy"));
- }
- public void test_xx() {
- assertEquals("Delete either char;", true, validPalindrome("xx"));
- }
- public void test_xyz() {
- assertEquals(false, validPalindrome("xyz"));
- }
- public void test_xyx() {
- assertEquals("Delete middle char;", true, validPalindrome("xyx"));
- }
- public void test_xyy() {
- assertEquals("Delete 1st char;", true, validPalindrome("xyy"));
- }
- public void test_xxy() {
- assertEquals("Delete last char;", true, validPalindrome("xxy"));
- }
- public void test_abba() {
- assertEquals("Delete either 'b';", true, validPalindrome("abba"));
- }
- public void test_abcba() {
- assertEquals("Delete the center 'c';", true, validPalindrome("abcba"));
- }
- public void test_abccba() {
- assertEquals("Delete either center 'c';", true, validPalindrome("abccba"));
- }
- public void test_abaaaaafa() {
- assertEquals("Can't delete both 'b' and 'f';", false, validPalindrome("abaaaaafa"));
- }
- public void test_ababababab() {
- assertEquals("Delete first or last char;", true, validPalindrome("ababababab"));
- }
- public void test_abababxbabab() {
- assertEquals("Must delete first char;", true, validPalindrome("abababxbabab"));
- }
- public void test_ababaxababab() {
- assertEquals("Must delete last char;", true, validPalindrome("ababaxababab"));
- }
- public void test_abcdedcbfa() {
- assertEquals("Delete the 'f';", true, validPalindrome("abcdedcbfa"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement