new problem and i added better support for sorting and a overall better script

This commit is contained in:
2025-08-17 18:58:12 +02:00
parent 996cfd2821
commit f3baec17e4
8 changed files with 778 additions and 344 deletions

View File

@@ -0,0 +1,33 @@
import unittest
# <!-- Function to check -->
# def check_prime(number : int) -> bool:
# for i in range(2, int(number)):
# if int(number) % i == 0:
# return False
# return True
class TestPrimeNumber(unittest.TestCase):
def test_prime_function(self):
test_cases = [
(2,True),
(3,True),
(4,False),
(6,False),
(1,False)
]
print("\nFUNCTION OUTPUT TEST RESULTS")
for input_val, expected in test_cases:
try:
actual = check_prime(input_val)
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)