diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3ffb7888c9e237975a10d4aa78899c30286bee0a Binary files /dev/null and b/.DS_Store differ diff --git a/ProjektTest/__pycache__/test_converter.cpython-313.pyc b/ProjektTest/__pycache__/test_converter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dfc78aba09215873aa86917e4b67849ccfebfa75 Binary files /dev/null and b/ProjektTest/__pycache__/test_converter.cpython-313.pyc differ diff --git "a/ProjektTest/other/AliciMuhamed/Test_Converter_R\303\266mische_Zahlen.py" "b/ProjektTest/other/AliciMuhamed/Test_Converter_R\303\266mische_Zahlen.py" new file mode 100644 index 0000000000000000000000000000000000000000..c2ca418fe4ca8d5b1e34c155d00fff00b4d3bfd7 --- /dev/null +++ "b/ProjektTest/other/AliciMuhamed/Test_Converter_R\303\266mische_Zahlen.py" @@ -0,0 +1,38 @@ +#Test_Converter_Römische_Zahlen + +import unittest +import sys +sys.path.append("/Users/marvin/Documents/GitHub/romannumbers") +from ProjektTest.test_converter import RomanConverter as MyConverter +def convert(n: int) -> str: + roman_numerals = { + 1000: "M", 900: "CM", 500: "D", 400: "CD", + 100: "C", 90: "XC", 50: "L", 40: "XL", + 10: "X", 9: "IX", 5: "V", 4: "IV", 1: "I" + } + result = "" + for value in sorted(roman_numerals.keys(), reverse=True): #Schleife, die über die Schlüssel (die Dezimalzahlen) des roman_numerals-Dictionaries iteriert und in absteigender reienfolge zurück gibt durch value nimmt in jeder Iteration den Wert des nächsten sortierten Schlüssels an + while n >= value: #Dies startet eine while-Schleife, die so lange ausgeführt wird, wie der Wert von n größer oder gleich dem aktuellen value (der Dezimalzahl) ist + result += roman_numerals[value] #fügt die entsprechende römische Ziffer (den Wert aus dem roman_numerals-Dictionary) zur result-Zeichenkette hinzu. + n -= value # aktuelle value - n + return result + +class TestRomanConverter(unittest.TestCase): + def test_1(self): + self.assertEqual(MyConverter().convert(1), "I") # Erwartet "I" für 1 + + def test_10(self): + self.assertEqual(convert(10), "X") # Erwartet "X" für 10 + def test_21(self): + self.assertEqual(convert(21), "XXI") # Erwartet "XXI" für 21 + def test_50(self): + self.assertEqual(convert(50), "L") # Erwartet "L" für 50 + def test_100(self): + self.assertEqual(convert(100), "C") # Erwartet "C" für 100 + def test_1000(self): + self.assertEqual(convert(1000), "M") # Erwartet "M" für 1000 + def test_1999(self): + self.assertEqual(convert(1999), "MCMXCIX") #Erwartet "MCMXCIX" für 1999 + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/other/BerishaAlma/__pycache__/test2converter.cpython-313.pyc b/ProjektTest/other/BerishaAlma/__pycache__/test2converter.cpython-313.pyc similarity index 100% rename from other/BerishaAlma/__pycache__/test2converter.cpython-313.pyc rename to ProjektTest/other/BerishaAlma/__pycache__/test2converter.cpython-313.pyc diff --git a/other/BerishaAlma/test2converter.py b/ProjektTest/other/BerishaAlma/test2converter.py similarity index 100% rename from other/BerishaAlma/test2converter.py rename to ProjektTest/other/BerishaAlma/test2converter.py diff --git a/other/GotsisWasilios/TDD_Converter.py b/ProjektTest/other/GotsisWasilios/TDD_Converter.py similarity index 100% rename from other/GotsisWasilios/TDD_Converter.py rename to ProjektTest/other/GotsisWasilios/TDD_Converter.py diff --git a/other/GotsisWasilios/__pycache__/TDD_Converter.cpython-313.pyc b/ProjektTest/other/GotsisWasilios/__pycache__/TDD_Converter.cpython-313.pyc similarity index 100% rename from other/GotsisWasilios/__pycache__/TDD_Converter.cpython-313.pyc rename to ProjektTest/other/GotsisWasilios/__pycache__/TDD_Converter.cpython-313.pyc diff --git a/other/RafehDaniel/__pycache__/converter.cpython-313.pyc b/ProjektTest/other/RafehDaniel/__pycache__/converter.cpython-313.pyc similarity index 100% rename from other/RafehDaniel/__pycache__/converter.cpython-313.pyc rename to ProjektTest/other/RafehDaniel/__pycache__/converter.cpython-313.pyc diff --git a/other/RafehDaniel/converter.py b/ProjektTest/other/RafehDaniel/converter.py similarity index 100% rename from other/RafehDaniel/converter.py rename to ProjektTest/other/RafehDaniel/converter.py diff --git a/ProjektTest/report.md b/ProjektTest/report.md new file mode 100644 index 0000000000000000000000000000000000000000..f34dc7c16870c13feaf5c00e53218815a5b9ff01 --- /dev/null +++ b/ProjektTest/report.md @@ -0,0 +1,8 @@ +## Eigene Tests gegen andere Implementierungen + +| Name | Interface break | Failed Testcases | +|----------------|------------------|-----------------------------------------------------------------------------------------| +| BerishaAlma | no | test_1, test_4, test_21, test_1000, test_0, test_float, test_negative, test_multiple_values | +| GotsisWasilios | yes | all | +| RafehDaniel | no | none | +| AliciMuhamed | no | none | diff --git a/test_converter b/ProjektTest/test_converter.py similarity index 97% rename from test_converter rename to ProjektTest/test_converter.py index 065e064fa40b184637d9a2b6bf328045c4f2d064..5796bf41b493101aedd59c2b6e8592f6be019978 100644 --- a/test_converter +++ b/ProjektTest/test_converter.py @@ -10,7 +10,6 @@ import unittest from abc import ABC, abstractmethod -from other.RafehDaniel.converter import Converter as Dani # Interface (abstrakte Basisklasse) @@ -59,7 +58,7 @@ class RomanConverter(IConverter): # Testklasse mit 8 funktionierenden Tests class TestRomanConverter(unittest.TestCase): def setUp(self): - self.converter = Dani() + self.converter = RomanConverter() # Bei Eingabe der Zahl 1 soll "I" ausgegeben werden def test_1(self): diff --git a/report.md b/report.md deleted file mode 100644 index c852b179dbfa67691cc3e225d035f7b6d7a97e13..0000000000000000000000000000000000000000 --- a/report.md +++ /dev/null @@ -1,7 +0,0 @@ -## Eigene Tests gegen andere Implementierungen - -| Name | Interface break | Failed Testcases | -|-----------------|------------------|----------------------------------------------------------------------------------| -| BerishaAlma | no | test_1, test_4, test_21, test_1000, test_0, test_float, test_negative, test_multiple_values | -| GotsisWasilios | yes | all | -| RafehDaniel | no | none \ No newline at end of file