mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-29 15:34:21 +08:00
@ -8,19 +8,16 @@ public class PalindromeTest {
|
||||
@Test
|
||||
public void palindrome() {
|
||||
|
||||
String[] palindromes = { null, "", "aba", "123321", "kayak" };
|
||||
String[] palindromes = {null, "", "aba", "123321", "kayak"};
|
||||
for (String s : palindromes) {
|
||||
Assertions.assertTrue(Palindrome.isPalindrome(s) &&
|
||||
Palindrome.isPalindromeRecursion(s) &&
|
||||
Palindrome.isPalindromeTwoPointer(s));
|
||||
Assertions.assertTrue(Palindrome.isPalindrome(s) && Palindrome.isPalindromeRecursion(s)
|
||||
&& Palindrome.isPalindromeTwoPointer(s));
|
||||
}
|
||||
|
||||
String[] notPalindromes = { "abb", "abc", "abc123", "kayaks" };
|
||||
String[] notPalindromes = {"abb", "abc", "abc123", "kayaks"};
|
||||
for (String s : notPalindromes) {
|
||||
Assertions.assertFalse(Palindrome.isPalindrome(s) ||
|
||||
Palindrome.isPalindromeRecursion(s) ||
|
||||
Palindrome.isPalindromeTwoPointer(s));
|
||||
Assertions.assertFalse(Palindrome.isPalindrome(s) || Palindrome.isPalindromeRecursion(s)
|
||||
|| Palindrome.isPalindromeTwoPointer(s));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user