This commit is contained in:
2025-08-14 22:05:20 +02:00
parent 04dc638cf0
commit 6079813e2c
12 changed files with 957 additions and 419 deletions

View File

@@ -0,0 +1,32 @@
import unittest
#<!-- User expected Function -->
## def palindrome(s:str) -> bool:
## return s == s[::-1]
class TestSolution(unittest.TestCase):
def test_palindrome(self):
test_cases = [
("racecar", True), # Simple palindrome
("hello", False), # Not a palindrome
("", True), # Empty string
("a", True), # Single character
("madam", True), # Palindrome word
("Madam", False), # Case-sensitive check
("12321", True), # Numeric string palindrome
("123456", False), # Numeric string non-palindrome
]
print("\nFUNCTION OUTPUT TEST RESULTS")
for input_val, expected in test_cases:
try:
actual = palindrome(input_val) # pyright: ignore[reportUndefinedVariable]
status = "✓ PASS" if actual == expected else "✗ FAIL"
print(f"{status} | Input: '{input_val}' -> Got: {actual} | Expected: {expected}")
self.assertEqual(actual, expected)
except Exception as e:
print(f"✗ ERROR | Input: '{input_val}' -> Exception: {e}")
raise
if __name__ == "__main__":
unittest.main(verbosity=2)