[string-in-mirror] renaming etc.

This commit is contained in:
Kai.Yuan 2024-02-20 07:30:30 +08:00
parent 972571e258
commit 9d13085bbc
1 changed files with 15 additions and 14 deletions

View File

@ -12,7 +12,21 @@ public class CheckStringEqualsMirrorReflectionUnitTest {
private final static Set<Character> SYMMETRIC_LETTERS = Set.of('A', 'H', 'I', 'M', 'O', 'T', 'U', 'V', 'W', 'X', 'Y');
boolean isReflectionEqual(String input) {
@Test
void whenCallingIsReflectionEqual_thenGetExpectedResults() {
assertFalse(isMirrorImageEqual("LOL"));
assertFalse(isMirrorImageEqual("AXY"));
assertFalse(isMirrorImageEqual("HUHU"));
assertTrue(isMirrorImageEqual(""));
assertTrue(isMirrorImageEqual("AAA"));
assertTrue(isMirrorImageEqual("HUH"));
assertTrue(isMirrorImageEqual("HIMMIH"));
assertTrue(isMirrorImageEqual("HIMIH"));
}
public boolean isMirrorImageEqual(String input) {
return containsOnlySymmetricLetters(input) && isPalindrome(input);
}
@ -30,17 +44,4 @@ public class CheckStringEqualsMirrorReflectionUnitTest {
return input.equals(reversed);
}
@Test
void whenCallingIsReflectionEqual_thenGetExpectedResults() {
assertFalse(isReflectionEqual("LOL"));
assertFalse(isReflectionEqual("AXY"));
assertFalse(isReflectionEqual("HUHU"));
assertTrue(isReflectionEqual(""));
assertTrue(isReflectionEqual("AAA"));
assertTrue(isReflectionEqual("HUH"));
assertTrue(isReflectionEqual("HIMMIH"));
assertTrue(isReflectionEqual("HIMIH"));
}
}