diff --git a/Other/WeishauptOrlando_1/your_converter.py b/Other/WeishauptOrlando_1/your_converter.py new file mode 100644 index 0000000000000000000000000000000000000000..593c8b7898e0416d6f9158ccc0f271c8ab28f60f --- /dev/null +++ b/Other/WeishauptOrlando_1/your_converter.py @@ -0,0 +1,39 @@ +import sys +import os +import unittest + +# Füge das src-Verzeichnis zum Python-Pfad hinzu +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) + +from converter import RomanNumber # Importiere die zu testende Klasse +from converter import IRomanNumber + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, IRomanNumber) + + def test_single_digits(self): + self.assertEqual(self.converter.roman_to_int("I"), 1) + self.assertEqual(self.converter.roman_to_int("V"), 5) + self.assertEqual(self.converter.roman_to_int("X"), 10) + + def test_multiple_digits(self): + self.assertEqual(self.converter.roman_to_int("II"), 2) + self.assertEqual(self.converter.roman_to_int("XX"), 20) + self.assertEqual(self.converter.roman_to_int("VI"), 6) + + def test_subtractive_notation(self): + self.assertEqual(self.converter.roman_to_int("IV"), 4) + self.assertEqual(self.converter.roman_to_int("IX"), 9) + self.assertEqual(self.converter.roman_to_int("XL"), 40) + self.assertEqual(self.converter.roman_to_int("XC"), 90) + + def test_complex_numbers(self): + self.assertEqual(self.converter.roman_to_int("MCMXCIV"), 1994) + self.assertEqual(self.converter.roman_to_int("CDXLIV"), 444) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file