From 2b88afddee4dc1cb1f472ac7444a6f1b687b7f2b Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 00:35:43 +0200 Subject: [PATCH 01/35] Download Zip-Datei von AliciMuhamed --- .../Test_Converter_R\303\266mische_Zahlen.py" | 36 +++++++++++++++++++ Other/report.md | 24 +++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 "Other/AliciMuhamed_1/Test_Converter_R\303\266mische_Zahlen.py" create mode 100644 Other/report.md diff --git "a/Other/AliciMuhamed_1/Test_Converter_R\303\266mische_Zahlen.py" "b/Other/AliciMuhamed_1/Test_Converter_R\303\266mische_Zahlen.py" new file mode 100644 index 0000000..d98f342 --- /dev/null +++ "b/Other/AliciMuhamed_1/Test_Converter_R\303\266mische_Zahlen.py" @@ -0,0 +1,36 @@ +#Test_Converter_Römische_Zahlen + +import unittest + +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(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/report.md b/Other/report.md new file mode 100644 index 0000000..e3f3e1c --- /dev/null +++ b/Other/report.md @@ -0,0 +1,24 @@ +Meine Testfälle auf Implementierungen anderer Studierender: RomanNumberConverter + +| Name | Interface break | Failed Testcases | +|------------------|------------------|-------------------| +|AliciMuhamed | | | +|BerishaAlma | | | +|GotsisWasili | | | +|PikkemaatLasse | | | +|RafehDaniel | | | +|SerchimoMarvin | | | +|WeishauptOrlando | | | + +Testfälle anderer Studierender auf meine Implementierung: RomanNumberConverter + +| Name | Interface break | Failed Testcases | +|------------------|------------------|-------------------| +|AliciMuhamed | | | +|BerishaAlma | | | +|GotsisWasili | | | +|PikkemaatLasse | | | +|RafehDaniel | | | +|SerchimoMarvin | | | +|WeishauptOrlando | | | + -- GitLab From 6484f132c97ab9722f44b5fa5d0e11c8278e80c0 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 00:40:23 +0200 Subject: [PATCH 02/35] Meine Implementierung converter.py --- Other/AliciMuhamed_1/converter.py | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Other/AliciMuhamed_1/converter.py diff --git a/Other/AliciMuhamed_1/converter.py b/Other/AliciMuhamed_1/converter.py new file mode 100644 index 0000000..0ef9bd0 --- /dev/null +++ b/Other/AliciMuhamed_1/converter.py @@ -0,0 +1,49 @@ +#Bei Eingabe von Zahlen, die in der Liste definiert sind, sollen römische Zhalen zurückgegeben werden. +#Bei Eingabe von Zahlen, die nicht in der Liste definiert ist, soll ein "" ausgeben werden. + +import unittest +from abc import ABC, abstractmethod + +class IRomanNumber(ABC): + @abstractmethod + def convert(self, n:int) -> str: + pass + +class RomanNumber(IRomanNumber): + def convert(self, n: int) -> str: + roman_numerals = { + 1: "I", 2: "II", 3: "III", + 4: "IV", 5: "V", 9: "IX", + 21: "XXI", 50: "L", 100: "C", + 500: "D", 1000: "M" + } + return roman_numerals.get(n, "") + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + + + + +if __name__ == "__main__": + unittest.main() -- GitLab From ea849f7a11a45ccdde6e776bb281164af88f51ee Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 00:45:57 +0200 Subject: [PATCH 03/35] =?UTF-8?q?Implementierung=20von=20AliciMuhamed=20mi?= =?UTF-8?q?t=20meinen=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/AliciMuhamed_1/my_converter.py | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Other/AliciMuhamed_1/my_converter.py diff --git a/Other/AliciMuhamed_1/my_converter.py b/Other/AliciMuhamed_1/my_converter.py new file mode 100644 index 0000000..e83f699 --- /dev/null +++ b/Other/AliciMuhamed_1/my_converter.py @@ -0,0 +1,35 @@ +#Umsetzungen von AliciMuhamed auf meinen Testfälle + +import unittest + +from Test_Converter_Römische_Zahlen import RomanNumber as RomanNumber + + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, ...) + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + +if __name__ == "__main__": + unittest.main() -- GitLab From 75c642de71329ed6828a750e24ab15b95beeed09 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 00:49:13 +0200 Subject: [PATCH 04/35] =?UTF-8?q?Meine=20Implementierung=20mit=20AliciMuha?= =?UTF-8?q?med=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/AliciMuhamed_1/your_converter.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Other/AliciMuhamed_1/your_converter.py diff --git a/Other/AliciMuhamed_1/your_converter.py b/Other/AliciMuhamed_1/your_converter.py new file mode 100644 index 0000000..3cd92f4 --- /dev/null +++ b/Other/AliciMuhamed_1/your_converter.py @@ -0,0 +1,23 @@ +import unittest + +from converter import RomanNumber as RomanNumber + +class TestRomanConverter(unittest.TestCase): + def test_1(self): + self.assertEqual(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 -- GitLab From 5843f3ff4b3a58bcb64d77c0a5032c0ace6b935a Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:06:56 +0200 Subject: [PATCH 05/35] =?UTF-8?q?=C3=84nderungen=20an=20report.md=20gespei?= =?UTF-8?q?chert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/report.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Other/report.md b/Other/report.md index e3f3e1c..af401cb 100644 --- a/Other/report.md +++ b/Other/report.md @@ -1,24 +1,24 @@ Meine Testfälle auf Implementierungen anderer Studierender: RomanNumberConverter -| Name | Interface break | Failed Testcases | -|------------------|------------------|-------------------| -|AliciMuhamed | | | -|BerishaAlma | | | -|GotsisWasili | | | -|PikkemaatLasse | | | -|RafehDaniel | | | -|SerchimoMarvin | | | -|WeishauptOrlando | | | +| Name | Interface break | Failed Testcases | +|------------------|------------------|------------------------------------------------| +|AliciMuhamed | Yes | ImportError: cannot import name 'RomanNumber' | +|BerishaAlma | No | SyntaxError: invalid syntax | +|GotsisWasili | No | 2x AttributeError: 'RomanNumber' object has no attribute 'convert' | +|PikkemaatLasse | No | 2x AttributeError: 'RomanNumerals' object has no attribute 'convert'| +|RafehDaniel | No | AssertionError: 'VI' != '' - VI | +|SerchimoMarvin | NaN | - | +|WeishauptOrlando | No | AttributeError: 'RomanConverter' object has no attribute 'convert' | Testfälle anderer Studierender auf meine Implementierung: RomanNumberConverter | Name | Interface break | Failed Testcases | |------------------|------------------|-------------------| -|AliciMuhamed | | | -|BerishaAlma | | | -|GotsisWasili | | | -|PikkemaatLasse | | | -|RafehDaniel | | | -|SerchimoMarvin | | | -|WeishauptOrlando | | | +|AliciMuhamed | No | 7x NameError: name 'convert' is not defined | +|BerishaAlma | No | 1x AssertionError: '' != 'VI' + VI | +|GotsisWasili | No | 5x AttributeError: 'RomanNumber' object has no attribute 'convert_int_to_str' | +|PikkemaatLasse | No | 6x AttributeError: 'RomanNumber' object has no attribute 'to_roman' | +|RafehDaniel | No | FAILED (failures=15) | +|SerchimoMarvin | NaN | - | +|WeishauptOrlando | No | 4x AttributeError: 'RomanNumber' object has no attribute 'roman_to_int' | -- GitLab From f345f36e38b2c07c0a7df5997cf7c515527f4b21 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:19:07 +0200 Subject: [PATCH 06/35] Download Implemetierung von BerishaAlma --- Other/BerishaAlma_1/test2converter.py | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Other/BerishaAlma_1/test2converter.py diff --git a/Other/BerishaAlma_1/test2converter.py b/Other/BerishaAlma_1/test2converter.py new file mode 100644 index 0000000..2e04e94 --- /dev/null +++ b/Other/BerishaAlma_1/test2converter.py @@ -0,0 +1,37 @@ +import unittest +from abc import ABC, abstractmethod + +class IRomanNumber(ABC): + @abstractmethod + def convert(self, n:int) -> str: + pass + +class RomanNumber(IRomanNumber): + def convert(self, n: int) -> str: + roman_numerals = { + 3: "III", 6: "VI", 8: "VIII", + 12: "XII", 17: "XVII", 29: "XXIX", + 34: "XXXIV", 55: "LV", 101: "CI", + 501: "DI", 1003: "MIII" + } + return roman_numerals.get(n, "") + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_single_value(self): + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(6), "VI") + self.assertEqual(self.converter.convert(8), "VIII") + self.assertEqual(self.converter.convert(12), "XII") + self.assertEqual(self.converter.convert(17), "XVII") + self.assertEqual(self.converter.convert(29), "XXIX") + self.assertEqual(self.converter.convert(34), "XXXIV") + self.assertEqual(self.converter.convert(55), "LV") + self.assertEqual(self.converter.convert(101), "CI") + self.assertEqual(self.converter.convert(501), "DI") + self.assertEqual(self.converter.convert(1003), "MIII") + +if __name__ == "__main__": + unittest.main() \ No newline at end of file -- GitLab From fb9543043d6ac0aae0ad004b111b2737c58c3bc2 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:22:16 +0200 Subject: [PATCH 07/35] Meine Implementierung converter.py --- Other/BerishaAlma_1/converter.py | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Other/BerishaAlma_1/converter.py diff --git a/Other/BerishaAlma_1/converter.py b/Other/BerishaAlma_1/converter.py new file mode 100644 index 0000000..0ef9bd0 --- /dev/null +++ b/Other/BerishaAlma_1/converter.py @@ -0,0 +1,49 @@ +#Bei Eingabe von Zahlen, die in der Liste definiert sind, sollen römische Zhalen zurückgegeben werden. +#Bei Eingabe von Zahlen, die nicht in der Liste definiert ist, soll ein "" ausgeben werden. + +import unittest +from abc import ABC, abstractmethod + +class IRomanNumber(ABC): + @abstractmethod + def convert(self, n:int) -> str: + pass + +class RomanNumber(IRomanNumber): + def convert(self, n: int) -> str: + roman_numerals = { + 1: "I", 2: "II", 3: "III", + 4: "IV", 5: "V", 9: "IX", + 21: "XXI", 50: "L", 100: "C", + 500: "D", 1000: "M" + } + return roman_numerals.get(n, "") + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + + + + +if __name__ == "__main__": + unittest.main() -- GitLab From d6f62983ee9d93326ca3c04b81d99f526193827a Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:23:57 +0200 Subject: [PATCH 08/35] =?UTF-8?q?Implementierung=20von=20BerishaAlma=20mit?= =?UTF-8?q?=20meinen=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/BerishaAlma_1/my_converter.py | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Other/BerishaAlma_1/my_converter.py diff --git a/Other/BerishaAlma_1/my_converter.py b/Other/BerishaAlma_1/my_converter.py new file mode 100644 index 0000000..ada0641 --- /dev/null +++ b/Other/BerishaAlma_1/my_converter.py @@ -0,0 +1,36 @@ +#Umsetzungen von AliciMuhamed auf meinen Testfälle + +import unittest + +from test2 converter import RomanNumber as RomanNumber +from test2 converter import RomanNumber as IRomanNumber + + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, IRomanNumber) + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + +if __name__ == "__main__": + unittest.main() -- GitLab From 9ed71831929b3cddfae2be205fc15a4d6911998a Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:25:18 +0200 Subject: [PATCH 09/35] =?UTF-8?q?Meine=20Implementierung=20mit=20BerishaAl?= =?UTF-8?q?ma=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/BerishaAlma_1/your_converter.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Other/BerishaAlma_1/your_converter.py diff --git a/Other/BerishaAlma_1/your_converter.py b/Other/BerishaAlma_1/your_converter.py new file mode 100644 index 0000000..e760cdc --- /dev/null +++ b/Other/BerishaAlma_1/your_converter.py @@ -0,0 +1,22 @@ +import unittest +from converter import RomanNumber as RomanNumber + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_single_value(self): + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(6), "VI") + self.assertEqual(self.converter.convert(8), "VIII") + self.assertEqual(self.converter.convert(12), "XII") + self.assertEqual(self.converter.convert(17), "XVII") + self.assertEqual(self.converter.convert(29), "XXIX") + self.assertEqual(self.converter.convert(34), "XXXIV") + self.assertEqual(self.converter.convert(55), "LV") + self.assertEqual(self.converter.convert(101), "CI") + self.assertEqual(self.converter.convert(501), "DI") + self.assertEqual(self.converter.convert(1003), "MIII") + +if __name__ == "__main__": + unittest.main() \ No newline at end of file -- GitLab From 079adc39711b28af31703828d569e6d87afcc26c Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:35:50 +0200 Subject: [PATCH 10/35] Meine Implementierung converter.py --- Other/GotsisWasili_1/converter.py | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Other/GotsisWasili_1/converter.py diff --git a/Other/GotsisWasili_1/converter.py b/Other/GotsisWasili_1/converter.py new file mode 100644 index 0000000..0ef9bd0 --- /dev/null +++ b/Other/GotsisWasili_1/converter.py @@ -0,0 +1,49 @@ +#Bei Eingabe von Zahlen, die in der Liste definiert sind, sollen römische Zhalen zurückgegeben werden. +#Bei Eingabe von Zahlen, die nicht in der Liste definiert ist, soll ein "" ausgeben werden. + +import unittest +from abc import ABC, abstractmethod + +class IRomanNumber(ABC): + @abstractmethod + def convert(self, n:int) -> str: + pass + +class RomanNumber(IRomanNumber): + def convert(self, n: int) -> str: + roman_numerals = { + 1: "I", 2: "II", 3: "III", + 4: "IV", 5: "V", 9: "IX", + 21: "XXI", 50: "L", 100: "C", + 500: "D", 1000: "M" + } + return roman_numerals.get(n, "") + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + + + + +if __name__ == "__main__": + unittest.main() -- GitLab From e177c9e7a627a70a290e2b85eb367643e04df4e9 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:39:30 +0200 Subject: [PATCH 11/35] =?UTF-8?q?Implementierung=20von=20GotsisWasili=20mi?= =?UTF-8?q?t=20meinen=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/GotsisWasili_1/TDD_Converter.py | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Other/GotsisWasili_1/TDD_Converter.py diff --git a/Other/GotsisWasili_1/TDD_Converter.py b/Other/GotsisWasili_1/TDD_Converter.py new file mode 100644 index 0000000..36a0518 --- /dev/null +++ b/Other/GotsisWasili_1/TDD_Converter.py @@ -0,0 +1,51 @@ +import unittest +from abc import ABC, abstractmethod + +#Interface für Counter +class IRomanNumber(ABC): + @abstractmethod + def convert_int_to_str(self, n: int) -> str: + pass + +# Implementierung Converter Klasse +class RomanNumber(IRomanNumber): + def convert_int_to_str(self, n: int) -> str: + + #Eingabe anders als int + if not isinstance(n, int): + return "Fehler: Bitte Zahl eingeben" + + #Int Eingabe kleiner gleich 0 + if n <= 0: + return "Integer muss größer als 0 sein" + + # Bekannte Werte umwandeln + roman_convert = {1: "I", 21: "XXI", 1000: "M"} + return roman_convert.get(n) + +# Testklasse (TestConverter) +class TestRomanNumber (unittest.TestCase): + def setUp(self): + self.r = RomanNumber() + + def test_convert_1(self): + self.assertEqual(self.r.convert_int_to_str(1), "I") + + def test_convert_21(self): + self.assertEqual(self.r.convert_int_to_str(21), "XXI") + + def test_convert_empty(self): + self.assertEqual(self.r.convert_int_to_str(None), "Fehler: Bitte Zahl eingeben") + + def test_convert_string(self): + self.assertEqual(self.r.convert_int_to_str("Hello"), "Fehler: Bitte Zahl eingeben") + + def test_convert_downzero(self): + self.assertEqual(self.r.convert_int_to_str(-5), "Integer muss größer als 0 sein") + + def test_convert_downzero(self): + self.assertEqual(self.r.convert_int_to_str(1000), "M") + +if __name__ == "__main__": + unittest.main() + -- GitLab From d019162e4e2e66783eaf16324d40a34a70033a95 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:41:50 +0200 Subject: [PATCH 12/35] =?UTF-8?q?Implementierung=20von=20GotsisWasili=20mi?= =?UTF-8?q?t=20meinen=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/GotsisWasili_1/my_converter.py | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Other/GotsisWasili_1/my_converter.py diff --git a/Other/GotsisWasili_1/my_converter.py b/Other/GotsisWasili_1/my_converter.py new file mode 100644 index 0000000..05dd7ba --- /dev/null +++ b/Other/GotsisWasili_1/my_converter.py @@ -0,0 +1,35 @@ +#Umsetzungen von GotsisWasili auf meine Testfälle + +import unittest + +from TDD_Converter import RomanNumber as RomanNumber +from TDD_Converter import RomanNumber as IRomanNumber + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, IRomanNumber) + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + +if __name__ == "__main__": + unittest.main() -- GitLab From 66469dcc40b1deb92d08e8852aef4f161851353f Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:43:20 +0200 Subject: [PATCH 13/35] =?UTF-8?q?Meine=20Implementierung=20mit=20GotsisWas?= =?UTF-8?q?ili=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/GotsisWasili_1/your_converter.py | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Other/GotsisWasili_1/your_converter.py diff --git a/Other/GotsisWasili_1/your_converter.py b/Other/GotsisWasili_1/your_converter.py new file mode 100644 index 0000000..270b4d0 --- /dev/null +++ b/Other/GotsisWasili_1/your_converter.py @@ -0,0 +1,34 @@ +import unittest +from converter import RomanNumber as RomanNumber +from converter import IRomanNumber + + +# Testklasse (TestConverter) +class TestRomanNumber (unittest.TestCase): + def setUp(self): + self.r = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.r, IRomanNumber) + + def test_convert_1(self): + self.assertEqual(self.r.convert_int_to_str(1), "I") + + def test_convert_21(self): + self.assertEqual(self.r.convert_int_to_str(21), "XXI") + + def test_convert_empty(self): + self.assertEqual(self.r.convert_int_to_str(None), "Fehler: Bitte Zahl eingeben") + + def test_convert_string(self): + self.assertEqual(self.r.convert_int_to_str("Hello"), "Fehler: Bitte Zahl eingeben") + + def test_convert_downzero(self): + self.assertEqual(self.r.convert_int_to_str(-5), "Integer muss größer als 0 sein") + + def test_convert_downzero(self): + self.assertEqual(self.r.convert_int_to_str(1000), "M") + +if __name__ == "__main__": + unittest.main() + -- GitLab From dcd5a64df7c284bf49d3e4c61f502f983a19a6cd Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 01:48:52 +0200 Subject: [PATCH 14/35] Meine Implementierung converter.py --- Other/PikkemaatLasse_1/converter.py | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Other/PikkemaatLasse_1/converter.py diff --git a/Other/PikkemaatLasse_1/converter.py b/Other/PikkemaatLasse_1/converter.py new file mode 100644 index 0000000..0ef9bd0 --- /dev/null +++ b/Other/PikkemaatLasse_1/converter.py @@ -0,0 +1,49 @@ +#Bei Eingabe von Zahlen, die in der Liste definiert sind, sollen römische Zhalen zurückgegeben werden. +#Bei Eingabe von Zahlen, die nicht in der Liste definiert ist, soll ein "" ausgeben werden. + +import unittest +from abc import ABC, abstractmethod + +class IRomanNumber(ABC): + @abstractmethod + def convert(self, n:int) -> str: + pass + +class RomanNumber(IRomanNumber): + def convert(self, n: int) -> str: + roman_numerals = { + 1: "I", 2: "II", 3: "III", + 4: "IV", 5: "V", 9: "IX", + 21: "XXI", 50: "L", 100: "C", + 500: "D", 1000: "M" + } + return roman_numerals.get(n, "") + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + + + + +if __name__ == "__main__": + unittest.main() -- GitLab From ddf830eaa9b81c3dcad0d8d700c01852bece715c Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 08:45:08 +0200 Subject: [PATCH 15/35] Interfaces von PikkemaatLasse --- Other/PikkemaatLasse_1/src/README.md | 93 ++++++++++++++++++ Other/PikkemaatLasse_1/src/Test.py | 2 + Other/PikkemaatLasse_1/src/__init__.py | 0 .../src/__pycache__/__init__.cpython-310.pyc | Bin 0 -> 142 bytes .../src/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 211 bytes .../__pycache__/interfaces.cpython-310.pyc | Bin 0 -> 505 bytes .../__pycache__/interfaces.cpython-312.pyc | Bin 0 -> 613 bytes .../__pycache__/romannumerals.cpython-310.pyc | Bin 0 -> 894 bytes .../__pycache__/romannumerals.cpython-312.pyc | Bin 0 -> 1159 bytes Other/PikkemaatLasse_1/src/calculator.py | 29 ++++++ Other/PikkemaatLasse_1/src/counter.py | 48 +++++++++ Other/PikkemaatLasse_1/src/interfaces.py | 6 ++ Other/PikkemaatLasse_1/src/main.py | 0 Other/PikkemaatLasse_1/src/romannumerals.py | 23 +++++ 14 files changed, 201 insertions(+) create mode 100644 Other/PikkemaatLasse_1/src/README.md create mode 100644 Other/PikkemaatLasse_1/src/Test.py create mode 100644 Other/PikkemaatLasse_1/src/__init__.py create mode 100644 Other/PikkemaatLasse_1/src/__pycache__/__init__.cpython-310.pyc create mode 100644 Other/PikkemaatLasse_1/src/__pycache__/__init__.cpython-312.pyc create mode 100644 Other/PikkemaatLasse_1/src/__pycache__/interfaces.cpython-310.pyc create mode 100644 Other/PikkemaatLasse_1/src/__pycache__/interfaces.cpython-312.pyc create mode 100644 Other/PikkemaatLasse_1/src/__pycache__/romannumerals.cpython-310.pyc create mode 100644 Other/PikkemaatLasse_1/src/__pycache__/romannumerals.cpython-312.pyc create mode 100644 Other/PikkemaatLasse_1/src/calculator.py create mode 100644 Other/PikkemaatLasse_1/src/counter.py create mode 100644 Other/PikkemaatLasse_1/src/interfaces.py create mode 100644 Other/PikkemaatLasse_1/src/main.py create mode 100644 Other/PikkemaatLasse_1/src/romannumerals.py diff --git a/Other/PikkemaatLasse_1/src/README.md b/Other/PikkemaatLasse_1/src/README.md new file mode 100644 index 0000000..e483d0f --- /dev/null +++ b/Other/PikkemaatLasse_1/src/README.md @@ -0,0 +1,93 @@ +# PraxisprojektTechnologiebasierteInnovation + + + +## Getting started + +To make it easy for you to get started with GitLab, here's a list of recommended next steps. + +Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! + +## Add your files + +- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files +- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: + +``` +cd existing_repo +git remote add origin https://gitlab.reutlingen-university.de/Lasse.Pikkemaat/praxisprojekttechnologiebasierteinnovation.git +git branch -M main +git push -uf origin main +``` + +## Integrate with your tools + +- [ ] [Set up project integrations](https://gitlab.reutlingen-university.de/Lasse.Pikkemaat/praxisprojekttechnologiebasierteinnovation/-/settings/integrations) + +## Collaborate with your team + +- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) +- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) +- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) +- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) +- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) + +## Test and Deploy + +Use the built-in continuous integration in GitLab. + +- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) +- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) +- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) +- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) +- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) + +*** + +# Editing this README + +When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. + +## Suggestions for a good README + +Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. + +## Name +Choose a self-explaining name for your project. + +## Description +Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. + +## Badges +On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. + +## Visuals +Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. + +## Installation +Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. + +## Usage +Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. + +## Support +Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. + +## Roadmap +If you have ideas for releases in the future, it is a good idea to list them in the README. + +## Contributing +State if you are open to contributions and what your requirements are for accepting them. + +For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. + +You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. + +## Authors and acknowledgment +Show your appreciation to those who have contributed to the project. + +## License +For open source projects, say how it is licensed. + +## Project status +If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/Other/PikkemaatLasse_1/src/Test.py b/Other/PikkemaatLasse_1/src/Test.py new file mode 100644 index 0000000..903e6d7 --- /dev/null +++ b/Other/PikkemaatLasse_1/src/Test.py @@ -0,0 +1,2 @@ +print("Hello WORLD") +print("test") \ No newline at end of file diff --git a/Other/PikkemaatLasse_1/src/__init__.py b/Other/PikkemaatLasse_1/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Other/PikkemaatLasse_1/src/__pycache__/__init__.cpython-310.pyc b/Other/PikkemaatLasse_1/src/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d4155c6cc3f22b5cdf03255ec978f442867072db GIT binary patch literal 142 zcmd1j<>g`kf(cjdri19mAOaaM0yz#qT+9L_QW%06G#UL?G8BP?5yUS;XRDatlG2pS z(%hJUqQr{K;)0_5tkmoh-~5!+qCA(>vY6tc<e2#Q%)HE!_;|g7%3B;Zx%nxjIjMFa Lql%e;1PcQIlj9)p literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_1/src/__pycache__/__init__.cpython-312.pyc b/Other/PikkemaatLasse_1/src/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d52e19498fdc85fe8aa4a3361ed595bcbaaabd81 GIT binary patch literal 211 zcmX@j%ge<81Z%lJq=V?kAOanHW&w&!XQ*V*Wb|9fP{ah}eFmxdRg`QM6Iz^FR2<`x zSdy8X8XuXNlag7KnH%GhTAW>yUl3zp6d&T^67N`CoSB}No0?Zr9B*J06B2?flnN3w zj`1(aNG*y9$jr`8%}q=!@kuN$PK`H=DK1KmiI30B%PfhH*DI*}#bJ}1pHiBWYFESx UbOIv~7lRldnHd=wi<p5d0LbJ!TL1t6 literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_1/src/__pycache__/interfaces.cpython-310.pyc b/Other/PikkemaatLasse_1/src/__pycache__/interfaces.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95e7981751754055c5e10944cc00468b50941e10 GIT binary patch literal 505 zcmY*Vy-ou$49?FL9Tlw@kl+DWx^!Vf2o;Ki7&sxiolc6<OA3X{r6hNVGSa>b55y9Q ziHTQW!oI4aSh8cspY6}Kolcv8%s)Qw-r)VhU{fLp2B7{Bj3SB_#L$!)mNH5%iDHT` ziQ<|rc*<2YBE8l(AW4q}es(?#T{-rZlX+!yb#GOUxlQ2^3_$$>7)?^DNXj%<RIw#l z&@@sUdPbppb!&|*liFw}3!gK9uLXSyIt2AdSP`h9$vd)$ye=kzm$h*%NHyl?Xn35B zs#;BJlifJ^GW9cOAM|5&ZIyQAg?`Sw%d=@&X*ZF%_WjvB#FZ5eN#F>NLnHRO|DRWX zjY)c~5DQUCqlE}<A&gaZf&PvVPqi#o8HfA3?KQDKiY~@KoP-F!1tunpc4_mMz(u$m d=MGt{dLVS8yxA3dg!p7N`V>#poM)Hpv0o*tY}5b% literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_1/src/__pycache__/interfaces.cpython-312.pyc b/Other/PikkemaatLasse_1/src/__pycache__/interfaces.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f1e7f4f14f8dc3715ac6481cb4ba3ee057810a3 GIT binary patch literal 613 zcmY*VL2DE-82ysWl%d_}K?}WjD0mtVrPiB>P+h16Sw+`_Lm;FxX*=v>rcJVkEfhTL z59qDGL5jb`KOl2a@Z_yBdg;l0GrM2|d3j&H_dQ<nHI7%ouP<vi#~1$miN$h-3(`LF z<O*`gNeP;yMAMWKps)`)okPwPxn{jKWwRg&e_@f(hV8w0*{sV$>x|5tR_>(EvtHOE zT@>vDPp&{gN^(f4VmX<^^`e;uGn%kw{oq}#Wi^^=Wn^iy<?KQQn4k?hpBW@%^cfQb zR+UE$tESqberxO2Wl#ABtBmEZq$@HdJ{DzOm_qZRvJ+RI@||5V9uCExwZ(CzRpqSM z+2!N$|5pkxpYS*CL>d0Jm`s$G(!G|}D)E?GlkuW*${fi|+3nL=6S-O#jDNm)_Zi#E z1}3-o<DcM1G-y46Q4%(h5S7$Qh-Os?UFXvh`9O%XsVw`B!BI0nh!A3gHH4KV;NRE{ z4|Dhy-v3QW7`F^oHagZ1pmvl54U>nNL49xAS=_a~jh^*Eo|}7KNBr)*Zx|uuJ3Rao OFcM$B{|o-;y#E2$GLq8( literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_1/src/__pycache__/romannumerals.cpython-310.pyc b/Other/PikkemaatLasse_1/src/__pycache__/romannumerals.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6197cf9b2af49383222064fa3d7a160c943eea6 GIT binary patch literal 894 zcmY+CPiqrF7{=$%ZkmRqDnt*0uxbVO5~zY25fRcN0UN|ZDNAHoGt*@4?rb}=TW#2Y zn0^31f_U=-c^UB3i@kgDAinR$LORR5^P6X8o_Tj>vR11>pq%{pIX+{AoMC6VIM8_k z)p!sD5i}tw4JaiqiC}`C62T>%^MDCwhxqO}%pyLuYyCG_8mU2%N*yI;gz|EMtroUz z07(KW2v|_TPD#K82P?<6E?eM|i&6vNP<v3#1VT<qn$tNmt2x-r>1SGk*#R}zpyday zz7D#B`j`m!8=WyxoAHuulDF+4n>jPLq@@G%HcDQ)j|q%H{|T9a59;RL(XA5GS{Y1l zZ^ddHy^~&A7~{!UNpBpfsq}(ql6VFLO(CWD>lH$#>y=o|oPLPSXd;!j;T1}F54+v2 zm&9@`mEZDN{0n}_(rutqB-TUx4NjJB0)0VZJ-~AT?w0m|0wlJF_@EMB0o`ASh<LY_ z?g6b<Vjt11#9bh~T+8~1n6agOOMGq{v5A$*BQ=ti$11mt-6$#Kme!f}Yt}I`*$=oX zQp=B{#MZPlMUq<=I)w~YU;r=uJJEN*^v|Q-)8S5Dh`30HuXXe>HitTUFAwtVOh~OZ z<?+zy(NN=i`M=b34o_@7&%#Q?e9cV=4O*vHq1KtR(!>_OzwDF4r#CLWmCnV|0X(C6 z7^*0hVQ3p+m}a6#kegw6R7A;QM6ZK;mF-fviyGVn!Ba9A>ZD04W#IE*4U+D_;Yht7 ejik}|JgdPa3;chLKDPdBvGa30=gO=}+Wa5JLfq#7 literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_1/src/__pycache__/romannumerals.cpython-312.pyc b/Other/PikkemaatLasse_1/src/__pycache__/romannumerals.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8fbaca8987e1e2f9e658eb47bf046adee636b5f1 GIT binary patch literal 1159 zcmY+D&ube;6vyA}?8=TT*+PyL+QzWPCFw%yCe9@erPNp<HKb~3osfzR%T_y)7wxXn zncW1d5|rYDDL$w_z&i9$dMl=v{u`y>kRHU4o_a}cB1$hg_06v3By)KCneTh^X6C)w zKa0gY;P`!J)ci{W_*YFP!#IZVIfMi7z#{>Kq)rHEa2-5t7d*<yA<g3I+Kz4+Pu0XC za(45xcIZa6BxKwTL?esIEIFQx%LoU+piVrfYaZE!I^EGMDvPf##*>{49ZBst{sYYc z#FJ#uCGknz;W3GscybFo{o!%!x1>uvt@S2=Fpy}=2H>wo>MtXk;2FP?p62Cxw5wI& z&RYOBX7A}eT-(*vT0!;;UD`D|MbxQMJ7<t^m(0(}erbPEhc5jbtf^XO>6#xk-7lFL zCPJ9ZkC@qXqYg9c?si}b6u3IS|H~Xe=j~KXBRda#(b#5@dC5#7&%C_0wq^!CYqH2H zTAKd^%Oc6gNV|%(4TaC~&XQD-`iis-#HSu+mt+H}u1LGBa5WWgAia}`3f1e7<Tlc& zRNPdkN-D`MB-IS5Z7Ni?m1I)_wlD7sKN7JUHJGG+6wCZAH%Qnu&fDC|NnNnuuB1^C zN_yW7WR5eD1hF)5k}x@ij`Y#wFr}G}7Y`a&?VEyeVSnVteuFt*_<`qhKeVe%wBq(X z`{JszRjoSfLio)nWKk@fi>vn5)~gaz;${1jc$;ziQ@_<>q3gysTp^fq$rij}bM<H^ z`>)*Fk<)S8NySd(wKusk(N!@-56w65c<znC^3US$x#h>@vqy^`J}R#t71oC{v;C#- zuJpyg`{C=<vGJ%}Jt|b6>Bd}skB(-ce0nc8G?$+NJ+=6-aCYxz|N5}JFj)BU!mv~s zoPSta>gR@~`F`?!p-)E!%vS~rKV2A63?EHHsj^ob;{l*%>2lg}A~$4?BlC_Ew!I`! zTyUJP5;w>^T=n-i;1+)Pd1cfcQlt7QrqJxdSSuTqEJnF&*w$IB&<eJb@w;w=39f#_ rZ0);>PV&8&em~p!1O6U5)XNa3(Tpe|<R7q}=jKVJU;7X6ldk$71idTV literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_1/src/calculator.py b/Other/PikkemaatLasse_1/src/calculator.py new file mode 100644 index 0000000..e799761 --- /dev/null +++ b/Other/PikkemaatLasse_1/src/calculator.py @@ -0,0 +1,29 @@ +#Test1: Addition 2 positiver Zaheln (2+5) erwartetes Ergebnis 8 +#Test2: Addition negativer und positiver Zahl (-1+1) erwartetes Ergebnis 0 +#Test3: Addition (0+0), erwartetes Ergebnis 0 +#Test4: Addition von 2 Dezimalzahlen (2,5+3,5), erwartetes Ergebnis 6 + +from abc import ABC, abstractmethod +class ICalculator(ABC): + @abstractmethod + def add(self, a: float, b: float) -> float: + pass + +class Calculator(ICalculator): + def add(self, a: float, b: float) -> float: + return a + b + +class TestCalculator: + def __init__(self, calculator: ICalculator): + self.calculator = calculator + def test_add(self): + assert self.calculator.add(2,3) == 5, "Fehler falls nicht 5" + assert self.calculator.add(-1,1) == 0, "Fegler falls nich 0" + assert self.calculator.add(0,0) == 0, "Fehler falls nicht 0" + assert self.calculator.add(2.5,3.5) == 6, "Fehler falls nicht 5" + print("Test erfolgreich") + +if __name__ == "__main__": + calc = Calculator() + tester = TestCalculator(calc) + tester.test_add() diff --git a/Other/PikkemaatLasse_1/src/counter.py b/Other/PikkemaatLasse_1/src/counter.py new file mode 100644 index 0000000..00cf9c0 --- /dev/null +++ b/Other/PikkemaatLasse_1/src/counter.py @@ -0,0 +1,48 @@ +#Bei Eingabe des Strings "Decker" liefert die Funktion 3 +#Bei Eingabe eines leeren Stings soll 0 augegeben werden +#Bei Eingabe des Strings "Hallo" ohne E und D soll 0 ausgegeben werden +#Bei Eingabe von dem String "Der Esel" soll Groß-Kleinschreibung (Caseinsensitive) gezählt werden. das Ergebnis ist 4 +#Bei Eingabe des Buchstaben D oder E soll 1 ausgegeben werden + +from abc import ABC,abstractmethod +import unittest + +class ICounter (ABC): + @abstractmethod + def count_ED(self,s): + pass + +class Counter (ICounter): + def count_ED(self, s): + s=s.upper() + return s.count("D")+s.count("E") + +class TestCounter (unittest.TestCase): + def setUp(self): + self.c=Counter() + def test_count_ED_regular (self): + res=self.c.count_ED ("Decker") + self.assertEqual(res,3) + def test_count_ED_empty (self): + res=self.c.count_ED ("") + self.assertEqual(res,0) + def test_count_ED_wo (self): + '''Testet einen String ohne E und D''' + res=self.c.count_ED ("Hallo") + self.assertEqual(res,0) + def test_count_ED_case_insensitive (self): + '''Testet verschiedene Groß- und Kleinschreibungen''' + res=self.c.count_ED ("Der Esel") + self.assertEqual(res,4) + def test_count_ED_single_letetr (self): + '''Testet Eingaben mit nur einem Buchstaben''' + res=self.c.count_ED ('D') + self.assertEqual(res,1) + res=self.c.count_ED ('E') + self.assertEqual (res,1) + res=self.c.count_ED ('d') + self.assertEqual(res,1) + res=self.c.count_ED ('e') + self.assertEqual (res,1) +if __name__=="__main__": + unittest.main() \ No newline at end of file diff --git a/Other/PikkemaatLasse_1/src/interfaces.py b/Other/PikkemaatLasse_1/src/interfaces.py new file mode 100644 index 0000000..fc64573 --- /dev/null +++ b/Other/PikkemaatLasse_1/src/interfaces.py @@ -0,0 +1,6 @@ +from abc import ABC, abstractmethod + +class IRomanNumerals(ABC): + @abstractmethod + def to_roman(self, num): + pass \ No newline at end of file diff --git a/Other/PikkemaatLasse_1/src/main.py b/Other/PikkemaatLasse_1/src/main.py new file mode 100644 index 0000000..e69de29 diff --git a/Other/PikkemaatLasse_1/src/romannumerals.py b/Other/PikkemaatLasse_1/src/romannumerals.py new file mode 100644 index 0000000..3f3eaf1 --- /dev/null +++ b/Other/PikkemaatLasse_1/src/romannumerals.py @@ -0,0 +1,23 @@ +from src.interfaces import IRomanNumerals + + +class RomanNumerals(IRomanNumerals): + def to_roman(self, num): + if not isinstance(num, int): + raise ValueError("Eingabe muss eine ganze Zahl sein") + if num <= 0 or num >= 4000: + raise ValueError("Zahl muss zwischen 1 und 3999 liegen") + + val = [ + (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, numeral) in val: + while num >= value: + result += numeral + num -= value + return result \ No newline at end of file -- GitLab From 83fbc2dcb59a239624d8e47903274877874ea2b1 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 08:49:30 +0200 Subject: [PATCH 16/35] Tests von PikkemaatLasse --- .../tests/test_romannumerals.py | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 Other/PikkemaatLasse_1/tests/test_romannumerals.py diff --git a/Other/PikkemaatLasse_1/tests/test_romannumerals.py b/Other/PikkemaatLasse_1/tests/test_romannumerals.py new file mode 100644 index 0000000..9a774cc --- /dev/null +++ b/Other/PikkemaatLasse_1/tests/test_romannumerals.py @@ -0,0 +1,108 @@ +# Basisfälle +# Bei Eingabe der Zahl 1, erhalte ich das Ergebnis I +# Bei Eingabe der Zahl 5, erhalte ich das Ergebnis V +# Bei Eingabe der Zahl 10, erhalte ich das Ergebnis X +# Bei Eingabe der Zahl 50, erhalte ich das Ergebnis L +# Bei Eingabe der Zahl 100, erhalte ich das Ergebnis C +# Bei Eingabe der Zahl 500, erhalte ich das Ergebnis D +# Bei Eingabe der Zahl 1000, erhalte ich das Ergebnis M +# Substraktionsregel +# Bei Eingabe der Zahl 4, erhalte ich das Ergebnis IV +# Bei Eingabe der Zahl 9, erhalte ich das Ergebnis IX +# Bei Eingabe der Zahl 40, erhalte ich das Ergebnis XL +# Bei Eingabe der Zahl 90, erhalte ich das Ergebnis XC +# Bei Eingabe der Zahl 400, erhalte ich das Ergebnis CD +# Bei Eingabe der Zahl 900, erhalte ich das Ergebnis CM +# Additionsregel +# Bei Eingabe der Zahl 2 erhalte ich das Ergebnis "II" +# Bei Eingabe der Zahl 3 erhalte ich das Ergebnis "III" +# Bei Eingabe der Zahl 6 erhalte ich das Ergebnis "VI" +# Bei Eingabe der Zahl 8 erhalte ich das Ergebnis "VIII" +# Bei Eingabe der Zahl 30 erhalte ich das Ergebnis "XXX" +# Bei Eingabe der Zahl 80 erhalte ich das Ergebnis "LXXX" +# Kombination aus Addition und Subtraktion +# Bei Eingabe der Zahl 14 erhalte ich das Ergebnis "XIV" +# Bei Eingabe der Zahl 19 erhalte ich das Ergebnis "XIX" +# Bei Eingabe der Zahl 29 erhalte ich das Ergebnis "XXIX" +# Bei Eingabe der Zahl 44 erhalte ich das Ergebnis "XLIV" +# Bei Eingabe der Zahl 99 erhalte ich das Ergebnis "XCIX" +# Bei Eingabe der Zahl 444 erhalte ich das Ergebnis "CDXLIV" +# Bei Eingabe der Zahl 999 erhalte ich das Ergebnis "CMXCIX" +# Größere Zahlen +# Bei Eingabe der Zahl 1001 erhalte ich das Ergebnis "MI" +# Bei Eingabe der Zahl 1987 erhalte ich das Ergebnis "MCMLXXXVII" +# Bei Eingabe der Zahl 2023 erhalte ich das Ergebnis "MMXXIII" +# Bei Eingabe der Zahl 3999 erhalte ich das Ergebnis "MMMCMXCIX" +# Fehlerfälle +# Bei Eingabe der Zahl 0 erhalte ich eine Fehlermeldung +# Bei Eingabe der Zahl -1 erhalte ich eine Fehlermeldung +# Bei Eingabe der Zahl 4000 erhalte ich eine Fehlermeldung +# Bei Eingabe der Zeichenfolge "ABC" erhalte ich eine Fehlermeldung +# Bei Eingabe von None erhalte ich eine Fehlermeldung +# Bei Eingabe der Zahl 3.14 erhalte ich eine Fehlermeldung + +import unittest +from src.romannumerals import RomanNumerals + + +class TestRomanNumerals(unittest.TestCase): + def setUp(self): + self.converter = RomanNumerals() + + def test_to_roman_basic(self): + self.assertEqual(self.converter.to_roman(1), "I") + self.assertEqual(self.converter.to_roman(5), "V") + self.assertEqual(self.converter.to_roman(10), "X") + self.assertEqual(self.converter.to_roman(50), "L") + self.assertEqual(self.converter.to_roman(100), "C") + self.assertEqual(self.converter.to_roman(500), "D") + self.assertEqual(self.converter.to_roman(1000), "M") + + def test_to_roman_subtraction(self): + self.assertEqual(self.converter.to_roman(4), "IV") + self.assertEqual(self.converter.to_roman(9), "IX") + self.assertEqual(self.converter.to_roman(40), "XL") + self.assertEqual(self.converter.to_roman(90), "XC") + self.assertEqual(self.converter.to_roman(400), "CD") + self.assertEqual(self.converter.to_roman(900), "CM") + + def test_to_roman_addition(self): + self.assertEqual(self.converter.to_roman(2), "II") + self.assertEqual(self.converter.to_roman(3), "III") + self.assertEqual(self.converter.to_roman(6), "VI") + self.assertEqual(self.converter.to_roman(8), "VIII") + self.assertEqual(self.converter.to_roman(30), "XXX") + self.assertEqual(self.converter.to_roman(80), "LXXX") + + def test_to_roman_mixed(self): + self.assertEqual(self.converter.to_roman(14), "XIV") + self.assertEqual(self.converter.to_roman(19), "XIX") + self.assertEqual(self.converter.to_roman(29), "XXIX") + self.assertEqual(self.converter.to_roman(44), "XLIV") + self.assertEqual(self.converter.to_roman(99), "XCIX") + self.assertEqual(self.converter.to_roman(444), "CDXLIV") + self.assertEqual(self.converter.to_roman(999), "CMXCIX") + + def test_to_roman_large_numbers(self): + self.assertEqual(self.converter.to_roman(1001), "MI") + self.assertEqual(self.converter.to_roman(1987), "MCMLXXXVII") + self.assertEqual(self.converter.to_roman(2023), "MMXXIII") + self.assertEqual(self.converter.to_roman(3999), "MMMCMXCIX") + + def test_to_roman_invalid(self): + with self.assertRaises(ValueError): + self.converter.to_roman(0) + with self.assertRaises(ValueError): + self.converter.to_roman(-1) + with self.assertRaises(ValueError): + self.converter.to_roman(4000) + with self.assertRaises(ValueError): + self.converter.to_roman("ABC") + with self.assertRaises(ValueError): + self.converter.to_roman(None) + with self.assertRaises(ValueError): + self.converter.to_roman(3.14) + + +if __name__ == "__main__": + unittest.main() \ No newline at end of file -- GitLab From 925d8accae56f7d20ac28706d017b329aaee951a Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 08:53:02 +0200 Subject: [PATCH 17/35] =?UTF-8?q?Implementierung=20von=20PikkemaatLasse=20?= =?UTF-8?q?mit=20meinen=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/PikkemaatLasse_1/my_converter.py | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Other/PikkemaatLasse_1/my_converter.py diff --git a/Other/PikkemaatLasse_1/my_converter.py b/Other/PikkemaatLasse_1/my_converter.py new file mode 100644 index 0000000..4ed20d9 --- /dev/null +++ b/Other/PikkemaatLasse_1/my_converter.py @@ -0,0 +1,36 @@ +#Umsetzungen von PikkemaatLasse auf meine Testfälle + +import unittest + +from src.romannumerals import RomanNumerals as RomanNumber +from src.interfaces import IRomanNumerals + + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, IRomanNumerals) + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + +if __name__ == "__main__": + unittest.main() -- GitLab From 1596c4139a062371e6d20ec10f3da8df1beea1d9 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 08:56:17 +0200 Subject: [PATCH 18/35] =?UTF-8?q?Meine=20Implementierung=20mit=20Pikkemaat?= =?UTF-8?q?Lasse=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/PikkemaatLasse_1/your_converter.py | 69 ++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Other/PikkemaatLasse_1/your_converter.py diff --git a/Other/PikkemaatLasse_1/your_converter.py b/Other/PikkemaatLasse_1/your_converter.py new file mode 100644 index 0000000..07ad1bf --- /dev/null +++ b/Other/PikkemaatLasse_1/your_converter.py @@ -0,0 +1,69 @@ +import unittest + +from converter import RomanNumber +from converter import IRomanNumber + +class TestRomanNumerals(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, IRomanNumber) + + def test_to_roman_basic(self): + self.assertEqual(self.converter.to_roman(1), "I") + self.assertEqual(self.converter.to_roman(5), "V") + self.assertEqual(self.converter.to_roman(10), "X") + self.assertEqual(self.converter.to_roman(50), "L") + self.assertEqual(self.converter.to_roman(100), "C") + self.assertEqual(self.converter.to_roman(500), "D") + self.assertEqual(self.converter.to_roman(1000), "M") + + def test_to_roman_subtraction(self): + self.assertEqual(self.converter.to_roman(4), "IV") + self.assertEqual(self.converter.to_roman(9), "IX") + self.assertEqual(self.converter.to_roman(40), "XL") + self.assertEqual(self.converter.to_roman(90), "XC") + self.assertEqual(self.converter.to_roman(400), "CD") + self.assertEqual(self.converter.to_roman(900), "CM") + + def test_to_roman_addition(self): + self.assertEqual(self.converter.to_roman(2), "II") + self.assertEqual(self.converter.to_roman(3), "III") + self.assertEqual(self.converter.to_roman(6), "VI") + self.assertEqual(self.converter.to_roman(8), "VIII") + self.assertEqual(self.converter.to_roman(30), "XXX") + self.assertEqual(self.converter.to_roman(80), "LXXX") + + def test_to_roman_mixed(self): + self.assertEqual(self.converter.to_roman(14), "XIV") + self.assertEqual(self.converter.to_roman(19), "XIX") + self.assertEqual(self.converter.to_roman(29), "XXIX") + self.assertEqual(self.converter.to_roman(44), "XLIV") + self.assertEqual(self.converter.to_roman(99), "XCIX") + self.assertEqual(self.converter.to_roman(444), "CDXLIV") + self.assertEqual(self.converter.to_roman(999), "CMXCIX") + + def test_to_roman_large_numbers(self): + self.assertEqual(self.converter.to_roman(1001), "MI") + self.assertEqual(self.converter.to_roman(1987), "MCMLXXXVII") + self.assertEqual(self.converter.to_roman(2023), "MMXXIII") + self.assertEqual(self.converter.to_roman(3999), "MMMCMXCIX") + + def test_to_roman_invalid(self): + with self.assertRaises(ValueError): + self.converter.to_roman(0) + with self.assertRaises(ValueError): + self.converter.to_roman(-1) + with self.assertRaises(ValueError): + self.converter.to_roman(4000) + with self.assertRaises(ValueError): + self.converter.to_roman("ABC") + with self.assertRaises(ValueError): + self.converter.to_roman(None) + with self.assertRaises(ValueError): + self.converter.to_roman(3.14) + + +if __name__ == "__main__": + unittest.main() \ No newline at end of file -- GitLab From 4866413c6133b63ca8b4fcbafa2712a6e315f6f3 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:04:56 +0200 Subject: [PATCH 19/35] Meine Implementierung converterr.py --- Other/RafehDaniel_1/.gitlab-ci.yml | 13 ++ Other/RafehDaniel_1/README.md | 93 +++++++++ .../__pycache__/converter.cpython-312.pyc | Bin 0 -> 9112 bytes .../__pycache__/converterr.cpython-312.pyc | Bin 0 -> 3771 bytes Other/RafehDaniel_1/converter.py | 182 ++++++++++++++++++ Other/RafehDaniel_1/my_converter.py | 36 ++++ Other/RafehDaniel_1/your_converter.py | 121 ++++++++++++ 7 files changed, 445 insertions(+) create mode 100644 Other/RafehDaniel_1/.gitlab-ci.yml create mode 100644 Other/RafehDaniel_1/README.md create mode 100644 Other/RafehDaniel_1/__pycache__/converter.cpython-312.pyc create mode 100644 Other/RafehDaniel_1/__pycache__/converterr.cpython-312.pyc create mode 100644 Other/RafehDaniel_1/converter.py create mode 100644 Other/RafehDaniel_1/my_converter.py create mode 100644 Other/RafehDaniel_1/your_converter.py diff --git a/Other/RafehDaniel_1/.gitlab-ci.yml b/Other/RafehDaniel_1/.gitlab-ci.yml new file mode 100644 index 0000000..195d65e --- /dev/null +++ b/Other/RafehDaniel_1/.gitlab-ci.yml @@ -0,0 +1,13 @@ +# You can override the included template(s) by including variable overrides +# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings +# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/pipeline/#customization +# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings +# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings +# Note that environment variables can be set in several places +# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence +stages: +- test +sast: + stage: test +include: +- template: Security/SAST.gitlab-ci.yml diff --git a/Other/RafehDaniel_1/README.md b/Other/RafehDaniel_1/README.md new file mode 100644 index 0000000..09a46b8 --- /dev/null +++ b/Other/RafehDaniel_1/README.md @@ -0,0 +1,93 @@ +# Praxisprojekt Technologiebasierte Innovationen + + + +## Getting started + +To make it easy for you to get started with GitLab, here's a list of recommended next steps. + +Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! + +## Add your files + +- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files +- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: + +``` +cd existing_repo +git remote add origin https://gitlab.reutlingen-university.de/Daniel.Rafeh/praxisprojekt-technologiebasierte-innovationen.git +git branch -M main +git push -uf origin main +``` + +## Integrate with your tools + +- [ ] [Set up project integrations](https://gitlab.reutlingen-university.de/Daniel.Rafeh/praxisprojekt-technologiebasierte-innovationen/-/settings/integrations) + +## Collaborate with your team + +- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) +- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) +- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) +- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) +- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) + +## Test and Deploy + +Use the built-in continuous integration in GitLab. + +- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) +- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) +- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) +- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) +- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) + +*** + +# Editing this README + +When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. + +## Suggestions for a good README + +Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. + +## Name +Choose a self-explaining name for your project. + +## Description +Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. + +## Badges +On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. + +## Visuals +Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. + +## Installation +Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. + +## Usage +Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. + +## Support +Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. + +## Roadmap +If you have ideas for releases in the future, it is a good idea to list them in the README. + +## Contributing +State if you are open to contributions and what your requirements are for accepting them. + +For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. + +You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. + +## Authors and acknowledgment +Show your appreciation to those who have contributed to the project. + +## License +For open source projects, say how it is licensed. + +## Project status +If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/Other/RafehDaniel_1/__pycache__/converter.cpython-312.pyc b/Other/RafehDaniel_1/__pycache__/converter.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d63d1bb6e6dbefc3d099d951233eea756723da8 GIT binary patch literal 9112 zcmd5?Urbxq89(=rjSa@(j{|`OV*aJ|mZeGP)NW0(C6E-l;wZsTYSCK8=U^__7k2J- zGFxQJrff~KbfN3EplO?;YMPcs>h?74eUE!d%23f&r6KKQyi5$(3!0RD-|-)8uwCBF zmH3_Sp7Y(~^Zh;FxtG7y)>ad^R%_OyRYwT<C*EW)TZY(t1jIu^36)|bh^-ux;&M=q zD?vpfGI^a)<qn}Llb<N*XM(EewL!0)skvU8=&gcY2P4z2%=~#xj<bq6sB`8;LU@Br zfVUx!DMLQVv=T{5Ny%5ehWCD-Y$+En^;z!lgkkb<#Edg@YL-Sa%%aH&b^>l6!t_Cj zlAz2KDlwJH%r>clKx*~}g7&29vsu-HeY5%v#!bd8MNh;nJ7;Es>k&DBZlF;Io2r;P zNghl7#{?Fo8Z0)+tDx6Fey?{s7Ww-4h{3oqJ`gsw2n)Tf#i+)$_;^1vX3W{S@zZBR zf&Tu`MZ?gddYtK|5juT#JP^q5V%XU`e$|{}eEfQNl1=r8b&bVBXT~Gh<(`^LT2-05 zRKt!Kr!swBToo$iHd%GJHh};=R#}cvNDs$ZC}dTKLh)Ieh#~C?g}$8#$I>Gl#k3Sn zH!TI!&E0UzYY+}0)FRlka2yDu6W|V6u{EyClC5^Jcb!1<sCNUKO@-J!|H1zB<M?EO z;qce++B^oZV>mFI0%lXwW((Scxtuv`39WMnJW^mP6j+$*-(oUTf<|2Pl9@B<lMKb% z&8*jud1)H$xa*?Qlgtd+mdZ2zAitDUq7WP(OSfcdyQMhcd1@D~EhVd*q~LdPk>bkz zt}nw6>wuXY^Kw6V=O`iLaDPj^Wt*4g)tPb7t90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EF(3MS3*2b|A12;!Z_MU*K`3by3S@wxJ^ zAq2xGFlCVlEwUBm3KPGtefJlzZ{Wf%BfNod72z7fFv1AJTL|#Um+%lm7=a?-n;@<s z;2Q%zhais2c%bCpL6}GQ9s*X>{0_o<2tP*n0O0`we&P{6nEu#!4sQ{zz@LG<cgO~O zr*GS^%eJl!hivOc=*dw#eS#7Lg4zWq@CgAIa?hSeO2DXu<O{j`esM3@(?7L|oauGq z>hM1n;$ck>g?!bPBcbExX#@T<Av_V`_(6cH2zG=f!7fVfFnlHw0^-L=OT`Ix$-nJ5 zm;U#M3;gH6Bf+16rdU@bN!omsNOk`pU0bRm)h;w{5oormk4tA3s<#L<Tm90sB%NOv q_{`Ju%+s?)@NWHGg{ZE(sZW)b6}A5Mz<WdAANt|db?9sr;`|>U{uaOh literal 0 HcmV?d00001 diff --git a/Other/RafehDaniel_1/__pycache__/converterr.cpython-312.pyc b/Other/RafehDaniel_1/__pycache__/converterr.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f7644a4d1dc498af3a496f01ec035f7bfe0ec1a GIT binary patch literal 3771 zcmdT{&2Jk;6rb4-d*ja}cG@`5khFznOG!)GLO&3wO)6@Mx*|<Wu`I2&-fimCcFOF! zlA|C6DTrQ>dW#WA_!{Ms6aNGkLQ*9fA*jR!-`v`#Uf{j8y>-(hmB1H9@^5C|y#4LG zkC}b`IT-X2Xk*ilr+@bl@+VGOO>PcqWf&|GgBUbRlGqDbniG;jPE3lF2;^g8h>OIK zOkqWAJd>0hsSHw&DY;VFk$OR@m}Dl<<ZtU-O|PjKU3W(aVZ8zY-QG5(=5VFiQ&OZw zs`@H8PpASHFI*hwA^nzRGd*qRO#9BPk!~tGoom=zFkJ%rBsEA<Fhzr!k|CJ#Z3zsL zS}#a?ijpexKzwpGr{@!e+%1!Fn&%#7+69(R3+>!6MjzB9hq_3XX=0hcrX<VE-ez8q zTBtuX^emS?m%475%t~F>?M&L#KF?&049nzF6Q*_7p1qekF{VvTOl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z$(?ez&uHZP%TP>#<X->0NjJie+g%c6!x%q@3U5JKzDY{|~+c zo&35;?zw7Xg>xk*Do$lN3fWjmBm51GVLijPXL_HL!<l>rvOHs8odi|9H8-+bwr|(O zgK231duIH_4dwkk@@8_^1L36A<Rj(GZUxnQXw*4`j}W#M*jOeq1T2;;EW;MbQ>dbk zJoWhH4{8IVe6~?cp$=B{IX#otG}XtILOx@oZ@8%6N;51qoQl3tvm+f>&`0As+$YX! zu+rla5^USWGv$NEUxW|YCD6e-!}=7UDpE>o3ZdP9kVADzq``+L>jb*GPoe6=V|4;u vJsPEFOZ}U%qieCFbpn&>DIx_P%>63Hwxphg%imo2>dMzwt0IvG98>-Q`TM5+ literal 0 HcmV?d00001 diff --git a/Other/RafehDaniel_1/converter.py b/Other/RafehDaniel_1/converter.py new file mode 100644 index 0000000..1d5eff4 --- /dev/null +++ b/Other/RafehDaniel_1/converter.py @@ -0,0 +1,182 @@ +# Bei Eingabe der Zahl 1 soll "I" ausgegeben werden +# Bei Eingabe der Zahl 2 soll "II" ausgegeben werden +# Bei Eingabe der Zahl 3 soll "III" ausgegeben werden +# Bei Eingabe der Zahl 4 soll "IV" ausgegeben werden +# Bei Eingabe der Zahl 5 soll "V" ausgegeben werden +# Bei Eingabe der Zahl 9 soll "IX" ausgegeben werden +# Bei Eingabe der Zahl 10 soll "X" ausgegeben werden +# Bei Eingabe der Zahl 21 soll "XXI" ausgegeben werden +# Bei Eingabe der Zahl 50 soll "L" ausgegeben werden +# Bei Eingabe der Zahl 100 soll "C" ausgegeben werden +# Bei Eingabe der Zahl 500 soll "D" ausgegeben werden +# Bei Eingabe der Zahl 1000 soll "M" ausgegeben werden +# Bei Eingabe der Zahl 1111 soll "MCXI" ausgegeben werden +# Bei Eingabe der Zahl 99 soll "XCIX" ausgegeben werden +# Bei Eingabe der Zahl 0 soll "Es gibt keine römische Null" ausgegeben werden +# Bei Eingabe der Zahl 40 soll "XL" ausgegeben werden +# Bei Eingabe eines Strings soll "Bitte ganze Zahlen eingeben" ausgegeben werden -> geändert aufgrund der Aufgabenstellung +# Bei Eingabe von Float-Werten (z.B. 4,3) soll "Bitte ganze Zahlen eingeben" ausgegeben werden. +# Bei Eingabe von negativen Werten (z.B. -5) soll "Es sind nur positive Zahlen zum konvertieren erlaubt" ausgegeben werden +# Bei Eingabe der Zahl 2025 soll "MMXXV" ausgegeben werden +# Bei Eingabe von Zeichen wie ! soll "Bitte ganze Zahlen eingeben" ausgegeben werden +# Bei Eingabe mehrerer Zahlen wie 4, 3 soll "Bitte nur eine ganze Zahl eingeben" augegeben werden +# Bei Eingabe größerer Zahlen wie z.B. 4000 soll "MMMM" ausgegeben werden +# Bei Eingabe der Zahl 30 soll "XXX" ausgegeben werden +# Bei Eingabe der Zahl 90 soll "90" ausgegeben werden +# Bei Eingabe eines leeren Strings soll "Bitte ganze Zahlen eingeben" ausgegeben werden + +import unittest +from abc import ABC, abstractmethod + +class IConverter(ABC): + @abstractmethod + def convert(self, num: int) -> str: + pass + +class Converter(IConverter): + def convert(self, num: int) -> str: + + '''Sicherstellen, dass nur eine ganze Zahl eingegeben wurde.''' + if isinstance(num, str) and len(num.split(',')) > 1: + return 'Bitte nur eine ganze Zahl eingeben' + + roman_numbers = [(1000, 'M'), (500, 'D'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I')] + + roman_str = '' + + '''Wenn eine 0 eingegeben wird muss eine Exception folgen''' + if num == 0: + return "Es gibt keine römische Null" + + + '''Sicherstellen, dass keine Zeichen oder Strings eingegeben werden''' + if isinstance(num, int): + + '''Sicherstellen, dass keine negativen Zahlen eingegeben werden''' + if num < 0: + return "Es sind nur positive Zahlen zum konvertieren erlaubt" + + for value, numeral in roman_numbers: + + while num >= value: + roman_str += numeral + num -= value + + return roman_str + else: + return "Bitte ganze Zahlen eingeben" + + +class TestConverter(unittest.TestCase): + def setUp(self): + self.c = Converter() + + def test_convertOne(self): + res = self.c.convert(1) + self.assertEqual(res, 'I') + + def test_convertTwo(self): + res = self.c.convert(2) + self.assertEqual(res, 'II') + + def test_convertThree(self): + res = self.c.convert(3) + self.assertEqual(res, 'III') + + def test_convertFour(self): + res = self.c.convert(4) + self.assertEqual(res, 'IV') + + def test_convertFive(self): + res = self.c.convert(5) + self.assertEqual(res, 'V') + + def test_convertNine(self): + res = self.c.convert(9) + self.assertEqual(res, 'IX') + + def test_convertTen(self): + res = self.c.convert(10) + self.assertEqual(res, 'X') + + def test_convertTwentyTwo(self): + res = self.c.convert(21) + self.assertEqual(res, 'XXI') + + def test_convertFifty(self): + res = self.c.convert(50) + self.assertEqual(res, 'L') + + def test_convertHundred(self): + res = self.c.convert(100) + self.assertEqual(res, 'C') + + def test_convertFiveHundred(self): + res = self.c.convert(500) + self.assertEqual(res, 'D') + + def test_convertThousand(self): + res = self.c.convert(1000) + self.assertEqual(res, 'M') + + def test_convertFourDigit(self): + res = self.c.convert(1111) + self.assertEqual(res, 'MCXI') + + def test_convertNintyNine(self): + res = self.c.convert(99) + self.assertEqual(res, 'XCIX') + + def test_convertZero(self): + res = self.c.convert(0) + self.assertEqual(res, 'Es gibt keine römische Null') + + def test_convertFourty(self): + res = self.c.convert(40) + self.assertEqual(res, 'XL') + + def test_convertString(self): + res = self.c.convert('HUIHIN') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertFloat(self): + res = self.c.convert(4.3) + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertNegative(self): + res = self.c.convert(-4) + self.assertEqual(res, "Es sind nur positive Zahlen zum konvertieren erlaubt") + + def test_convertYear(self): + res = self.c.convert(2025) + self.assertEqual(res, "MMXXV") + + def test_convertSign(self): + res = self.c.convert('!') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertMultipleNum(self): + res = self.c.convert('4, 3') + self.assertEqual(res, "Bitte nur eine ganze Zahl eingeben") + + def test_convertHighNum(self): + res = self.c.convert(4000) + self.assertEqual(res, "MMMM") + + def test_convertThirty(self): + res = self.c.convert(30) + self.assertEqual(res, "XXX") + + def test_convertNinety(self): + res = self.c.convert(90) + self.assertEqual(res, "XC") + + def test_convertEmpty(self): + res = self.c.convert('') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/RafehDaniel_1/my_converter.py b/Other/RafehDaniel_1/my_converter.py new file mode 100644 index 0000000..89df08e --- /dev/null +++ b/Other/RafehDaniel_1/my_converter.py @@ -0,0 +1,36 @@ +#Umsetzungen von RafehDaniel auf meine Testfälle + +import unittest + +from converter import Converter as RomanNumber +from converter import Converter as IConverter + + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, IConverter) + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/RafehDaniel_1/your_converter.py b/Other/RafehDaniel_1/your_converter.py new file mode 100644 index 0000000..3e08cf9 --- /dev/null +++ b/Other/RafehDaniel_1/your_converter.py @@ -0,0 +1,121 @@ +import unittest + +from converterr import RomanNumber +from converterr import IRomanNumber + + +class TestConverter(unittest.TestCase): + def setUp(self): + self.c = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.c, IRomanNumber) + + def test_convertOne(self): + res = self.c.convert(1) + self.assertEqual(res, 'I') + + def test_convertTwo(self): + res = self.c.convert(2) + self.assertEqual(res, 'II') + + def test_convertThree(self): + res = self.c.convert(3) + self.assertEqual(res, 'III') + + def test_convertFour(self): + res = self.c.convert(4) + self.assertEqual(res, 'IV') + + def test_convertFive(self): + res = self.c.convert(5) + self.assertEqual(res, 'V') + + def test_convertNine(self): + res = self.c.convert(9) + self.assertEqual(res, 'IX') + + def test_convertTen(self): + res = self.c.convert(10) + self.assertEqual(res, 'X') + + def test_convertTwentyTwo(self): + res = self.c.convert(21) + self.assertEqual(res, 'XXI') + + def test_convertFifty(self): + res = self.c.convert(50) + self.assertEqual(res, 'L') + + def test_convertHundred(self): + res = self.c.convert(100) + self.assertEqual(res, 'C') + + def test_convertFiveHundred(self): + res = self.c.convert(500) + self.assertEqual(res, 'D') + + def test_convertThousand(self): + res = self.c.convert(1000) + self.assertEqual(res, 'M') + + def test_convertFourDigit(self): + res = self.c.convert(1111) + self.assertEqual(res, 'MCXI') + + def test_convertNintyNine(self): + res = self.c.convert(99) + self.assertEqual(res, 'XCIX') + + def test_convertZero(self): + res = self.c.convert(0) + self.assertEqual(res, 'Es gibt keine römische Null') + + def test_convertFourty(self): + res = self.c.convert(40) + self.assertEqual(res, 'XL') + + def test_convertString(self): + res = self.c.convert('HUIHIN') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertFloat(self): + res = self.c.convert(4.3) + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertNegative(self): + res = self.c.convert(-4) + self.assertEqual(res, "Es sind nur positive Zahlen zum konvertieren erlaubt") + + def test_convertYear(self): + res = self.c.convert(2025) + self.assertEqual(res, "MMXXV") + + def test_convertSign(self): + res = self.c.convert('!') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertMultipleNum(self): + res = self.c.convert('4, 3') + self.assertEqual(res, "Bitte nur eine ganze Zahl eingeben") + + def test_convertHighNum(self): + res = self.c.convert(4000) + self.assertEqual(res, "MMMM") + + def test_convertThirty(self): + res = self.c.convert(30) + self.assertEqual(res, "XXX") + + def test_convertNinety(self): + res = self.c.convert(90) + self.assertEqual(res, "XC") + + def test_convertEmpty(self): + res = self.c.convert('') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + + +if __name__ == "__main__": + unittest.main() -- GitLab From 4833af485688162c3471a5a9a6a5c53b87d6466a Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:13:06 +0200 Subject: [PATCH 20/35] Download Implemetierung von RafehDaniel --- Other/ReafehDaniel_1/converter.py | 182 ++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 Other/ReafehDaniel_1/converter.py diff --git a/Other/ReafehDaniel_1/converter.py b/Other/ReafehDaniel_1/converter.py new file mode 100644 index 0000000..1d5eff4 --- /dev/null +++ b/Other/ReafehDaniel_1/converter.py @@ -0,0 +1,182 @@ +# Bei Eingabe der Zahl 1 soll "I" ausgegeben werden +# Bei Eingabe der Zahl 2 soll "II" ausgegeben werden +# Bei Eingabe der Zahl 3 soll "III" ausgegeben werden +# Bei Eingabe der Zahl 4 soll "IV" ausgegeben werden +# Bei Eingabe der Zahl 5 soll "V" ausgegeben werden +# Bei Eingabe der Zahl 9 soll "IX" ausgegeben werden +# Bei Eingabe der Zahl 10 soll "X" ausgegeben werden +# Bei Eingabe der Zahl 21 soll "XXI" ausgegeben werden +# Bei Eingabe der Zahl 50 soll "L" ausgegeben werden +# Bei Eingabe der Zahl 100 soll "C" ausgegeben werden +# Bei Eingabe der Zahl 500 soll "D" ausgegeben werden +# Bei Eingabe der Zahl 1000 soll "M" ausgegeben werden +# Bei Eingabe der Zahl 1111 soll "MCXI" ausgegeben werden +# Bei Eingabe der Zahl 99 soll "XCIX" ausgegeben werden +# Bei Eingabe der Zahl 0 soll "Es gibt keine römische Null" ausgegeben werden +# Bei Eingabe der Zahl 40 soll "XL" ausgegeben werden +# Bei Eingabe eines Strings soll "Bitte ganze Zahlen eingeben" ausgegeben werden -> geändert aufgrund der Aufgabenstellung +# Bei Eingabe von Float-Werten (z.B. 4,3) soll "Bitte ganze Zahlen eingeben" ausgegeben werden. +# Bei Eingabe von negativen Werten (z.B. -5) soll "Es sind nur positive Zahlen zum konvertieren erlaubt" ausgegeben werden +# Bei Eingabe der Zahl 2025 soll "MMXXV" ausgegeben werden +# Bei Eingabe von Zeichen wie ! soll "Bitte ganze Zahlen eingeben" ausgegeben werden +# Bei Eingabe mehrerer Zahlen wie 4, 3 soll "Bitte nur eine ganze Zahl eingeben" augegeben werden +# Bei Eingabe größerer Zahlen wie z.B. 4000 soll "MMMM" ausgegeben werden +# Bei Eingabe der Zahl 30 soll "XXX" ausgegeben werden +# Bei Eingabe der Zahl 90 soll "90" ausgegeben werden +# Bei Eingabe eines leeren Strings soll "Bitte ganze Zahlen eingeben" ausgegeben werden + +import unittest +from abc import ABC, abstractmethod + +class IConverter(ABC): + @abstractmethod + def convert(self, num: int) -> str: + pass + +class Converter(IConverter): + def convert(self, num: int) -> str: + + '''Sicherstellen, dass nur eine ganze Zahl eingegeben wurde.''' + if isinstance(num, str) and len(num.split(',')) > 1: + return 'Bitte nur eine ganze Zahl eingeben' + + roman_numbers = [(1000, 'M'), (500, 'D'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I')] + + roman_str = '' + + '''Wenn eine 0 eingegeben wird muss eine Exception folgen''' + if num == 0: + return "Es gibt keine römische Null" + + + '''Sicherstellen, dass keine Zeichen oder Strings eingegeben werden''' + if isinstance(num, int): + + '''Sicherstellen, dass keine negativen Zahlen eingegeben werden''' + if num < 0: + return "Es sind nur positive Zahlen zum konvertieren erlaubt" + + for value, numeral in roman_numbers: + + while num >= value: + roman_str += numeral + num -= value + + return roman_str + else: + return "Bitte ganze Zahlen eingeben" + + +class TestConverter(unittest.TestCase): + def setUp(self): + self.c = Converter() + + def test_convertOne(self): + res = self.c.convert(1) + self.assertEqual(res, 'I') + + def test_convertTwo(self): + res = self.c.convert(2) + self.assertEqual(res, 'II') + + def test_convertThree(self): + res = self.c.convert(3) + self.assertEqual(res, 'III') + + def test_convertFour(self): + res = self.c.convert(4) + self.assertEqual(res, 'IV') + + def test_convertFive(self): + res = self.c.convert(5) + self.assertEqual(res, 'V') + + def test_convertNine(self): + res = self.c.convert(9) + self.assertEqual(res, 'IX') + + def test_convertTen(self): + res = self.c.convert(10) + self.assertEqual(res, 'X') + + def test_convertTwentyTwo(self): + res = self.c.convert(21) + self.assertEqual(res, 'XXI') + + def test_convertFifty(self): + res = self.c.convert(50) + self.assertEqual(res, 'L') + + def test_convertHundred(self): + res = self.c.convert(100) + self.assertEqual(res, 'C') + + def test_convertFiveHundred(self): + res = self.c.convert(500) + self.assertEqual(res, 'D') + + def test_convertThousand(self): + res = self.c.convert(1000) + self.assertEqual(res, 'M') + + def test_convertFourDigit(self): + res = self.c.convert(1111) + self.assertEqual(res, 'MCXI') + + def test_convertNintyNine(self): + res = self.c.convert(99) + self.assertEqual(res, 'XCIX') + + def test_convertZero(self): + res = self.c.convert(0) + self.assertEqual(res, 'Es gibt keine römische Null') + + def test_convertFourty(self): + res = self.c.convert(40) + self.assertEqual(res, 'XL') + + def test_convertString(self): + res = self.c.convert('HUIHIN') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertFloat(self): + res = self.c.convert(4.3) + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertNegative(self): + res = self.c.convert(-4) + self.assertEqual(res, "Es sind nur positive Zahlen zum konvertieren erlaubt") + + def test_convertYear(self): + res = self.c.convert(2025) + self.assertEqual(res, "MMXXV") + + def test_convertSign(self): + res = self.c.convert('!') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertMultipleNum(self): + res = self.c.convert('4, 3') + self.assertEqual(res, "Bitte nur eine ganze Zahl eingeben") + + def test_convertHighNum(self): + res = self.c.convert(4000) + self.assertEqual(res, "MMMM") + + def test_convertThirty(self): + res = self.c.convert(30) + self.assertEqual(res, "XXX") + + def test_convertNinety(self): + res = self.c.convert(90) + self.assertEqual(res, "XC") + + def test_convertEmpty(self): + res = self.c.convert('') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + + + +if __name__ == "__main__": + unittest.main() -- GitLab From 6cae913820205c604b1fd20b78a242f8be8e1184 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:16:52 +0200 Subject: [PATCH 21/35] =?UTF-8?q?Implementierung=20von=20RafehDaniel=20mit?= =?UTF-8?q?=20meinen=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/ReafehDaniel_1/my_converter.py | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Other/ReafehDaniel_1/my_converter.py diff --git a/Other/ReafehDaniel_1/my_converter.py b/Other/ReafehDaniel_1/my_converter.py new file mode 100644 index 0000000..89df08e --- /dev/null +++ b/Other/ReafehDaniel_1/my_converter.py @@ -0,0 +1,36 @@ +#Umsetzungen von RafehDaniel auf meine Testfälle + +import unittest + +from converter import Converter as RomanNumber +from converter import Converter as IConverter + + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, IConverter) + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + +if __name__ == "__main__": + unittest.main() -- GitLab From d5f051dc1a08d9bd93adc51cb5bf510afc449a62 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:18:53 +0200 Subject: [PATCH 22/35] =?UTF-8?q?Meine=20Implementierung=20mit=20BerishaAl?= =?UTF-8?q?ma=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/ReafehDaniel_1/your_converter.py | 121 +++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Other/ReafehDaniel_1/your_converter.py diff --git a/Other/ReafehDaniel_1/your_converter.py b/Other/ReafehDaniel_1/your_converter.py new file mode 100644 index 0000000..3e08cf9 --- /dev/null +++ b/Other/ReafehDaniel_1/your_converter.py @@ -0,0 +1,121 @@ +import unittest + +from converterr import RomanNumber +from converterr import IRomanNumber + + +class TestConverter(unittest.TestCase): + def setUp(self): + self.c = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.c, IRomanNumber) + + def test_convertOne(self): + res = self.c.convert(1) + self.assertEqual(res, 'I') + + def test_convertTwo(self): + res = self.c.convert(2) + self.assertEqual(res, 'II') + + def test_convertThree(self): + res = self.c.convert(3) + self.assertEqual(res, 'III') + + def test_convertFour(self): + res = self.c.convert(4) + self.assertEqual(res, 'IV') + + def test_convertFive(self): + res = self.c.convert(5) + self.assertEqual(res, 'V') + + def test_convertNine(self): + res = self.c.convert(9) + self.assertEqual(res, 'IX') + + def test_convertTen(self): + res = self.c.convert(10) + self.assertEqual(res, 'X') + + def test_convertTwentyTwo(self): + res = self.c.convert(21) + self.assertEqual(res, 'XXI') + + def test_convertFifty(self): + res = self.c.convert(50) + self.assertEqual(res, 'L') + + def test_convertHundred(self): + res = self.c.convert(100) + self.assertEqual(res, 'C') + + def test_convertFiveHundred(self): + res = self.c.convert(500) + self.assertEqual(res, 'D') + + def test_convertThousand(self): + res = self.c.convert(1000) + self.assertEqual(res, 'M') + + def test_convertFourDigit(self): + res = self.c.convert(1111) + self.assertEqual(res, 'MCXI') + + def test_convertNintyNine(self): + res = self.c.convert(99) + self.assertEqual(res, 'XCIX') + + def test_convertZero(self): + res = self.c.convert(0) + self.assertEqual(res, 'Es gibt keine römische Null') + + def test_convertFourty(self): + res = self.c.convert(40) + self.assertEqual(res, 'XL') + + def test_convertString(self): + res = self.c.convert('HUIHIN') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertFloat(self): + res = self.c.convert(4.3) + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertNegative(self): + res = self.c.convert(-4) + self.assertEqual(res, "Es sind nur positive Zahlen zum konvertieren erlaubt") + + def test_convertYear(self): + res = self.c.convert(2025) + self.assertEqual(res, "MMXXV") + + def test_convertSign(self): + res = self.c.convert('!') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + def test_convertMultipleNum(self): + res = self.c.convert('4, 3') + self.assertEqual(res, "Bitte nur eine ganze Zahl eingeben") + + def test_convertHighNum(self): + res = self.c.convert(4000) + self.assertEqual(res, "MMMM") + + def test_convertThirty(self): + res = self.c.convert(30) + self.assertEqual(res, "XXX") + + def test_convertNinety(self): + res = self.c.convert(90) + self.assertEqual(res, "XC") + + def test_convertEmpty(self): + res = self.c.convert('') + self.assertEqual(res, "Bitte ganze Zahlen eingeben") + + + +if __name__ == "__main__": + unittest.main() -- GitLab From f5d35e87421e376ba8fd8e429cb2495ed609e917 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:22:57 +0200 Subject: [PATCH 23/35] Meine Implementierung converterr.py --- Other/ReafehDaniel_1/converterr.py | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Other/ReafehDaniel_1/converterr.py diff --git a/Other/ReafehDaniel_1/converterr.py b/Other/ReafehDaniel_1/converterr.py new file mode 100644 index 0000000..0ef9bd0 --- /dev/null +++ b/Other/ReafehDaniel_1/converterr.py @@ -0,0 +1,49 @@ +#Bei Eingabe von Zahlen, die in der Liste definiert sind, sollen römische Zhalen zurückgegeben werden. +#Bei Eingabe von Zahlen, die nicht in der Liste definiert ist, soll ein "" ausgeben werden. + +import unittest +from abc import ABC, abstractmethod + +class IRomanNumber(ABC): + @abstractmethod + def convert(self, n:int) -> str: + pass + +class RomanNumber(IRomanNumber): + def convert(self, n: int) -> str: + roman_numerals = { + 1: "I", 2: "II", 3: "III", + 4: "IV", 5: "V", 9: "IX", + 21: "XXI", 50: "L", 100: "C", + 500: "D", 1000: "M" + } + return roman_numerals.get(n, "") + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + + + + +if __name__ == "__main__": + unittest.main() -- GitLab From 1901316ab95ad1eecd60bfaa419b75c74fcad7e0 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:39:13 +0200 Subject: [PATCH 24/35] Download Implementierung von WeishauptOrlando --- Other/WeishauptOrlando_1/src/Count_ED.py | 8 +++ .../WeishauptOrlando_1/src/RomanConverter.py | 50 +++++++++++++++++ Other/WeishauptOrlando_1/src/__init__.py | 53 +++++++++++++++++++ Other/WeishauptOrlando_1/src/calculator.py | 44 +++++++++++++++ Other/WeishauptOrlando_1/src/interfaces.py | 17 ++++++ 5 files changed, 172 insertions(+) create mode 100644 Other/WeishauptOrlando_1/src/Count_ED.py create mode 100644 Other/WeishauptOrlando_1/src/RomanConverter.py create mode 100644 Other/WeishauptOrlando_1/src/__init__.py create mode 100644 Other/WeishauptOrlando_1/src/calculator.py create mode 100644 Other/WeishauptOrlando_1/src/interfaces.py diff --git a/Other/WeishauptOrlando_1/src/Count_ED.py b/Other/WeishauptOrlando_1/src/Count_ED.py new file mode 100644 index 0000000..3b6973a --- /dev/null +++ b/Other/WeishauptOrlando_1/src/Count_ED.py @@ -0,0 +1,8 @@ +from src.interfaces import ICounter + + +class Counter(ICounter): + def count_ed(self, s: str) -> int: + """Zählt die Anzahl der Buchstaben 'E' und 'D' in einem String (Case-Insensitive).""" + s = s.upper() + return s.count("D") + s.count("E") diff --git a/Other/WeishauptOrlando_1/src/RomanConverter.py b/Other/WeishauptOrlando_1/src/RomanConverter.py new file mode 100644 index 0000000..e45a5e2 --- /dev/null +++ b/Other/WeishauptOrlando_1/src/RomanConverter.py @@ -0,0 +1,50 @@ +from src.interfaces import IRomanConverter + + +def int_to_roman(num: int) -> str: + """Konvertiert eine Dezimalzahl in eine römische Zahl.""" + val = [ + 1000, 900, 500, 400, + 100, 90, 50, 40, + 10, 9, 5, 4, + 1 + ] + syb = [ + "M", "CM", "D", "CD", + "C", "XC", "L", "XL", + "X", "IX", "V", "IV", + "I" + ] + roman_num = '' + i = 0 + while num > 0: + for _ in range(num // val[i]): + roman_num += syb[i] + num -= val[i] + i += 1 + return roman_num + + +class RomanConverter(IRomanConverter): + def roman_to_int(self, s: str) -> int: + """Konvertiert eine römische Zahl (String) in eine Dezimalzahl.""" + roman_values = { + 'I': 1, 'V': 5, 'X': 10, 'L': 50, + 'C': 100, 'D': 500, 'M': 1000 + } + + total = 0 + prev_value = 0 + + # Iteriere über die Zeichen der römischen Zahl von rechts nach links + for char in reversed(s.upper()): + value = roman_values.get(char) + if value is None: + raise ValueError(f"Ungültiges Zeichen '{char}' in der römischen Zahl.") + if value < prev_value: + total -= value + else: + total += value + prev_value = value + + return total diff --git a/Other/WeishauptOrlando_1/src/__init__.py b/Other/WeishauptOrlando_1/src/__init__.py new file mode 100644 index 0000000..1b733ab --- /dev/null +++ b/Other/WeishauptOrlando_1/src/__init__.py @@ -0,0 +1,53 @@ +from src.calculator import Calculator +from src.Count_ED import Counter +from src.RomanConverter import RomanConverter, int_to_roman + +if __name__ == "__main__": + # Erstelle eine Instanz der Calculator-Klasse + calc = Calculator() + + # Eine Liste von Test-Ausdrücken, die überprüft werden sollen + test_expressions = [ + "2+3", # Einfacher Additionstest + "10-4/2", # Test mit Division und Subtraktion + "(3+5)*2", # Komplexerer Ausdruck mit Klammern + "3++5", # Ungültiger Ausdruck (doppelte Operatoren) + "3--5", # Ungültiger Ausdruck (doppelte Operatoren) + "10*/2", # Ungültiger Ausdruck (Operatorenkombinationen) + "5/0", # Division durch Null (Fehler) + "(3+5))", # Ungültiger Ausdruck (zu viele Klammern) + "abc", # Ungültiger Ausdruck (nur Buchstaben) + "-3*-3" # Gültiger Ausdruck mit Vorzeichen + ] + + # Schleife, um alle Test-Ausdrücke zu durchlaufen + for expr in test_expressions: + try: + # Versuche, den Ausdruck zu berechnen und gebe das Ergebnis aus + print(f"Eingabe: '{expr}' → Ausgabe: {calc.calculate(expr)}") + except Exception as e: + # Wenn ein Fehler auftritt, gebe die Fehlermeldung aus + print(f"Eingabe: '{expr}' → Fehler: {e}") +print("______________________________________________________________") +if __name__ == "__main__": + counter = Counter() + test_strings = ["Decker", "", "Hallo", "Der Esel", "D", "E", "d", "e"] + + for string in test_strings: + print(f"Eingabe: '{string}' → Ausgabe: {counter.count_ed(string)}") + +print("______________________________________________________________") + +if __name__ == "__main__": + converter = RomanConverter() + # Test römische Zahl in Dezimalzahl umwandeln + print("Test römische Zahl in Dezimalzahl umwandeln") + print(converter.roman_to_int("MCMXCIV")) # Ausgabe: 1994 + print(converter.roman_to_int("XIV")) # Ausgabe: 14 + print(converter.roman_to_int("CDXLIV")) # Ausgabe: 444 + + # Test Dezimalzahl in römische Zahl umwandeln + print("Test Dezimalzahl in römische Zahl umwand") + print(int_to_roman(1994)) # Ausgabe: MCMXCIV + print(int_to_roman(14)) # Ausgabe: XIV + print(int_to_roman(444)) # Ausgabe: CDXLIV \ No newline at end of file diff --git a/Other/WeishauptOrlando_1/src/calculator.py b/Other/WeishauptOrlando_1/src/calculator.py new file mode 100644 index 0000000..f4b4785 --- /dev/null +++ b/Other/WeishauptOrlando_1/src/calculator.py @@ -0,0 +1,44 @@ +import re +from src.interfaces import ICalculator + + +class Calculator(ICalculator): + """Ein Taschenrechner, der mathematische Ausdrücke berechnet.""" + + def calculate(self, expression: str) -> float: + """Berechnet einen mathematischen Ausdruck als String und überprüft auf ungültige Eingaben.""" + try: + # Entfernt überflüssige Leerzeichen + expression = expression.replace(" ", "") + + # Nur erlaubte Zeichen (Zahlen, Operatoren, Klammern) und Zahlen mit Vorzeichen + if not re.match(r'^[0-9+\-*/().]+$', expression): + raise ValueError("Ungültige Zeichen im Ausdruck.") + + # Überprüfung auf doppelte Operatoren, aber keine Vorzeichen wie -* oder -+ + # Hier wird jetzt auch sichergestellt, dass -3*-3 gültig bleibt + if re.search(r'(?<!\d)[+\-*/]{2,}', expression): # Erfasst auch doppelte Operatoren wie ++, --, **, etc. + raise SyntaxError("Ungültige doppelte Operatoren im Ausdruck.") + + # Sicherstellen, dass Klammern ausgeglichen sind + if expression.count("(") != expression.count(")"): + raise ValueError("Fehlende oder zu viele Klammern.") + + # Sicherstellen, dass der Ausdruck nicht mit einem Operator beginnt oder endet, + # aber das Minuszeichen als Teil der Zahl akzeptiert wird + if re.match(r'^[*/]', expression) or re.match(r'[*/]$', expression): # Weitere Kontrolle + raise ValueError("Der Ausdruck darf nicht mit einem Operator beginnen oder enden.") + + # Evaluierung des mathematischen Ausdrucks mit eval() + result = eval(expression, {"__builtins__": None}, {}) + + # Sicherstellen, dass das Ergebnis numerisch ist + if isinstance(result, (int, float)): + return float(result) + else: + raise ValueError("Ungültiger Ausdruck.") + + except ZeroDivisionError: + raise ZeroDivisionError("Division durch Null ist nicht erlaubt.") + except (SyntaxError, TypeError, NameError) as e: + raise ValueError(f"Ungültiger mathematischer Ausdruck: {str(e)}") diff --git a/Other/WeishauptOrlando_1/src/interfaces.py b/Other/WeishauptOrlando_1/src/interfaces.py new file mode 100644 index 0000000..e9c300f --- /dev/null +++ b/Other/WeishauptOrlando_1/src/interfaces.py @@ -0,0 +1,17 @@ +from abc import ABC, abstractmethod + +class ICounter(ABC): + @abstractmethod + def count_ed(self, s: str) -> int: + """Zählt die Buchstaben 'E' und 'D' in einem String (Case-Insensitive).""" + pass +class IRomanConverter(ABC): + @abstractmethod + def roman_to_int(self, s: str) -> int: + """Konvertiert eine römische Zahl (String) in eine Dezimalzahl.""" + pass + +class ICalculator(ABC): + @abstractmethod + def calculate(self, expression: str) -> float: + pass \ No newline at end of file -- GitLab From 8aa0654955e867f241635ed432f49b1240d848dd Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:51:29 +0200 Subject: [PATCH 25/35] Meine Implementierung converter.py --- Other/WeishauptOrlando_1/converter.py | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Other/WeishauptOrlando_1/converter.py diff --git a/Other/WeishauptOrlando_1/converter.py b/Other/WeishauptOrlando_1/converter.py new file mode 100644 index 0000000..0ef9bd0 --- /dev/null +++ b/Other/WeishauptOrlando_1/converter.py @@ -0,0 +1,49 @@ +#Bei Eingabe von Zahlen, die in der Liste definiert sind, sollen römische Zhalen zurückgegeben werden. +#Bei Eingabe von Zahlen, die nicht in der Liste definiert ist, soll ein "" ausgeben werden. + +import unittest +from abc import ABC, abstractmethod + +class IRomanNumber(ABC): + @abstractmethod + def convert(self, n:int) -> str: + pass + +class RomanNumber(IRomanNumber): + def convert(self, n: int) -> str: + roman_numerals = { + 1: "I", 2: "II", 3: "III", + 4: "IV", 5: "V", 9: "IX", + 21: "XXI", 50: "L", 100: "C", + 500: "D", 1000: "M" + } + return roman_numerals.get(n, "") + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + + + + +if __name__ == "__main__": + unittest.main() -- GitLab From e35403e8c17be433269fedbeb66cccc26503801a Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:53:58 +0200 Subject: [PATCH 26/35] =?UTF-8?q?Implementierung=20von=20WeishauptOrlando?= =?UTF-8?q?=20mit=20meinen=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/WeishauptOrlando_1/my_converter.py | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Other/WeishauptOrlando_1/my_converter.py diff --git a/Other/WeishauptOrlando_1/my_converter.py b/Other/WeishauptOrlando_1/my_converter.py new file mode 100644 index 0000000..ced88c3 --- /dev/null +++ b/Other/WeishauptOrlando_1/my_converter.py @@ -0,0 +1,36 @@ +#Umsetzungen von WeishauptOrlando auf meine Testfälle + +import unittest + +from src.RomanConverter import RomanConverter as RomanNumber +from src.interfaces import IRomanConverter + + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanNumber() + + def test_implements_interface(self): + self.assertIsInstance(self.converter, IRomanConverter) + + def test_single_value(self): + self.assertEqual(self.converter.convert(1), "I") + self.assertEqual(self.converter.convert(2), "II") + self.assertEqual(self.converter.convert(3), "III") + self.assertEqual(self.converter.convert(4), "IV") + self.assertEqual(self.converter.convert(5), "V") + self.assertEqual(self.converter.convert(9), "IX") + self.assertEqual(self.converter.convert(21), "XXI") + self.assertEqual(self.converter.convert(50), "L") + self.assertEqual(self.converter.convert(100), "C") + self.assertEqual(self.converter.convert(500), "D") + self.assertEqual(self.converter.convert(1000), "M") + + def test_inivalid_numbers(self): + self.assertEqual(self.converter.convert(6), "") + self.assertEqual(self.converter.convert(99), "") + self.assertEqual(self.converter.convert(-1), "") + + +if __name__ == "__main__": + unittest.main() -- GitLab From 71c47ff5f8a67c110f4e9585abc34d18af596e8d Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:55:15 +0200 Subject: [PATCH 27/35] =?UTF-8?q?Meine=20Implementierung=20mit=20Weishaupt?= =?UTF-8?q?Orlando=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/WeishauptOrlando_1/your_converter.py | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Other/WeishauptOrlando_1/your_converter.py diff --git a/Other/WeishauptOrlando_1/your_converter.py b/Other/WeishauptOrlando_1/your_converter.py new file mode 100644 index 0000000..593c8b7 --- /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 -- GitLab From 45f38653446c81addf7735829506a16d7a27c896 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 09:57:33 +0200 Subject: [PATCH 28/35] Download Tests von WeishauptOrlando --- .../WeishauptOrlando_1/tests/TestCount_ED.py | 34 ++++++ Other/WeishauptOrlando_1/tests/__init__.py | 0 .../tests/test_calculator.py | 103 ++++++++++++++++++ Other/WeishauptOrlando_1/tests/test_roman.py | 66 +++++++++++ 4 files changed, 203 insertions(+) create mode 100644 Other/WeishauptOrlando_1/tests/TestCount_ED.py create mode 100644 Other/WeishauptOrlando_1/tests/__init__.py create mode 100644 Other/WeishauptOrlando_1/tests/test_calculator.py create mode 100644 Other/WeishauptOrlando_1/tests/test_roman.py diff --git a/Other/WeishauptOrlando_1/tests/TestCount_ED.py b/Other/WeishauptOrlando_1/tests/TestCount_ED.py new file mode 100644 index 0000000..152bccd --- /dev/null +++ b/Other/WeishauptOrlando_1/tests/TestCount_ED.py @@ -0,0 +1,34 @@ +import unittest +import sys +import os + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) +from src.Count_ED import Counter + +class TestCounter(unittest.TestCase): + def setUp(self): + self.c = Counter() + + def test_count_ed_regular(self): + self.assertEqual(self.c.count_ed("Decker"), 3) + + def test_count_ed_empty(self): + self.assertEqual(self.c.count_ed(""), 0) + + def test_count_ed_wo(self): + """Testet einen String ohne E und D""" + self.assertEqual(self.c.count_ed("Hallo"), 0) + + def test_count_ed_case_insensitive(self): + """Testet verschiedene Groß- und Kleinschreibungen""" + self.assertEqual(self.c.count_ed("Der Esel"), 4) + + def test_count_ED_single_letter(self): + """Testet Eingaben mit nur einem Buchstaben""" + self.assertEqual(self.c.count_ed('D'), 1) + self.assertEqual(self.c.count_ed('E'), 1) + self.assertEqual(self.c.count_ed('d'), 1) + self.assertEqual(self.c.count_ed('e'), 1) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/Other/WeishauptOrlando_1/tests/__init__.py b/Other/WeishauptOrlando_1/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Other/WeishauptOrlando_1/tests/test_calculator.py b/Other/WeishauptOrlando_1/tests/test_calculator.py new file mode 100644 index 0000000..a0c7931 --- /dev/null +++ b/Other/WeishauptOrlando_1/tests/test_calculator.py @@ -0,0 +1,103 @@ +# Testfälle für calculate(), Eingabe: str, Ausgabe: float/int + +# 1ï¸âƒ£ Additionstests +# Eingabe: "1+1" → Erwartete Ausgabe: 2 +# Eingabe: "10+20" → Erwartete Ausgabe: 30 +# Eingabe: "0+5" → Erwartete Ausgabe: 5 +# Eingabe: "-3+7" → Erwartete Ausgabe: 4 +# Eingabe: "2.5+2.5" → Erwartete Ausgabe: 5.0 + +# 2ï¸âƒ£ Subtraktionstests +# Eingabe: "5-3" → Erwartete Ausgabe: 2 +# Eingabe: "10-20" → Erwartete Ausgabe: -10 +# Eingabe: "0-5" → Erwartete Ausgabe: -5 +# Eingabe: "-3-7" → Erwartete Ausgabe: -10 +# Eingabe: "2.5-1.5" → Erwartete Ausgabe: 1.0 + +# 3ï¸âƒ£ Multiplikationstests +# Eingabe: "2*3" → Erwartete Ausgabe: 6 +# Eingabe: "10*0" → Erwartete Ausgabe: 0 +# Eingabe: "-2*5" → Erwartete Ausgabe: -10 +# Eingabe: "3.5*2" → Erwartete Ausgabe: 7.0 +# Eingabe: "-3*-3" → Erwartete Ausgabe: 9 + +# 4ï¸âƒ£ Divisionstests +# Eingabe: "10/2" → Erwartete Ausgabe: 5 +# Eingabe: "5/2" → Erwartete Ausgabe: 2.5 +# Eingabe: "-6/3" → Erwartete Ausgabe: -2 +# Eingabe: "7.5/2.5" → Erwartete Ausgabe: 3.0 +# Eingabe: "5/0" → Erwartete Ausgabe: ZeroDivisionError (Fehlermeldung) + +# 5ï¸âƒ£ Komplexe Berechnungen +# Eingabe: "3+5*2" → Erwartete Ausgabe: 13 (Multiplikation vor Addition) +# Eingabe: "(3+5)*2" → Erwartete Ausgabe: 16 (Klammer zuerst) +# Eingabe: "10-4/2" → Erwartete Ausgabe: 8 (Division vor Subtraktion) +# Eingabe: "3+(2*5)-8/4" → Erwartete Ausgabe: 10 (Mehrere Operatoren) + +# 6ï¸âƒ£ Ungültige Eingaben +# Eingabe: "3++5" → Erwartete Ausgabe: SyntaxError (Fehlermeldung) +# Eingabe: "10*/2" → Erwartete Ausgabe: SyntaxError (Fehlermeldung) +# Eingabe: "abc" → Erwartete Ausgabe: ValueError (Fehlermeldung) + + +import unittest +from src.calculator import Calculator + +class TestCalculator(unittest.TestCase): + def setUp(self): + self.calc = Calculator() + + # Addition + def test_addition(self): + self.assertEqual(self.calc.calculate("1+1"), 2) + self.assertEqual(self.calc.calculate("10+20"), 30) + self.assertEqual(self.calc.calculate("0+5"), 5) + self.assertEqual(self.calc.calculate("-3+7"), 4) + self.assertEqual(self.calc.calculate("2.5+2.5"), 5.0) + + # Subtraktion + def test_subtraction(self): + self.assertEqual(self.calc.calculate("5-3"), 2) + self.assertEqual(self.calc.calculate("10-20"), -10) + self.assertEqual(self.calc.calculate("0-5"), -5) + self.assertEqual(self.calc.calculate("-3-7"), -10) + self.assertEqual(self.calc.calculate("2.5-1.5"), 1.0) + + # Multiplikation + def test_multiplication(self): + self.assertEqual(self.calc.calculate("2*3"), 6) + self.assertEqual(self.calc.calculate("10*0"), 0) + self.assertEqual(self.calc.calculate("-2*5"), -10) + self.assertEqual(self.calc.calculate("3.5*2"), 7.0) + self.assertEqual(self.calc.calculate("-3*-3"), 9) + + # Division + def test_division(self): + self.assertEqual(self.calc.calculate("10/2"), 5) + self.assertEqual(self.calc.calculate("5/2"), 2.5) + self.assertEqual(self.calc.calculate("-6/3"), -2) + self.assertEqual(self.calc.calculate("7.5/2.5"), 3.0) + + # Division durch Null + def test_division_by_zero(self): + with self.assertRaises(ZeroDivisionError): + self.calc.calculate("5/0") + + # Komplexe Berechnungen + def test_complex_expressions(self): + self.assertEqual(self.calc.calculate("3+5*2"), 13) # Punkt-vor-Strich beachten + self.assertEqual(self.calc.calculate("(3+5)*2"), 16) # Klammer zuerst + self.assertEqual(self.calc.calculate("10-4/2"), 8) # Division vor Subtraktion + self.assertEqual(self.calc.calculate("3+(2*5)-8/4"), 11.0) # 11 + + # Ungültige Eingaben + def test_invalid_expressions(self): + with self.assertRaises(ValueError): + self.calc.calculate("3++5") + with self.assertRaises(ValueError): + self.calc.calculate("10*/2") + with self.assertRaises(ValueError): + self.calc.calculate("abc") + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/Other/WeishauptOrlando_1/tests/test_roman.py b/Other/WeishauptOrlando_1/tests/test_roman.py new file mode 100644 index 0000000..30cbabf --- /dev/null +++ b/Other/WeishauptOrlando_1/tests/test_roman.py @@ -0,0 +1,66 @@ +# Testfälle roman_to_int, str -> int + +# 1. Einzelne römische Ziffern +# Eingabe: "I" → Erwartete Ausgabe: 1 +# Eingabe: "V" → Erwartete Ausgabe: 5 +# Eingabe: "X" → Erwartete Ausgabe: 10 +# Eingabe: "L" → Erwartete Ausgabe: 50 +# Eingabe: "C" → Erwartete Ausgabe: 100 +# Eingabe: "D" → Erwartete Ausgabe: 500 +# Eingabe: "M" → Erwartete Ausgabe: 1000 + +#2. Mehrere gleiche Ziffern hintereinander (einfache Addition) +# Eingabe: "II" → Erwartete Ausgabe: 2 +# Eingabe: "XX" → Erwartete Ausgabe: 20 +# Eingabe: "CC" → Erwartete Ausgabe: 200 +# Eingabe: "MM" → Erwartete Ausgabe: 2000 + +#3. Subtraktive Notation +# Eingabe: "IV" → Erwartete Ausgabe: 4 +# Eingabe: "IX" → Erwartete Ausgabe: 9 +# Eingabe: "XL" → Erwartete Ausgabe: 40 +# Eingabe: "XC" → Erwartete Ausgabe: 90 +# Eingabe: "CD" → Erwartete Ausgabe: 400 +# Eingabe: "CM" → Erwartete Ausgabe: 900 + +#4. Komplexe Zahlen +# Eingabe: "MCMXCIV" → Erwartete Ausgabe: 1994 +#Eingabe: "XIV" → Erwartete Ausgabe: 14 +#Eingabe: "CDXLIV" → Erwartete Ausgabe: 444 + + +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 src.RomanConverter import RomanConverter # Importiere die zu testende Klasse + +class TestRomanConverter(unittest.TestCase): + def setUp(self): + self.converter = RomanConverter() + + 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 -- GitLab From 736b60d8b146d5dbed2867bd429b17bba3646713 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 19:23:01 +0200 Subject: [PATCH 29/35] Meine Implementierung stringCalculator.py --- Other/AliciMuhamed_2/stringCalculator.py | 88 ++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Other/AliciMuhamed_2/stringCalculator.py diff --git a/Other/AliciMuhamed_2/stringCalculator.py b/Other/AliciMuhamed_2/stringCalculator.py new file mode 100644 index 0000000..bd21dc8 --- /dev/null +++ b/Other/AliciMuhamed_2/stringCalculator.py @@ -0,0 +1,88 @@ +from abc import ABC, abstractmethod +import unittest + +class IStringCalculator(ABC): + @abstractmethod + def add(self, numbers: str) -> int: + pass + +class StringCalculator(IStringCalculator): + def add(self, numbers: str) -> int: + if not numbers: + return 0 + + # Überprüfe, ob ein benutzerdefiniertes Trennzeichen angegeben ist + if numbers.startswith("//"): + delimiter_line_end = numbers.find("\n") + delimiter = numbers[2:delimiter_line_end] # Extrahiere das Trennzeichen + numbers = numbers[delimiter_line_end + 1:] # Entferne die erste Zeile mit dem Trennzeichen + else: + delimiter = ',' # Standard-Trennzeichen ist Komma + + # Ersetze alle Vorkommen des Trennzeichens und teile die Eingabe + numbers = numbers.replace("\n", delimiter) + nums = numbers.split(delimiter) + + # Filtere alle Zahlen, die größer als 1000 sind + nums = [int(num) for num in nums if int(num) <= 1000] + + # Prüfe auf negative Zahlen + negatives = [num for num in nums if num < 0] + + if negatives: + # Wenn negative Zahlen vorhanden sind, werfe eine Ausnahme + raise ValueError(f"Negatives not allowed: {', '.join(map(str, negatives))}") + + # Berechne die Summe der Zahlen, die <= 1000 sind + return sum(nums) + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() -- GitLab From 0e842cf6619901489540c36371fe46f7cf701d34 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 19:32:42 +0200 Subject: [PATCH 30/35] =?UTF-8?q?Implementierung=20von=20AliciMuhamed=20mi?= =?UTF-8?q?t=20meinen=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/AliciMuhamed_2/my_calculator.py | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Other/AliciMuhamed_2/my_calculator.py diff --git a/Other/AliciMuhamed_2/my_calculator.py b/Other/AliciMuhamed_2/my_calculator.py new file mode 100644 index 0000000..0d6c003 --- /dev/null +++ b/Other/AliciMuhamed_2/my_calculator.py @@ -0,0 +1,58 @@ +#Implementierung von AliciMuhamed auf meinen Testfälle: StringCalculator +import unittest + +from string calculator import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() -- GitLab From 7106ca9e985d0bf9ce983175697ebf016e6e3f1e Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 19:34:51 +0200 Subject: [PATCH 31/35] =?UTF-8?q?Meine=20Implementierung=20mit=20AliciMUha?= =?UTF-8?q?med=20Testf=C3=A4llen=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Other/AliciMuhamed_2/your_calculator.py | 71 +++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Other/AliciMuhamed_2/your_calculator.py diff --git a/Other/AliciMuhamed_2/your_calculator.py b/Other/AliciMuhamed_2/your_calculator.py new file mode 100644 index 0000000..0c826a8 --- /dev/null +++ b/Other/AliciMuhamed_2/your_calculator.py @@ -0,0 +1,71 @@ +#Meine Implementierungen auf Testfälle anderer Studierenden testen: StringCalculator + + +import unittest +from stringCalculator import StringCalculator + + +class TestStingCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) #leerer string + 0 + def test_single_number(self): + self.assertEqual(self.calculator.add("5"),5) #eingabe von einem String + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("5,5"),10)#eingabe mehrere strings + def test_unknowen_amount_of_numbers(self): + self.assertEqual(self.calculator.add("1,2,3"),6) + self.assertEqual(self.calculator.add("10,20,30,40"),100) + self.assertEqual(self.calculator.add("1,2,3,4,5,6"),21) + def test_numbers_seperated_by_newline(self): + self.assertEqual(self.calculator.add("1\n2"),3) + self.assertEqual(self.calculator.add("1\n2\n3"),6) + self.assertEqual(self.calculator.add("10,20\n30"),60) + + def test_negative_number_exception(self): + + with self.assertRaises(ValueError) as e: + self.calculator.add("-1,2") + self.assertEqual(str(e.exception), "negatives not allowed: -1") + def test_multiple_negative_numbers_exception(self): + with self.assertRaises(ValueError)as e: + self.calculator.add("-1,-2,3") + self.assertEqual(str(e.exception),"negatives not allowed: -1,-2") + with self.assertRaises(ValueError) as e: + self.calculator.add("-1,-3,4") + self.assertEqual(str(e.exception),"negatives not allowed: -1,-3") + + with self.assertRaises(ValueError) as e: + self.calculator.add("-1\n-3,4") + self.assertEqual(str(e.exception),"negatives not allowed: -1,-3") + def test_add_numbers_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2;3"),6) + self.assertEqual(self.calculator.add("//;\n1,2,3"),6) + with self.assertRaises(ValueError) as e: + self.calculator.add("//;\n-3,4") + self.assertEqual(str(e.exception),"negatives not allowed: -3") + + def test_add_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("1,1001,2,3"),6) + def test_add_numbers_greater_than_1000_1002(self): + self.assertEqual(self.calculator.add("1002,1,2,3"),6) + def test_add_numbers_greater_1000_and_minus(self): + with self.assertRaises(ValueError) as e: + self.calculator.add("//;\n-3,4;1001") + self.assertEqual(str(e.exception),"negatives not allowed: -3") + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//[***]\n1***2***3"),6) + def test_custom_del(self): + self.assertEqual(self.calculator.add("//[+++]\n1+++2+++3"),6) + def test_custom_del2(self): + self.assertEqual(self.calculator.add("//[aa]\n1aa2aa3"),6) + + + +if __name__=='__main__': + unittest.main() \ No newline at end of file -- GitLab From 69ce89092b7e0d7b00e3b54fd8cce92f83729c5d Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sun, 6 Apr 2025 02:42:11 +0200 Subject: [PATCH 32/35] Implemetierung stringCalculator von AliciMuhamed testen --- .../__pycache__/Feature1.cpython-312.pyc | Bin 0 -> 2726 bytes .../stringCalculator.cpython-312.pyc | Bin 0 -> 2448 bytes .../stringCalculatorr.cpython-312.pyc | Bin 0 -> 6649 bytes BerishaAlma_2/my_calculator.py | 58 +++++++++++ BerishaAlma_2/stringCalculatorr.py | 90 ++++++++++++++++++ BerishaAlma_2/your_calculator.py | 0 6 files changed, 148 insertions(+) create mode 100644 BerishaAlma_2/__pycache__/Feature1.cpython-312.pyc create mode 100644 BerishaAlma_2/__pycache__/stringCalculator.cpython-312.pyc create mode 100644 BerishaAlma_2/__pycache__/stringCalculatorr.cpython-312.pyc create mode 100644 BerishaAlma_2/my_calculator.py create mode 100644 BerishaAlma_2/stringCalculatorr.py create mode 100644 BerishaAlma_2/your_calculator.py diff --git a/BerishaAlma_2/__pycache__/Feature1.cpython-312.pyc b/BerishaAlma_2/__pycache__/Feature1.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3270fcd902f81a4cc08bb171eabee1cce9c36aa1 GIT binary patch literal 2726 zcmc&$%}*Og6rb5$o5k3e50k_YHKZsXrY^-eG-*{OBG4v1;Isv#*0r=+yc;lhjXSee zWs3uqsG3V}kszmV4C2DE|3faJ7J_agwNg*qT+E46-y46#IM5s!$-kL-^JZp$?`!<h z=kpL~Qd?;*BNOruPHN3n9h5g<utp4G&@{1VoLW*`qBxh*a$J_k17gUl#86DS1!rK3 zD?;i5soPZQQkRgnfK)Z*1#d;S5$l>QrfRe<-Xw%|Nd$De8nr6pt*VHUyp)$ho&%hR zBu5^*Kkl^av)pES(zZ-{e#wX>tIDFQ6T1%6HDZ!DHAq}CWrLcEA(^hn3J_9i7sTCp zCFF8CznrpJDl<2(r<1v~ZZ9#XC6lveO~xHJGwmG9B&Eh{V2tJ{E8><s*`%>evMD(V zH`9+<3rIQY_xB$!CO=Kga5yOOP`6V_Q~NHJHc~8QB_>S1XfI_G!z0@C#Dq4+d1@|W znHigF!y}35=|+)>!f4`=J#VtaeUqj5ygrt;bZsQ@g{i~$nUSGv-jQ{~DD=EVW(dS+ z7>=+){#LzZ7?4<~#Zfgaqg$q?IUY^3mW*5)$6ihQA*ZJ+D-20GGT7XaQyH82VanPN zIuP0s+%-U5{yxAe*>`o9B<k|5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cpython-312.pyc b/BerishaAlma_2/__pycache__/stringCalculator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f1c175d3824110b577dc877f78e2021bcf81f11 GIT binary patch literal 2448 zcmc&#%}*Og6rb4-voUtehx1_)HKa5jZe5CT(xR%WL`aqN0BH+I?aI<>@ovDxYuuT& zDq9?=MAck+iv&4^V-Oeqk6uD81l>kzrJlIC*e6bXZ`O8fhbYI4v~OnKyqVeG`@Q$( z_i#8!ph>;eMMWm$Uz{|X+8ETfV6Z_fV$mFNs7@V8mnhDqoUF?dxkoH{omh%Zci;?c zx+1hHXaly=(yBt+16s|NmqWg7yKGtZ*qU|b(M>|wfJDG{pxw$J?=)1Dl%$dr4<6w> zE_w3gohk3Exxig!W?aX1msYHqOv6}oEnwGSx<PEBQ;X=5EnC!9EXh_MDga1nUZ4j` zN?i5&zn*njHorJ!<}$^c>8>!ZCtq|HY{tC+v)v-gXQcLPV2tjlDdLtA*`_nwWLxqS zZs#7d9?){MA09s8na|Vn91cp~H{EQ;Hh#$FtSrkq>AN<6<gOIbW8=o$-Mhvl=h?-) zW9MCNjE$$~=Gs*@DpTnP?vl;YcWjpBOXg(GF^%yw_@d*_M++rSHZ7}s?ln-OphgFA z6l>%kEmVU6nThv!nqlNk$2JTvXc*3lRm|ZyWEejd&78l&5UeM|eV&}nyDS1z){CMK z#aR@Ara)W%K8SU4s18;os)jdHRRY~s>KMD4OajsWQ15TYogGZ#3D|0vLA+uTc$9%h z#ph911%G|r^a%=>20J@=Lxte&dvWF}<+May3KP*>T=PfG+sP_jMmoEiCG9kJ?KI+| zIiDqQd4{3#geKw&_^ar6vSSw5Ina43FXXZ=!~AGOi0?RbW;xmo0|~<<<|821$e)q( zhlA0Vk%1?vCw%kXv+1YP&qpekM=OJ$R3c+9v@zkznRtNpgFVB<VuL86DDeJMNxOgx zD9*sg(QKVmC0R`(W6*7->e%@_p<M@0P4Cq{fR%Qh)`<>Gfy9g>x@svP10^*c@S<}z zce}x6nkT_I1RW@t!Wh~huQ+OE?kX`__9ep5OL0k{@Pe6E8gEk;h82#c!@|?RfbGr~ z%0s99!l+ooaOTL+8hJVNVPz=sSotj?(0BYICXx6>9R?d@l`OY@2o#M5+D3phHP|mV z%T$}vqRkM3;A-rF`iJ4<5fM<^ve#>Js3q=Kn3Zf8cKd{0g;6`kei!^}*iOMM8IZ3~ zAIjHH#rv8ah6~5z*2tk2I?yieX%{!6&#pYZau7@G#S+iItHj23ukLHN-l;=q@(7*H zuA%5gKOj(XKn+FAFXQDKZ-(Dtc>ZnpXDhMfZgO9{{VwsB<z!;~2!ro*5A+ESxIe8l z;PdjeH{)+Ji@go~d?l9J{dQmbOrVE{qr1{zy0RN6K0+~yqU()#4|OQ8=5ciRIyr`i z;N#-}Rd1vCv<6~ATp<kcb#lyX-Z0`pc-s~-Oh8v)tEUz7Sr_5@Zx5CyPeZU%CS;1Z z3yYzr-~nB~a-x0VKXqTSTVR6`#lHbjl_{lvlaaqjq^`&`yeUHgq~Ur{p~)8)Zq^C( u^-wRJ*qk`Hl-RqJs1uk}hlmn-T>e9j9V-26_kW%KdHR<JRhcM50?Gg6yYd(S literal 0 HcmV?d00001 diff --git a/BerishaAlma_2/__pycache__/stringCalculatorr.cpython-312.pyc b/BerishaAlma_2/__pycache__/stringCalculatorr.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5047f7559a0813d308e85fae57458ace61d9a67f GIT binary patch literal 6649 zcmd^DT~Hg>6~6l?t%PLpX9r<^WV?wiTLL5jb`1W(IAgmL<Je%wR!KIpc8z6Ag6=NG z(uk?sai)0cj+0JX(`h=TPc=iQL!Zj4GkNGtUqodJ-FBwwv=8B_1enQ$r=GJb$w)}J zc?l1_44>|vJ@@WCKlhw-@1N{;D}i>y@%hkyY=ry^A99V$cGjk#^Mr^*q@pB71*sSv zq$zx+qfC&Y$vGl24~WQ0)C^;c39>qs1FA`4^Hff!nt{qo%pLe%am#a>C0?}LJw%9H zO%vd)F6Ja;CQG77f=<w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39ZJ)auczt*sNwnEKi2lqB+ zE@V9cA5^XaKz_7WE!vyr?M)vgGxo!9;IkZlI<#b~e0=HQrA1rwysdePe{OSs!N3bR ze;T>;qngRL7aLpV8(T8Y*0k@<1^(g}95Cp^H`egv@w0{=7xT=;^|;Li^~V2=TR?aR zx9~!MPd1kI43Enjkk6v|&!I_hH@LDDUXyO)O<U49E9G-xpuDxq4myJ$DQ9<YvE3`4 z+dOD@Z#lcawZLCSyL-{@-VOPiFnxiszrNx!X>M)pviiFG@-bLM>3YJ*rQuOU9gYe4 zL*I6}w3t^n(sr36m~kGPgSxVNYdriKbz#Zs!WxiImet07-M@+@EKICN%lp{21JMz- z&9LueoLzHJft}h>Jyo=}rmVh{KNU!|FXP#(wBH=rMpG}gnsNP@JpENwRy@N+SjV>2 z>$@3e_uS0|zGp{uXYzY|ZEZf;SypXE0Lv9%L$VaYYZvu)C@#Rrw&XSetn8q-@N1_L zuw>q;SYyTg<?nil{O!8iloiF;X~o+pd7-@je8s8yQB9X~y6SUR72n0+DNzm}bRxWt z(2Z~k0ds|X0pU%AJ_KF;1K7KUa2)}Yy>1QTZtO5VA{>N&1xGy~t8i=VT{Tf$2SO*p zF@#eHT?oC@s)^zHs8uV&T>+%H6G%P{WQseZW7nEaFg}GJz$@@rC=wS0xGZEsH^Z`i zl*GzW<45BW74>giaN|{x#-nC?LvZt;udxzoEKX1)!Uo@M+^3(E-vu752Nl%i3PVxU zKgfZ<5yv{qQ1(e?oxsn!wSjV`Upcf+;CH>-OP!`Bk1g)?%<uKA6MR~Ek0PvXBKc>= Yxx`l8KmUV^-@Ew!r4@#-^|~<s1(#ERHUIzs literal 0 HcmV?d00001 diff --git a/BerishaAlma_2/my_calculator.py b/BerishaAlma_2/my_calculator.py new file mode 100644 index 0000000..8ac359b --- /dev/null +++ b/BerishaAlma_2/my_calculator.py @@ -0,0 +1,58 @@ +#Implementierung von BerishaAlma auf meinen Testfälle: StringCalculator +import unittest + +from stringCalculatorr import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/BerishaAlma_2/stringCalculatorr.py b/BerishaAlma_2/stringCalculatorr.py new file mode 100644 index 0000000..02d9bb4 --- /dev/null +++ b/BerishaAlma_2/stringCalculatorr.py @@ -0,0 +1,90 @@ +#Implementierung Aufgabe 02 von BerishaAlma und YildirimHatice + +from abc import ABC, abstractmethod +import unittest + +class IStringCalculator(ABC): + @abstractmethod + def add(self, numbers: str) -> int: + pass + +class StringCalculator(IStringCalculator): + def add(self, numbers: str) -> int: + if not numbers: + return 0 + + # Überprüfe, ob ein benutzerdefiniertes Trennzeichen angegeben ist + if numbers.startswith("//"): + delimiter_line_end = numbers.find("\n") + delimiter = numbers[2:delimiter_line_end] # Extrahiere das Trennzeichen + numbers = numbers[delimiter_line_end + 1:] # Entferne die erste Zeile mit dem Trennzeichen + else: + delimiter = ',' # Standard-Trennzeichen ist Komma + + # Ersetze alle Vorkommen des Trennzeichens und teile die Eingabe + numbers = numbers.replace("\n", delimiter) + nums = numbers.split(delimiter) + + # Filtere alle Zahlen, die größer als 1000 sind + nums = [int(num) for num in nums if int(num) <= 1000] + + # Prüfe auf negative Zahlen + negatives = [num for num in nums if num < 0] + + if negatives: + # Wenn negative Zahlen vorhanden sind, werfe eine Ausnahme + raise ValueError(f"Negatives not allowed: {', '.join(map(str, negatives))}") + + # Berechne die Summe der Zahlen, die <= 1000 sind + return sum(nums) + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/BerishaAlma_2/your_calculator.py b/BerishaAlma_2/your_calculator.py new file mode 100644 index 0000000..e69de29 -- GitLab From 001ed9b1ef8696fa7f630b7a61f43484bab4b655 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sun, 6 Apr 2025 03:03:27 +0200 Subject: [PATCH 33/35] Implementierungen AliciMuhamed getestet StringCalculator --- .../__pycache__/stringCalculator.cpython-312.pyc | Bin 0 -> 6649 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Other/AliciMuhamed_2/__pycache__/stringCalculator.cpython-312.pyc diff --git a/Other/AliciMuhamed_2/__pycache__/stringCalculator.cpython-312.pyc b/Other/AliciMuhamed_2/__pycache__/stringCalculator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..268009bebff13d3c53c3ef6e1f80c2ba5edc84c2 GIT binary patch literal 6649 zcmd^DT~Hg>6~6l?t%PLpX9r<^WV?wiTLL5jb`1W(IAgmL<Je%wR!KIpc8z6Ag6=NG z(uk?sai)0cj+0JX(`h=TPc=iQL!Zj4GkNGtUqodJ-FBwwv=8B_1enQ$r=GJb$w)}J zc?l1_44>|vJ@@WCKlhw-@1N{;D}i>y@%hkyY=ry^A99V$cGjk#^Mr^*q@pB71*sSv zq$zx+qfC&Y$vGl24~WQ0)C^;c39>qs1FA`4^Hff!nt{qo%pLe%am#a>C0?}LJw%9H zO%vd)F6Ja;CQG77f=<wG>oPvOX^rVQ)2r<Y-BeUL6jo!BdV5&x3vV8u7wk2lJ|Pkb zQX&b`5+hO)E7B5oiv@w$+y{cD1ncIsstf(99ElJ0hN9uoXh<EFHFJD4c2klS%_K|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Pa~IpR5SVZVq?pEV@t-_n)bc9z+e1=0|tHg#u}bHe%8?AVxGCU9=Exm-uS<93kdJv z7G4PO$;Pst;c<Bb@>w+hIW!6G23NMiYtn7JX-gVsrF<?7l(%--L1*wI<?QY)wtK~M zn+NUgEob+)7Wm6(cQ4xAyCHuQrY|t|*H>I7&8@9nR$rH2J_d^@T~8RfG(4)P!!aR$ z=-V!r7W3*x+AebhGtOgkP*-+ujfY>OE-YDHSOfCOvf9|M`&Y4qg^BfOc^}($AUeXf z8TOrwvuh42uv0s#r;66rl+~B=rvj<=WjuS8_M0QyXzImQGp-+#r@yMoif6b8>)5t> zeK+Imp1Zlg_w1<dOn#5At<5Jp%c{)?V7UTpNR~o)?V{ce#RVAImfR+Ql^ygJe(f{@ zmdra9Ypl4x{9P}Rzg>5mvZ5F}t#}(HFO>J6uQ*jds_Al0SAFiP;=33;CCUMWPK4JH zx)DwxV6KoaAiRmthoGx}0DIREt|MTw*R5gPjUC2EgoE&};HU>=6>g2at0s!;K<Gp` zhHwg@3!#@<H8ETtwQ6O!D}WSt0?DU=OmSy)>{`<a#;5QDcm*B{MdE@0mxWB|W?0sb zl2|!v{AfI)qW+BwZoDeec+_lf2yPzqHC7^x#R-Z;*x<X3`}C9YyTF6>pn|$wVJM3F z2RZOJ;#g-H%09`g6Zl!THc-y=D~Hwz{H}L<sngWtvBkZf`MsWXf=?^&QG~TkB>&7f Xm)NTN=YMeVdl%oow89X!UKi%S*Fk_T literal 0 HcmV?d00001 -- GitLab From ac0c8c18c01461c876a7b4a41317ac55e7074ffe Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sun, 6 Apr 2025 03:12:00 +0200 Subject: [PATCH 34/35] Implementierung SerchimoMarvin getestet stringCalculator --- .../__pycache__/feature7.cpython-312.pyc | Bin 0 -> 8641 bytes .../stringCalculator.cpython-312.pyc | Bin 0 -> 6651 bytes Other/SerchimoMarvin_2/my_calculator.py | 58 ++++++++++++ Other/SerchimoMarvin_2/stringCalculator.py | 88 ++++++++++++++++++ Other/SerchimoMarvin_2/your_calculator.py | 87 +++++++++++++++++ 5 files changed, 233 insertions(+) create mode 100644 Other/SerchimoMarvin_2/__pycache__/feature7.cpython-312.pyc create mode 100644 Other/SerchimoMarvin_2/__pycache__/stringCalculator.cpython-312.pyc create mode 100644 Other/SerchimoMarvin_2/my_calculator.py create mode 100644 Other/SerchimoMarvin_2/stringCalculator.py create mode 100644 Other/SerchimoMarvin_2/your_calculator.py diff --git a/Other/SerchimoMarvin_2/__pycache__/feature7.cpython-312.pyc b/Other/SerchimoMarvin_2/__pycache__/feature7.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea83a5be0e909a6cffbfa593c6fd9bece8c0ed38 GIT binary patch literal 8641 zcmd^ETWl2989uWYdw0EyuYhf^84Lo}_w|*m!NC|CNWhTThGI;n>z(8EnB7_D%q+&! zwMrwZI%=vAwF*W_1(hlliYig%p*-Y)h)S*0s#<4l*`4r^s(Faj7Y8Gy^-KGo*_rii z*MKV34;{<@oO9+sx9|Mdvww2A90;CL=R)8wc?kWTR*c807Z$HU;U?k{&je9l;?49i zCUhL}rt63|-!~;V`%GG!1=_5b8P3rAuXx=z>zo#B<ufiHK#1g-5b!!zFzLnn`kO&x z%oyX&oTv3Jzuv07EP7>eClqcXjQSWJ^_h4En|Twq3|e^ebxWUh%;L7HIo&c5#6Y_* z=#K<_a+s)@Vk9(xiKJ!_EJujw*SDb!Y6nUeyQo0xO%!D$SOjn4%>mQ6Das5p8rLeq zTkh+v<om#(Z*?ULK&5kxo1+YGjhc(mxFyO&&3uLej68xm6SbrqJ=5q*%7Mc;oE5|K zwj@W9oN0U*wi%`6chtgX@b+S4@Q+)?t<USR%o{ZgXDyFql%iIHgF(Dw*k!aYzoRCD zV?1NUY+IH&j8Zfs${0d5o*6*nwrJ)tbm<^M<Myb1IM?7?ejCEVXI*YaNMhdGF6SFx zqxR&yj;MoYF2jie$APFV<vtt+H-p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qzIPSW5y*kd+PBo#Q@gW709{S$DhK_b*!c>ny)ZaMpg<|9vD>` zdTxX!#~Uh+j;wYt$%rap-Ge^3Z!&H;5-P+i8z|084mI-Jb2}C<>Ui|_jP2z5bNfHZ zm?CddsnMf{hJ@6l3a`lukuek*<V2UA3f9O+baSh0UnwkAntFq{R5iR<o>d2VRs(q* zmPWM1h9;)0e(zeVS%M8j!B|Q%mFh@u2VP<rnMxD&eyK97!;oRQa^L6P<z`*%l#7k+ zZkcu+qAAwljZ>_{G{ri+MBadbyWIJt7T&}|3H&^W)J%@!!+wq<uh6E$lpLX?of3Mv zLQYb0mJ*u%k#m$>poE$Oa)}a-5+5agO6n<D{%xU=Rw<$F(s>})(O)eMPc0^E)l-|v z+DJ(gB?l>am6AhGZ5Hc!=BZP!A7P%_GOV4<(;U6w1T>he$2IyIv#4<==A<*xpF=`E z_!W?IXA=4Yt!j&i0{o%{_r?~jN>8la2iMNp>L@6xh4xsp_$Aw+#E&VhL;xOoTOd(D z7R(I8e1Ys=pzLog70fy28${`|x0nuwInPWUoZV45wWIPG(y9yROvvJ#P(C*o%~^7< Uo%qq|ADsT-nFTYl6l-h#53EBK3IG5A literal 0 HcmV?d00001 diff --git a/Other/SerchimoMarvin_2/__pycache__/stringCalculator.cpython-312.pyc b/Other/SerchimoMarvin_2/__pycache__/stringCalculator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..481f23d725110b6364206a29d305bd4d7b6eaeed GIT binary patch literal 6651 zcmd^DT~Hg>6~6l?t%PLpX9r<^WV?wiTl`1@>=^umamIEh#<9VUt&(hH?HbG058Yi% zq!ClM<4*C^9VeZ(rqgsvpK69qhdz~8XY$aQzKF^cy6sHUX&=H<2{4lhPd#T>l97;b z^Aa9<89v=Td+yzPe(pKv-apyxRs!vY<MZMF*a-O-KI9sg?W|2f=Lr#sNJU7L3Q$ox zKvVckN0<OZlXFC59uSe0s2Ro>6JT{J2UL^9=Bb=cH3OBGm^<*j;+E$$OT1{gdx#L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GX)@(+~ zyAlj5k|MicJ)07r4<Ge{)grwgl19{UJT^`1IbSn};xScvU(KFSjqG1*SUp>z=CXr( z8#5QOo`4T3R{<bD+N&1rP4o7qkCGYtVL0$v4nG}UvQ<95^zhQ6t$E(oJjFk^xxZlG z1)M*PT>4SX<lBplt@Dko8E0GC`{n|F@e2+Z^x+$8c=GsJL$8Z@=HhzY=7M_T|HdsK zyn|b`K!8s+mh}vetHm#$Mf0CSli+S}Wh=ZU-Nu`?q;Xct=R$vZYnL5#20v2H?k&Z3 zuXt|rpxs-_+5N2r{xaIV1?}FlA%7F5FEIAkS6n8|ZEf9FZ?{iA28$?NPZ+s0G^(ia zsE|MOZI?@nd37UgmpK9%=dn4cD|@!a!>>^nmaHzUe)(isZS2?mt60Lq#Co*6k8L{; z9bwxH`%cE$JqH!osU6i*MO$0S>P`7l{#3^@p1n%@&5><1^<t|T7m&%*UsYwrGhBpq zY+Jp)n{oEc-CW>%cT{&KpU2zY?v<To)n){+Tmd#LOF_JLQEvxh0*q`=ZWF-D4tfi} zb{YXo=ADW)R@`5{?w82lp}S34QH-5dyp56<%KOh(oN55obUCN1es@*zT@0QQWj{g} z!s`e<2&WJ*SI8F--bCm}(A7VPy=w^95ir^7)-dkI4&x)jLHJj2)B~~#x5h22CW`As z=t4M#a0;Otp^sWMF<d{jYGt@9fE0HE$)|x#ac6YwUegK2r|<)K1s)B;mAU|zg-q~f zNY;;%SUGC^Xe_Lv{*4Q6yeiUo)NEf6ZXWbCRw9kX35rD6;Cqbw^po<tz=QRmg1TH` zD2n<AIq)~)SZ5i^KFO>T_*u6$P|ox#ht>)FuJ^Q1r>V(fi+erudp+v}pH|+Z2y2^2 b{+V$uu~qla|KQ?xFMj{h3Pad>U6}s@Pgj97 literal 0 HcmV?d00001 diff --git a/Other/SerchimoMarvin_2/my_calculator.py b/Other/SerchimoMarvin_2/my_calculator.py new file mode 100644 index 0000000..c086b23 --- /dev/null +++ b/Other/SerchimoMarvin_2/my_calculator.py @@ -0,0 +1,58 @@ +#Implementierung von SerchimoMarvin auf meinen Testfälle: StringCalculator +import unittest + +from feature7 import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/SerchimoMarvin_2/stringCalculator.py b/Other/SerchimoMarvin_2/stringCalculator.py new file mode 100644 index 0000000..bd21dc8 --- /dev/null +++ b/Other/SerchimoMarvin_2/stringCalculator.py @@ -0,0 +1,88 @@ +from abc import ABC, abstractmethod +import unittest + +class IStringCalculator(ABC): + @abstractmethod + def add(self, numbers: str) -> int: + pass + +class StringCalculator(IStringCalculator): + def add(self, numbers: str) -> int: + if not numbers: + return 0 + + # Überprüfe, ob ein benutzerdefiniertes Trennzeichen angegeben ist + if numbers.startswith("//"): + delimiter_line_end = numbers.find("\n") + delimiter = numbers[2:delimiter_line_end] # Extrahiere das Trennzeichen + numbers = numbers[delimiter_line_end + 1:] # Entferne die erste Zeile mit dem Trennzeichen + else: + delimiter = ',' # Standard-Trennzeichen ist Komma + + # Ersetze alle Vorkommen des Trennzeichens und teile die Eingabe + numbers = numbers.replace("\n", delimiter) + nums = numbers.split(delimiter) + + # Filtere alle Zahlen, die größer als 1000 sind + nums = [int(num) for num in nums if int(num) <= 1000] + + # Prüfe auf negative Zahlen + negatives = [num for num in nums if num < 0] + + if negatives: + # Wenn negative Zahlen vorhanden sind, werfe eine Ausnahme + raise ValueError(f"Negatives not allowed: {', '.join(map(str, negatives))}") + + # Berechne die Summe der Zahlen, die <= 1000 sind + return sum(nums) + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/SerchimoMarvin_2/your_calculator.py b/Other/SerchimoMarvin_2/your_calculator.py new file mode 100644 index 0000000..7fcb668 --- /dev/null +++ b/Other/SerchimoMarvin_2/your_calculator.py @@ -0,0 +1,87 @@ +#Meine Implementierungen auf Testfälle anderer Studierenden testen: StringCalculator + +import re +import unittest +from stringCalculator import StringCalculator + + +class TestStringCalculator(unittest.TestCase): + """Test suite for the StringCalculator class.""" + + def setUp(self): + """neue Instanz des StringCalculators vor jedem Test""" + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string_returns_zero(self): + """Feature 1: Leerer String soll 0 ergeben""" + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number_returns_value(self): + """Ein einzelner Wert soll zurückgegeben werden""" + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers_return_sum(self): + """Zwei Zahlen sollen summiert werden""" + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_add_multiple_numbers(self): + """Feature 2: Mehrere Zahlen summieren""" + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_add_numbers_with_newlines(self): + """Feature 3: Zeilenumbrüche als Trennzeichen""" + self.assertEqual(self.calculator.add("1\n2\n3"), 6) + + def test_add_negative_numbers(self): + """Feature 4: Negative Zahlen sollen Fehler werfen""" + with self.assertRaises(ValueError) as e: + self.calculator.add("-1,2,-3") + self.assertEqual(str(e.exception), "Negative numbers are not allowed: -1, -3") + + def test_add_numbers_with_custom_delimiter(self): + """Feature 5: Benutzerdefiniertes Trennzeichen""" + self.assertEqual(self.calculator.add("//;\n1;2;3"), 6) + + def test_add_numbers_with_custom_delimiter_different_symbol(self): + """Feature 5: Benutzerdefiniertes Trennzeichen mit anderem Symbol""" + self.assertEqual(self.calculator.add("//#\n4#5#6"), 15) + + def test_custom_delimiter_with_multiple_numbers(self): + """ + Kombinierter Test für: + feature 5 und feature 2 + Erwartet wird die korrekte Addition von sechs durch ein benutzerdefiniertes Zeichen getrennten Zahlen. + """ + self.assertEqual(self.calculator.add("//:\n1:2:3:4:5:6"), 21) + + def test_add_numbers_greater_than_1000(self): + """Feature6 test""" + self.assertEqual(self.calculator.add("1,1001,2,3"), 6) + + def test_add_numbers_with_newlines_and_ignore_above_1000(self): + """Feature 3 und 6 test Zeilenumbruch als trenner, Zahlen>1000 ignorieren""" + self.assertEqual(self.calculator.add("1\n2\n1000\n1001"), 1003) + + def test_add_numbers_with_custom_delimiter_long_length(self): + """Benutzerdefinierte Trennzeichen beliebig lang """ + self.assertEqual(self.calculator.add("//[***]\n1***2***3"), 6) + + def test_custom_long_delimiter_with_large_number_ignored(self): + """FEature 6 und 7 test Benutzerdefinierte Delimiter Länge und zahl über 1000 wird ignoriert""" + self.assertEqual(self.calculator.add("//[***]\n1***1001***2"), 3) + + def test_custom_long_delimiter_with_negative_numbers(self): + """Feature 4 und 7: Benutzerdefinierter Delimiter beliebiger Länge + negative Zahlen""" + with self.assertRaises(ValueError) as e: + self.calculator.add("//[***]\n1***-2***3***-4") + self.assertEqual(str(e.exception), "Negative numbers are not allowed: -2, -4") + + + + + +if __name__ == '__main__': + unittest.main() -- GitLab From 4f6229dbb841162b35161f52a0604f612971bb82 Mon Sep 17 00:00:00 2001 From: Hatice Yildirim <Hatice.Yildirim@student.reutlingen-university.de> Date: Sun, 6 Apr 2025 04:14:25 +0200 Subject: [PATCH 35/35] inital commit --- .../__pycache__/Feature1.cpython-312.pyc | Bin .../stringCalculator.cpython-312.pyc | Bin .../stringCalculatorr.cpython-312.pyc | Bin .../BerishaAlma_2}/my_calculator.py | 0 .../BerishaAlma_2}/stringCalculatorr.py | 0 .../BerishaAlma_2}/your_calculator.py | 0 Other/GotsisWasili_2/TDD_StringCalculator.py | 110 ++++++++++++++++++ Other/GotsisWasili_2/my_calculator.py | 58 +++++++++ Other/GotsisWasili_2/stringCalculator.py | 88 ++++++++++++++ Other/GotsisWasili_2/your_calculator.py | 61 ++++++++++ .../stringCalculator.cpython-312.pyc | Bin 0 -> 6651 bytes Other/PikkemaatLasse_2/my_calculator.py | 58 +++++++++ .../__pycache__/interfaces.cpython-312.pyc | Bin 0 -> 660 bytes .../stringcalculator.cpython-312.pyc | Bin 0 -> 1920 bytes Other/PikkemaatLasse_2/stringCalculator.py | 88 ++++++++++++++ Other/PikkemaatLasse_2/your_calculator.py | 62 ++++++++++ .../stringCalculator.cpython-312.pyc | Bin 0 -> 8050 bytes Other/RafehDaniel_2/my_calculator.py | 58 +++++++++ Other/RafehDaniel_2/stringCalculatorr.py | 88 ++++++++++++++ Other/RafehDaniel_2/your_calculator.py | 86 ++++++++++++++ .../stringCalculator.cpython-312.pyc | Bin 0 -> 6653 bytes Other/WeishauptOrlando_2/my_calculator.py | 58 +++++++++ .../src/__pycache__/Count_ED.cpython-312.pyc | Bin 0 -> 843 bytes .../RomanConverter.cpython-312.pyc | Bin 0 -> 1878 bytes .../src/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 2369 bytes .../__pycache__/calculator.cpython-312.pyc | Bin 0 -> 2290 bytes .../__pycache__/interfaces.cpython-312.pyc | Bin 0 -> 2147 bytes .../string_calculator.cpython-312.pyc | Bin 0 -> 2410 bytes Other/WeishauptOrlando_2/stringCalculator.py | 88 ++++++++++++++ Other/WeishauptOrlando_2/your_calculator.py | 74 ++++++++++++ README.md | 93 --------------- 31 files changed, 977 insertions(+), 93 deletions(-) rename {BerishaAlma_2 => Other/BerishaAlma_2}/__pycache__/Feature1.cpython-312.pyc (100%) rename {BerishaAlma_2 => Other/BerishaAlma_2}/__pycache__/stringCalculator.cpython-312.pyc (100%) rename {BerishaAlma_2 => Other/BerishaAlma_2}/__pycache__/stringCalculatorr.cpython-312.pyc (100%) rename {BerishaAlma_2 => Other/BerishaAlma_2}/my_calculator.py (100%) rename {BerishaAlma_2 => Other/BerishaAlma_2}/stringCalculatorr.py (100%) rename {BerishaAlma_2 => Other/BerishaAlma_2}/your_calculator.py (100%) create mode 100644 Other/GotsisWasili_2/TDD_StringCalculator.py create mode 100644 Other/GotsisWasili_2/my_calculator.py create mode 100644 Other/GotsisWasili_2/stringCalculator.py create mode 100644 Other/GotsisWasili_2/your_calculator.py create mode 100644 Other/PikkemaatLasse_2/__pycache__/stringCalculator.cpython-312.pyc create mode 100644 Other/PikkemaatLasse_2/my_calculator.py create mode 100644 Other/PikkemaatLasse_2/src/__pycache__/interfaces.cpython-312.pyc create mode 100644 Other/PikkemaatLasse_2/src/__pycache__/stringcalculator.cpython-312.pyc create mode 100644 Other/PikkemaatLasse_2/stringCalculator.py create mode 100644 Other/PikkemaatLasse_2/your_calculator.py create mode 100644 Other/RafehDaniel_2/__pycache__/stringCalculator.cpython-312.pyc create mode 100644 Other/RafehDaniel_2/my_calculator.py create mode 100644 Other/RafehDaniel_2/stringCalculatorr.py create mode 100644 Other/RafehDaniel_2/your_calculator.py create mode 100644 Other/WeishauptOrlando_2/__pycache__/stringCalculator.cpython-312.pyc create mode 100644 Other/WeishauptOrlando_2/my_calculator.py create mode 100644 Other/WeishauptOrlando_2/src/__pycache__/Count_ED.cpython-312.pyc create mode 100644 Other/WeishauptOrlando_2/src/__pycache__/RomanConverter.cpython-312.pyc create mode 100644 Other/WeishauptOrlando_2/src/__pycache__/__init__.cpython-312.pyc create mode 100644 Other/WeishauptOrlando_2/src/__pycache__/calculator.cpython-312.pyc create mode 100644 Other/WeishauptOrlando_2/src/__pycache__/interfaces.cpython-312.pyc create mode 100644 Other/WeishauptOrlando_2/src/__pycache__/string_calculator.cpython-312.pyc create mode 100644 Other/WeishauptOrlando_2/stringCalculator.py create mode 100644 Other/WeishauptOrlando_2/your_calculator.py delete mode 100644 README.md diff --git a/BerishaAlma_2/__pycache__/Feature1.cpython-312.pyc b/Other/BerishaAlma_2/__pycache__/Feature1.cpython-312.pyc similarity index 100% rename from BerishaAlma_2/__pycache__/Feature1.cpython-312.pyc rename to Other/BerishaAlma_2/__pycache__/Feature1.cpython-312.pyc diff --git a/BerishaAlma_2/__pycache__/stringCalculator.cpython-312.pyc b/Other/BerishaAlma_2/__pycache__/stringCalculator.cpython-312.pyc similarity index 100% rename from BerishaAlma_2/__pycache__/stringCalculator.cpython-312.pyc rename to Other/BerishaAlma_2/__pycache__/stringCalculator.cpython-312.pyc diff --git a/BerishaAlma_2/__pycache__/stringCalculatorr.cpython-312.pyc b/Other/BerishaAlma_2/__pycache__/stringCalculatorr.cpython-312.pyc similarity index 100% rename from BerishaAlma_2/__pycache__/stringCalculatorr.cpython-312.pyc rename to Other/BerishaAlma_2/__pycache__/stringCalculatorr.cpython-312.pyc diff --git a/BerishaAlma_2/my_calculator.py b/Other/BerishaAlma_2/my_calculator.py similarity index 100% rename from BerishaAlma_2/my_calculator.py rename to Other/BerishaAlma_2/my_calculator.py diff --git a/BerishaAlma_2/stringCalculatorr.py b/Other/BerishaAlma_2/stringCalculatorr.py similarity index 100% rename from BerishaAlma_2/stringCalculatorr.py rename to Other/BerishaAlma_2/stringCalculatorr.py diff --git a/BerishaAlma_2/your_calculator.py b/Other/BerishaAlma_2/your_calculator.py similarity index 100% rename from BerishaAlma_2/your_calculator.py rename to Other/BerishaAlma_2/your_calculator.py diff --git a/Other/GotsisWasili_2/TDD_StringCalculator.py b/Other/GotsisWasili_2/TDD_StringCalculator.py new file mode 100644 index 0000000..ab815fa --- /dev/null +++ b/Other/GotsisWasili_2/TDD_StringCalculator.py @@ -0,0 +1,110 @@ +#Bei Eingabe des Strings "" liefert die Funktion 0 +#Bei Eingabe des Strings "1" liefert die Funktion 1 +#Bei Eingabe des Strings "1,2" liefert die Funktion 3 +#Bei Eingabe des Strings "1,2,3,4,5,6,7" liefert die Funkktion 28 +#Bei Eingabe des Strings "1\n2,3,4" liefert die Funkktion 10 +#Bei Eingabe des Strings "-5" liefert die Funkktion eine exception mit [“negatives not allowed†-5] +#Bei Eingabe des Strings "-5,-2,-2" liefert die Funkktion eine exception mit [“negatives not allowed†-5,-2,-2] +#Bei Eingabe des Strings "//;\n1;2" liefert die Funktion 3 wobei das Standard-Trennzeichen';' ist. +#Bei Eingabe des Strings "2,1001" liefert die Funktion 2 +#Bei Eingabe des Strings "2,10022\n6" liefert die Funktion 8 +#Bei Eingabe des Strings "//[***]\n1***2***3" mit dem Trennzeichen '***' liefert die Funktion 6 +#Bei Eingabe des Strings "//[*+*+*]\n1*+*+*2*+*+*3*+*+*220" mit dem Trennzeichen '***' liefert die Funktion 226 + +import unittest +from abc import ABC, abstractmethod + +#Interface für StringCalculator +class IStringCalculator(ABC): + @abstractmethod + def add(self, numbers:str) -> int: + pass + +#Implementierung der Calculator Klasse +class StringCalculator(IStringCalculator): + def add(self, numbers:str) -> int: + if numbers == "": + return 0 + + #Prüfen, ob ein benutzerdefiniertes Trennzeichen definiert wurde + + if numbers.startswith("//"): + delimiter_end_index = numbers.index("\n") #Zeilenumbruchs Position finden + delimiter = numbers[2:delimiter_end_index] # Trennzeichen, also alles zwischen "//" und "\n" extrahieren + + if delimiter.startswith("[") and delimiter.endswith("]"): + delimiter = delimiter[1:-1] # "[" und "]" entfernen + + numbers = numbers[delimiter_end_index + 1:] #Zahlen nach "\n" extrahieren + numbers = numbers.replace(delimiter,",") #Benutzerdefiniertes Trennzeichen durch "," ersetzen + + #Zeilenumbrüche ebenfals durch "," ersetzen + numbers = numbers.replace("\n",",") + + # String anhand von Kommas splitten, eine Liste der einzelnen Zahlen(in str) erzeugen und in Int umwandeln -> Ergebnis wäre z.B. bei add("1\n2,3,4") -> [1,2,3,4] + num_list = list(map(int, numbers.split(",",))) + + #Prüfung auf negative Zahlen + negatives = [n for n in num_list if n<0] + if negatives: + raise ValueError(f"negatives not allowed: {','.join(map(str, negatives))}") #Alle negativen Zahlen durch Kommas in getrennte Strings darstellen + + #Zahlen größer als 1000 aus Liste entfernen + num_list = [n for n in num_list if n <= 1000] + + return sum(num_list) #Summe berechnen (bei einer Zahln wird immernoch dieselbe Zahl ausgegeben) + + +#mplementierung der Testklasse für StringCalculator +class TestStringCalculator(unittest.TestCase): + def test_add_empty(self): + c = StringCalculator() + self.assertEqual(c.add(""), 0) + + def test_add_one_string(self): + c = StringCalculator() + self.assertEqual(c.add("1"), 1) + + def test_add_two_string(self): + c = StringCalculator() + self.assertEqual(c.add("1,2"), 3) + + def test_add_multiple_string(self): + c = StringCalculator() + self.assertEqual(c.add("1,2,3,4,5,6,7"), 28) + + def test_add_new_lines(self): + c = StringCalculator() + self.assertEqual(c.add("1\n2,3,4"), 10) + + def test_add_exception(self): + c = StringCalculator() + with self.assertRaises(ValueError) as context: + c.add("-5") + self.assertEqual(str(context.exception), "negatives not allowed: -5") + + def test_add_negative_numbers(self): + c = StringCalculator() + with self.assertRaises(ValueError) as context: + c.add("-5,-2,-2") + self.assertEqual(str(context.exception), "negatives not allowed: -5,-2,-2") + + def test_add_different_delimiters(self): + c = StringCalculator() + self.assertEqual(c.add("//;\n1;2"), 3) + + def test_add_numbers_greater_than_1000(self): + c = StringCalculator() + self.assertEqual(c.add("2,1001"),2) + self.assertEqual(c.add("2,10022\n6"),8) + + def test_delimiters_of_any_length(self): + c = StringCalculator() + self.assertEqual(c.add("//[***]\n1***2***3"), 6) + + def test_delimiters_of_any_length2(self): + c = StringCalculator() + self.assertEqual(c.add("//[*+*+*]\n1*+*+*2*+*+*3*+*+*220"), 226) + +if __name__ == "__main__": + unittest.main() diff --git a/Other/GotsisWasili_2/my_calculator.py b/Other/GotsisWasili_2/my_calculator.py new file mode 100644 index 0000000..ab49b59 --- /dev/null +++ b/Other/GotsisWasili_2/my_calculator.py @@ -0,0 +1,58 @@ +#Implementierung von PikkemaatLasse auf meinen Testfälle: StringCalculator +import unittest + +from TDD_StringCalculator import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/GotsisWasili_2/stringCalculator.py b/Other/GotsisWasili_2/stringCalculator.py new file mode 100644 index 0000000..bd21dc8 --- /dev/null +++ b/Other/GotsisWasili_2/stringCalculator.py @@ -0,0 +1,88 @@ +from abc import ABC, abstractmethod +import unittest + +class IStringCalculator(ABC): + @abstractmethod + def add(self, numbers: str) -> int: + pass + +class StringCalculator(IStringCalculator): + def add(self, numbers: str) -> int: + if not numbers: + return 0 + + # Überprüfe, ob ein benutzerdefiniertes Trennzeichen angegeben ist + if numbers.startswith("//"): + delimiter_line_end = numbers.find("\n") + delimiter = numbers[2:delimiter_line_end] # Extrahiere das Trennzeichen + numbers = numbers[delimiter_line_end + 1:] # Entferne die erste Zeile mit dem Trennzeichen + else: + delimiter = ',' # Standard-Trennzeichen ist Komma + + # Ersetze alle Vorkommen des Trennzeichens und teile die Eingabe + numbers = numbers.replace("\n", delimiter) + nums = numbers.split(delimiter) + + # Filtere alle Zahlen, die größer als 1000 sind + nums = [int(num) for num in nums if int(num) <= 1000] + + # Prüfe auf negative Zahlen + negatives = [num for num in nums if num < 0] + + if negatives: + # Wenn negative Zahlen vorhanden sind, werfe eine Ausnahme + raise ValueError(f"Negatives not allowed: {', '.join(map(str, negatives))}") + + # Berechne die Summe der Zahlen, die <= 1000 sind + return sum(nums) + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/GotsisWasili_2/your_calculator.py b/Other/GotsisWasili_2/your_calculator.py new file mode 100644 index 0000000..9742055 --- /dev/null +++ b/Other/GotsisWasili_2/your_calculator.py @@ -0,0 +1,61 @@ +import unittest +from stringCalculator import StringCalculator + +#mplementierung der Testklasse für StringCalculator +class TestStringCalculator(unittest.TestCase): + + def test_implements_interface(self): + c = StringCalculator() + self.assertIsInstance(self.c, StringCalculator) + + def test_add_empty(self): + c = StringCalculator() + self.assertEqual(c.add(""), 0) + + def test_add_one_string(self): + c = StringCalculator() + self.assertEqual(c.add("1"), 1) + + def test_add_two_string(self): + c = StringCalculator() + self.assertEqual(c.add("1,2"), 3) + + def test_add_multiple_string(self): + c = StringCalculator() + self.assertEqual(c.add("1,2,3,4,5,6,7"), 28) + + def test_add_new_lines(self): + c = StringCalculator() + self.assertEqual(c.add("1\n2,3,4"), 10) + + def test_add_exception(self): + c = StringCalculator() + with self.assertRaises(ValueError) as context: + c.add("-5") + self.assertEqual(str(context.exception), "negatives not allowed: -5") + + def test_add_negative_numbers(self): + c = StringCalculator() + with self.assertRaises(ValueError) as context: + c.add("-5,-2,-2") + self.assertEqual(str(context.exception), "negatives not allowed: -5,-2,-2") + + def test_add_different_delimiters(self): + c = StringCalculator() + self.assertEqual(c.add("//;\n1;2"), 3) + + def test_add_numbers_greater_than_1000(self): + c = StringCalculator() + self.assertEqual(c.add("2,1001"),2) + self.assertEqual(c.add("2,10022\n6"),8) + + def test_delimiters_of_any_length(self): + c = StringCalculator() + self.assertEqual(c.add("//[***]\n1***2***3"), 6) + + def test_delimiters_of_any_length2(self): + c = StringCalculator() + self.assertEqual(c.add("//[*+*+*]\n1*+*+*2*+*+*3*+*+*220"), 226) + +if __name__ == "__main__": + unittest.main() diff --git a/Other/PikkemaatLasse_2/__pycache__/stringCalculator.cpython-312.pyc b/Other/PikkemaatLasse_2/__pycache__/stringCalculator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8f6330f0744cb9f2196855a68b226d8671fd74e GIT binary patch literal 6651 zcmd^DT}&I<6~6OlkBuGkmn<gyI7xRCC+5dCkZd47gshTO3HgC!6PMjt$1@=gwxKh_ z5?e-1t5hXws_a&6L)EQHpBh9}(Wmm7)jm|}i>X7Q(@Nc{eOR8#0@7-E>NzvEgN;qP zFUvzO;`5y|=ia&J=bm%!{gd5pCD3j;J|Fy#jgWugL$-05&e{}oo)VFWRD?vS02QSJ zG=<M}gb6S-IY&h1ArV=LnqiDF0amASKs8Bhj>_p&Gf;Vnxd-1XY&lM|#EX`pLxjkc zGy&eqLQX<vG9-$`={W7SF5|PC)|l=yJ=(6|ZAF!XAvG$gcZbE^(B|<u!QKGsQzDT7 zC6WLwF(M_gA}w)uSP+QKejs3qvu;kSxX`D{;n-kLFcKP#1l3_#Gsi}ww<TH8OtPeo z%CQi=`7_W*b*!=aSK?%v>Yc^~vWgVBBb$M$AivAC@qXy|z;y*C8aN+R!y!qy6^@8u zIUF50D=9<j@W?=`Pv}2;R_Iog@L((|#Z*OT^$qm*Zzf4d^bcHC?@IE(mGIDz6b%N| zi$O(^1m6ItBX9A|BXNxhieh5-7P*>%j5<;f9*|FY+ZuF8uiLEgf)EQvB|*@vf)E`R zM<dv`3BtEWgAwD6jPhy>d{1M-F;(6Lk8&A;1Hq19$^!B#`vD%3C9Z0Pra1ege}%x$ zlz$a}))-={{v7GXa2%OuOq>DRS{=YkV}dCeFePi4GQjC3EHAX6ZUvc#k$I-G06{n1 z?<kxzNhwsEN>caWsj!LkOol2q0tb#NXd;v47^jnz$R_DpGR`EaBrS3Y;1vlxQ!!dJ zA@yF?IXBHBGD&78<67gm4)mRZ1{|4njI&AhEP29(=s}R`9Z<_Sr=mo9OLAF0(L7WO z%BL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?6awZ7`2xa4gkA(){r%Xxfp8N6lf7;Y<8JIQJ|Y~1e+5T9B&%?1+_Y+<xORjN zgkuP&5IPZhs8tig^-`-=hPwtxaVL;`8psrPM#s)IonU+lKY&-@(O@_x2yj`*1aF6A z{V0i*qsEWM!Yb<DxZuXCB8^AQ_5|VPL0@Az(pa3JK!gpx%eYTJDZdLmSPv?w%N2&A zsDF?He<O}{mZ9vE%sPReb!#2vOucq!oxtyUR}*!bnmo3+*E7G@vrh17<voh9wu!`_ Z8RrsP@!<RqE`9gX_b;z7gss(u`7aFufgAt; literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_2/my_calculator.py b/Other/PikkemaatLasse_2/my_calculator.py new file mode 100644 index 0000000..1397276 --- /dev/null +++ b/Other/PikkemaatLasse_2/my_calculator.py @@ -0,0 +1,58 @@ +#Implementierung von PikkemaatLasse auf meinen Testfälle: StringCalculator +import unittest + +from src.stringcalculator import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/PikkemaatLasse_2/src/__pycache__/interfaces.cpython-312.pyc b/Other/PikkemaatLasse_2/src/__pycache__/interfaces.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac53ca6f524d1c5c8f88faf49192e432080c7686 GIT binary patch literal 660 zcmZWm&ubGw6n?X_n}nJzi0!>72<xGg<R&822DDJ3V0v&_7$!TDbjj|fotZtvlZV{= z1Ja|{(to7jKOl2a@Z>Evdg;kG-Bv0N%=f<c_Wk(g?dLFD13VY^mgA3TzdPsl1UF>$ z1jzyf2$DlVVp4dqN5F%ZAiOyUD#<ymb7MO5qu_^gBG1y@7khS{54BM|HH9=sQ<2t* zHU6FO82trEh>3vMlT;At3r_|kU(mUKep3@STz7ka|E*D3Io{)WTIJkKm2H+)F_cQ% zhLWaIW$N7>gWTy``3MV`K}7mzPM@!3K2lALYL~yYb!F10$)UzZ$t!NMRI+zjE;5xB zNl)sDnI0!Q9X9Co*sj*uxGZF8G~4MUgTdX9bir=&+8jxhyvZgLS#WL+xYm+&60OoC zD~(hmo=UxaJhPMw@qY8aS8Ze1N!D&nAK+W7y+Q*0sA*e_mAsIQ*)_(Bsi<<t+l-x5 zJg>hfS86Hl-clT=LUfh;*=pTE+d<<N+<NpwggJZ(9xOc)gs0slp!w9jbY?}NvGLQz z>vC7wk9?FqOqHv?9#=Q~cgR)iSuOCn+QdA9S8pIJDIw%5Jo@ER5}wlEfabdQA8os! AssI20 literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_2/src/__pycache__/stringcalculator.cpython-312.pyc b/Other/PikkemaatLasse_2/src/__pycache__/stringcalculator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7070b361211a079a6b1902fa1be15345de2abe3 GIT binary patch literal 1920 zcmZ`)O-vg{6rR~#{~HW;0yJPS1T{G2Cjq6T`BNi1B_xsilcX)Kqt(VUm@Vryomq!K z*HRVbz#&q@i6~JeDj}69ha&Y7sXbKT5~-I(juK~^N=WUY+)zlR7FB9zv6omhox_{= z-hA`DH*e?7{!~-r1#CR@t!IWD0Q_nh_F(qb*yv@`96$g;1!Q3oLQCfqF3E9V2q6AC zKmvyM_%b}nPjOMlnq@?xSwDPUBeI%_NlH4eNLr30(q&v(3Ke6cg(-6YgCs;C$sve& z#9?7nVDv)LF(pJDX5CII)1~IKmocHHlVB}R)HGMc?Pj`_)5hD(I|p<~;S|*2r?3iB zQ4x2q;w3WTb$A65pH?{!V5hTJuUY%;x>V61-bNHS9U_O$?EwW|=U*AiX=6zvL%6DF z>}*`y2&c{?H}WtxLFIJ5Am~u%kb9aT5nx^`AJ2aobOCwqRci5n7{pg&JV5i=JX+1R zR%>f4PQ9(aoEbx<Zgw==E;w{Y9DM0aa~Y84F0oryaOzG3$5~bs-tg$oS?-2k00kHG zyGU(Swf(y54)|*Oi?Eu%im7IN&kiO>!KsDp+;oSX$$79BXxsOq6A(WHRndGl?i!o~ zSNRbz3DX>8ITxIhOxjwsHbE?sX|Att6MFNnGyS5PS^h!M<P4^fcXA{vX-6UnIX$LD zuH+PjYRd~Mk~3@8woUlSCcLy}6>IGuHa1~*{;eGpNoh>M>S%@Nl&Xy_FDP0>wHSNY zMaM*@=`kGn2onuYHzjaJ(&Q_+42WQ&Ncqbw1NnD$aid<-OErmTbW+yFOz(%1lE<eA z$q~~bs|a5;-B?BCMHj&nij>BtpvY7+`K&Zy^0KO#4mzR8%t7<nsM{1MRz``FC2fWf zR^+U#VIndXu}oO|(mBBbo1Sgk^jF$cEC*ngS*KRg7b|PjYS&0*Y)+?-q%Km{*{Rd) zkZCNA$O@8)oK3|s9oKRbsRRAug?L;%NvWJsvsl%rc%VOZ;X<_wTh4*hyV@8gsrTgZ zah#PT?VLm@7W-3_q*HY3aY}DLPQ4RTCNCj0y=&)N)62Zp;pq_jh+lxGfre6O*Qzi0 z#1~%ig>RupzP+VD=+@v$pyOFX#AqKbHk>i)&XhW$-}HRlvm_Kd4jKNoQn+*eePiDd zBYbowQ3`~g1iDrNU5lYdfu5z_C;h`K{lgFUKI%`DTJ|p<T>QXjIWX&4ZP|a*Q)&ns ztp}G*uCyL9THiDp24{wtYc4mNo0peD#fC#OL#x5p=K5y)<~tYpVz7J0weI9SN%*X} zZGm5iEjE4|z8hYm#puyu<XEx!_{_O=H|Re6xH&c-yFc(_{r7{nV@7k#a5pje)Ytqh z*kZH|8i!9CgTqGnOfh)Y@Sk1XH}JSIHqS57`{=vRZ}UcDY{t*TZ-L;=W5qzka7X@p z5dw94o&#vbW*p&<i@_1YKeEnSp1+?vK}#I|_1q1b;*fT-f<CD4ik$!tj(g(`!m?Yi zWQRB2EG+j3mOQaL9^w;Gr|A|&Rmx&fG`*sj&7r(v>3&iCEH5dQ6`p-h(#S|j2NQR} z29toaTf%y^w}hq8-Ar5u>s+g&{no%bVAK4-3u_`>HZCfdwd{)YvQEHcl=TNC)*r#- z2riTDvyfYGE5N4vSUIT^<PBz8olcvWVCRPL7tsAP@Vs!g!FHpu>kq)@t)2e@xexEK literal 0 HcmV?d00001 diff --git a/Other/PikkemaatLasse_2/stringCalculator.py b/Other/PikkemaatLasse_2/stringCalculator.py new file mode 100644 index 0000000..bd21dc8 --- /dev/null +++ b/Other/PikkemaatLasse_2/stringCalculator.py @@ -0,0 +1,88 @@ +from abc import ABC, abstractmethod +import unittest + +class IStringCalculator(ABC): + @abstractmethod + def add(self, numbers: str) -> int: + pass + +class StringCalculator(IStringCalculator): + def add(self, numbers: str) -> int: + if not numbers: + return 0 + + # Überprüfe, ob ein benutzerdefiniertes Trennzeichen angegeben ist + if numbers.startswith("//"): + delimiter_line_end = numbers.find("\n") + delimiter = numbers[2:delimiter_line_end] # Extrahiere das Trennzeichen + numbers = numbers[delimiter_line_end + 1:] # Entferne die erste Zeile mit dem Trennzeichen + else: + delimiter = ',' # Standard-Trennzeichen ist Komma + + # Ersetze alle Vorkommen des Trennzeichens und teile die Eingabe + numbers = numbers.replace("\n", delimiter) + nums = numbers.split(delimiter) + + # Filtere alle Zahlen, die größer als 1000 sind + nums = [int(num) for num in nums if int(num) <= 1000] + + # Prüfe auf negative Zahlen + negatives = [num for num in nums if num < 0] + + if negatives: + # Wenn negative Zahlen vorhanden sind, werfe eine Ausnahme + raise ValueError(f"Negatives not allowed: {', '.join(map(str, negatives))}") + + # Berechne die Summe der Zahlen, die <= 1000 sind + return sum(nums) + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/PikkemaatLasse_2/your_calculator.py b/Other/PikkemaatLasse_2/your_calculator.py new file mode 100644 index 0000000..ff558d7 --- /dev/null +++ b/Other/PikkemaatLasse_2/your_calculator.py @@ -0,0 +1,62 @@ +#Meine Implementierungen auf Testfälle anderer Studierenden testen: StringCalculator + +import unittest +from stringCalculator import StringCalculator +from stringCalculator import IStringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator: IStringCalculator = StringCalculator() # Zugriff über das Interface + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, IStringCalculator) + + def test_add_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_add_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_add_two_numbers(self): + self.assertEqual(self.calculator.add("10,20"), 30) + + def test_add_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3"), 6) + self.assertEqual(self.calculator.add("10,20,30,40"), 100) + + def test_add_with_newline_separator(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + self.assertEqual(self.calculator.add("10\n20\n30"), 60) + + def test_add_single_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + print(str(context.exception)) + self.assertEqual(str(context.exception), "Negative nicht erlaubt: [-2]") + + def test_add_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("-10\n-20,-30") + print(str(context.exception)) + self.assertEqual(str(context.exception), "Negative nicht erlaubt: [-10, -20, -30]") + + def test_add_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + self.assertEqual(self.calculator.add("//x\n7x8\n9"), 24) + + def test_invalid_custom_delimiter_format(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("//;1;2") + print(str(context.exception)) + + def test_ignore_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + self.assertEqual(self.calculator.add("1002,50200"), 0) + + def test_add_with_custom_delimiter_multiple_characters(self): + self.assertEqual(self.calculator.add("//[**]\n1**2**3"), 6) + self.assertEqual(self.calculator.add("//[###]\n10###20###30"), 60) + +if __name__ == "__main__": + unittest.main() + diff --git a/Other/RafehDaniel_2/__pycache__/stringCalculator.cpython-312.pyc b/Other/RafehDaniel_2/__pycache__/stringCalculator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7de4da4cc32c14a02dae09283960657292444219 GIT binary patch literal 8050 zcmd5>No*U}8Gf^HINT{xt1a1-rNpK~EtFzsagrjIyu`KTAa)ija)}Y&NTN)U>deTF z22|k|ZYw)(W4A!9wm>2DP}pz}JqBnG0h&XBUZl{0m_dLF=%u=;mJWr`BK`lz#iB$i zITW=9;5Rex{cro;zs=)cJsu~4>nqpl=xdFH{2gD4m#y%yHV+T?2qlzDl0m%lNp6B4 z<R^qdfg?OQMW}FtP*LR{3i&pJA}h5)sicafQX4C^L#eEiad)BrO}CPyU6rZh${|9u z08c<Rut})!_^@#2$TT<2g`F$-J`m<D;q~KvmRA|p4NZv~6RI(mrtyL>yOkF9EWF-> z?gu$a26<JWoGMaYwT+0dAh9^WpfoLpZC1@27Yr?t8tqe(@u{R@q&3T)nwl6^HQkal z)tJ&!aenhK@Qie<iENZ<@_-w7Kwy5Nt|mt`JCy1u9|~>g@t23*)}f=J(~6OZtFcRo zBu!|EiJ^W~zha~(hq`-W7yJ8Tuj_hZG&P~73_aG}Gj#Fd<{}jfdxy>&W2!dvmNKG_ z^((1_nvC@f0TpF4@0^^r1cg$wZrh?dp|}a>hAdqt%d&e79)MW8CC6eZWkQX`EN3h> zk)~5ge0IlT-<?vD`5FxuYY8x(B_vXY=7m?yh2TT*AV@_3g(La_fEy%d3$F5<%`?}# zO5ir%`xtL)0+DL}iRJm`*s^RVaWuTvngO2dB<!OA`zYr3anQ#0&%bs1*c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$DwcZVk;DH!^)^a}Jyf9LC|^w1akS!r4@=8!1E$o`8wqthuVK!(@*g;j zSot@=1Mx|YuDt?P`ER;yDe5K~V?}TBwKSF_e+nJzJpkpgd7JZH*mv|#!H<VOIq>m& ze{5OYck*-j)Kd@C_R#a8P$YC@1rNZg7~US{kM&77YKaZ2#x+$<6;DCTuIg^NVuPRI zFz+Hf?M%%TD)<~+J!)E&)gNH1XNEHg2g`8a6T{=E*d`BSzEGWo9UJ}vhOH2`Te9AR z-^BhzXwK~K|MKZ;iWsWcw{I1ye2gmgfg3Z_4-B)tIxkP8epQ)-hOD=B7m~n7BRhTU zwlWGJI29};uPgb*;wfcn)I3_9l%3lBrZP?2@|xWd&}|)HT}O7x^7b;OirzNQ(_~st z;PJ58U7e%KEq;saYzt*`+mxtU*0+m7nIFxp15(0cm=PU=Tp5F!wjbergv$uqVwjup zIg$7P{_#`I*6IWnM1BXo=)C}CQEQ<olJ$0!*<H1;H4v`fdSdz#&g@$V#}Q5-yn*m- zgmVaQBD{rg5#b$#O9<%0GzEboj3A65;NgdsM8H2<SlnReY1&bIMZl(d9N-3d4FAft zKbCk~>tlHvyntm4SnZRiC&H(>3hnaJYtZ;KmmeQT#s3{Altd~PgFh<dsZ;{KV&NYH zK^cx~=#@2e&-s59>zO!iNuL7eglyt?*ldZ|!IpJx$gkx8#C%P|uYNo;)!zev<7<vv zJ487D-$>iK1c%vk!a9N5y7M)zexc#eI)VH8asCX)o#y6VT-qC1+#6XZ>~-}$o`~*Q b^E06-C)Qj){o`}rKlj7)s{#@Cuoe9m=mVZT literal 0 HcmV?d00001 diff --git a/Other/RafehDaniel_2/my_calculator.py b/Other/RafehDaniel_2/my_calculator.py new file mode 100644 index 0000000..29b3e3c --- /dev/null +++ b/Other/RafehDaniel_2/my_calculator.py @@ -0,0 +1,58 @@ +#Umsetzungen von RafehDaniel auf meinen Testfälle: StringCalculator +import unittest + +from stringCalculator import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/RafehDaniel_2/stringCalculatorr.py b/Other/RafehDaniel_2/stringCalculatorr.py new file mode 100644 index 0000000..bd21dc8 --- /dev/null +++ b/Other/RafehDaniel_2/stringCalculatorr.py @@ -0,0 +1,88 @@ +from abc import ABC, abstractmethod +import unittest + +class IStringCalculator(ABC): + @abstractmethod + def add(self, numbers: str) -> int: + pass + +class StringCalculator(IStringCalculator): + def add(self, numbers: str) -> int: + if not numbers: + return 0 + + # Überprüfe, ob ein benutzerdefiniertes Trennzeichen angegeben ist + if numbers.startswith("//"): + delimiter_line_end = numbers.find("\n") + delimiter = numbers[2:delimiter_line_end] # Extrahiere das Trennzeichen + numbers = numbers[delimiter_line_end + 1:] # Entferne die erste Zeile mit dem Trennzeichen + else: + delimiter = ',' # Standard-Trennzeichen ist Komma + + # Ersetze alle Vorkommen des Trennzeichens und teile die Eingabe + numbers = numbers.replace("\n", delimiter) + nums = numbers.split(delimiter) + + # Filtere alle Zahlen, die größer als 1000 sind + nums = [int(num) for num in nums if int(num) <= 1000] + + # Prüfe auf negative Zahlen + negatives = [num for num in nums if num < 0] + + if negatives: + # Wenn negative Zahlen vorhanden sind, werfe eine Ausnahme + raise ValueError(f"Negatives not allowed: {', '.join(map(str, negatives))}") + + # Berechne die Summe der Zahlen, die <= 1000 sind + return sum(nums) + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/RafehDaniel_2/your_calculator.py b/Other/RafehDaniel_2/your_calculator.py new file mode 100644 index 0000000..64929f3 --- /dev/null +++ b/Other/RafehDaniel_2/your_calculator.py @@ -0,0 +1,86 @@ +#Meine Implementierungen auf Testfälle anderer Studierenden testen: StringCalculator + +import unittest +from stringCalculator import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.c = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.c, StringCalculator) + + def test_empty(self): + res = self.c.add("") + self.assertEqual(res, 0) + + def test_oneNumber(self): + res = self.c.add("1") + self.assertEqual(res, 1) + + def test_addingTwoNumbers(self): + res = self.c.add("1,2") + self.assertEqual(res, 3) + + def test_addingTwoNumbersWithZero(self): + res = self.c.add("0,5") + self.assertEqual(res, 5) + + def test_handleFloat(self): + res = self.c.add("3.5") + self.assertEqual(res, "only integers allowed") + + def test_handleLetter(self): + res = self.c.add("1, z") + self.assertEqual(res, "only integers allowed") + + def test_addWithBackslashN(self): + res = self.c.add("1\n2,3") + self.assertEqual(res, 6) + + def test_negativeValues(self): + res = self.c.add("-3") + self.assertEqual(res, "negatives not allowed") + + def test_delimiter(self): + res = self.c.add("//;\n1;2") + self.assertEqual(res, 3) + + def test_thousandone(self): + res = self.c.add("2, 1001") + self.assertEqual(res, 2) + + def test_multidelimiter(self): + res = self.c.add("//[***]\n1***2***3") + self.assertEqual(res, 6) + + def test_multi_negative(self): + res = self.c.add("-3, -4") + self.assertEqual(res, "negatives not allowed " + str([-3, -4])) + + def test_space_between_numbers(self): + res = self.c.add(" 4 , 5") + self.assertEqual(res, 9) + + def test_multiple_num_with_thousandone(self): + res = self.c.add(" 2, 1001, 5") + self.assertEqual(res, 7) + + def test_empty_text(self): + res = self.c.add("//;\n") + self.assertEqual(res, 0) + + def test_one_number_with_empty_string(self): + res = self.c.add("1,") + self.assertEqual(res, 1) + + def test_negative_with_positive(self): + res = self.c.add("-2, 5") + self.assertEqual(res, "negatives not allowed") + + def test_mixture(self): + res = self.c.add("//;\n-1;2;1001;-3") + self.assertEqual(res, "negatives not allowed " + str([-1, -3])) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/Other/WeishauptOrlando_2/__pycache__/stringCalculator.cpython-312.pyc b/Other/WeishauptOrlando_2/__pycache__/stringCalculator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2075e23bed85e561a84eea481d9e4a3faf3ec4a0 GIT binary patch literal 6653 zcmd^DTTC0-89sBf$HtDiC5s6cC+TkD#9V9x$p&&EWR;}akWC;rm)%*%GfSNKLT82& zTSiT*tV+~W*{#}!s#}#lHHfOBPvteMeW=tIQ-?yQmAX~?usoFoq}B4&|DUlPY;4kf zSsr>2pU?dBpEKvbod5sN`IFslCD3j<J|F&%jgWugL#}bz&e{}oo)D3URD?vS02QSJ zG=<M}gb6S-IY&h10TEe=nqiDF0amASKs8Bhp33P|Gf;VnxdY!TZh20##EX`@hX|3Y zX#%{}#hir9WJwfB&<WaYUB+iOtuei4`m|laTZ$?NLuyn~Z^y;{(B|=Z!CnLE6C#lS zC6WLwF(M_gA}w+6u^<qe`#`{yVBMTnbzwl2!?EGMU?eme394~fGsi}ww<KB7OtPeo z%CQi=`7_W*b*!=aR}y5J>Yv61vWgUWPc{QpL4KEO<6h|a&{YK{8af|T!y!qy8IFiy zIUF52D=Bx?_{dPZPZ&IVR_Ilf@Ng_D#Z*OT_YDmWZYD`c^bcK9Z%gvfbt$ae4vvnf zm*hw=CdLKd5GbTz`K==fjR}fka`zU=T7isOQV{NwPkGxKbV$G3tnq>n3q~bD(5!+G zjf<lZ?Arw4+oQpV@kU08H3q(?G2xgh?}A6U0>Ob`M=<38d6oSD56BW%vqDpxebT=| z;AhIeia%=%G1Y#KbYnP<EHEd|fNiY-;DtHCm<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ImQGp-<$r@yMoif6b8 z>)5t>eJA7WnY*>X_wK0fOg@jdz1=H2%c{)?V7UTpSeAl#?V{ce#snDIp4=vYl^ygJ ze(f{@mdra9Ypl4xeBCdRze9JMvZ5F}t#}(HFO>J6uQ=5Js_Al0SN-m);=33;CCYw; zE`-++dJs+_V6KoaAiRmtkD#l65PR1UZXjT?*R5gPjUC2EgoE&};HU>=6>g1NR!tPw ziO_{`4B-?)H$oq^YGSy4YSqecR{$yQ1d>k!nc~jq*uAC`j8EYQ@CrN{495fkE(@99 zt&prAC9!hU_|aHcMg1EW+;~-_@u=CpAly9YYpg^XixU)yu)+5j_vt6)cYp`$K?QZW z!cY|T4|3pd#IepYlzoy}C-AdwZJ?a#R}QTc_+9U5p-xki#}@Z`=J$Hm2|lg7OA*#K ck^D2`Tw<&4pZ~$d?_GTV(h5V^dR>_R0+t7Y7ytkO literal 0 HcmV?d00001 diff --git a/Other/WeishauptOrlando_2/my_calculator.py b/Other/WeishauptOrlando_2/my_calculator.py new file mode 100644 index 0000000..6dd72eb --- /dev/null +++ b/Other/WeishauptOrlando_2/my_calculator.py @@ -0,0 +1,58 @@ +#Implementierung von WeishauptOrlando auf meinen Testfälle: StringCalculator +import unittest + +from src.string_calculator import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calculator, StringCalculator) + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/WeishauptOrlando_2/src/__pycache__/Count_ED.cpython-312.pyc b/Other/WeishauptOrlando_2/src/__pycache__/Count_ED.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a69a4d220c6fc349a593a3e05153d521821d4c19 GIT binary patch literal 843 zcmZ`%y=xRf6rb7MJCBgBLdC*jAmC*aJS27^Ld=DjCJ_=5kA-2~d3QUyH+Rm=8WJK{ zq)12+yF@HZVI%o7EN!%t0YR{`JGj`Sa^`L$LGTst`~BW~Gw<`**a))J9PPEr7@?oe zIHyvf^lw<@5HZAXhT6D+G4jw7V%`p7KHw97nAh+&gRu0=86h^6<%LczG{|Ha9rB<s z`q!;;hyXP(Lk*8%@R<ieGhqHs&?q?|bEyC@Sedc}olB8;7r-2rYu!%=SljrSUEp6j zDIBk`jTeJn%whPXsQORbJCASKvNaU?`9rHTK7B|tO&A9<FSg<|BMc<DpC_r(@lz0_ zx>zN-V5C~F5-tdE0d2CTB^NC+y$~z7xhxb2#WjBkVa?#W!Hc11N_n>n(v%YSc-9US zWKCJNEtT7ykTad!i5@ACDtZuWo&bHqGsY!vM|Duob*CHMnxpIWI-OUFw?rF+R`k|f zw7!1P1<rXpTGc7Y=rM4W#(7t-$}ASFL+2tTlW6e%bg^FRZkozqAPQ`2viO$TxyPM} znzrmU`Y}3ou(Y?dzr2gTO-vqa>}|YJ``btH`_|jmaq=$vIx+L5GSj!YXeBJ03Z)`$ z1Epq!(sqaCnbSupeUZmm5%HCl#^*xI30w6M$w@2ZxMQyIfVoRhS1j8>J<l)A9!>R- z6~|MjP7Ett@=EBNal2W~!hvkY2`K4qVu*CrX@AkrDtCty-ILdBz#WOYY+2987=K4o Pr{w_8?xw$y6@#ij2FuRQ literal 0 HcmV?d00001 diff --git a/Other/WeishauptOrlando_2/src/__pycache__/RomanConverter.cpython-312.pyc b/Other/WeishauptOrlando_2/src/__pycache__/RomanConverter.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a767b8ed10891178c55225d35773572f541d007e GIT binary patch literal 1878 zcmZWpO>7%Q6rS0?*v=-YQ`@wKwk{M>7ZkNADixHXDy|^VQkAAnVi~O#@5I^GUZ=C` zO0jGyLOD342S-Axs}>P)0_Bc+;8uwXmy{f^Mnyv6f^Q}Xm!5cUH*Ou6!}n(1yuX=w z-~2K#5Fs#T^-lgRm5@Ji(H*e%$JS{O_lQL-S|CN5p_Et>lPsCZvx=oGDH%l~9}-Jl zB9_MJnjE-g)P=rOsEvyh6+;uBm5Qb_UUF_T?lCT8r(6^oXI_~*IU2b5h-opz)*XO* zBoAr7qcsXr0tsnrvZd6NDzTKCX+ro(@40uCRB2V&4}KMikhL9sntVP?NKLKERcU8; z0M>Gk^-HiOcVh~vDwbNo-52rc-IG=MDoJVOw;}K+!2xVIM3UJKOQu=HE}DgkIaf&9 zPN3tDe=OQ=ZjL20pdL*PwEuz=*-HTJZK%p_0JJR#*Ulh}Asj=%*Jy_k@EY0*0v;nZ zAm}9_jb9Qp4I(Y*xR9pD1-%I3qM*}4nwS>!I*99nP6)!`0tk<yD-|j?ojglv9ODW3 zwpkFeyYPhwb9@s6UxM0#8m<QWNq;=6<lfC*a~XHDADNz=W5$eKuxxG@vuWnu^h)#D z6Jy3?I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V?d00001 diff --git a/Other/WeishauptOrlando_2/src/__pycache__/__init__.cpython-312.pyc b/Other/WeishauptOrlando_2/src/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e6c31dbb7a9c3a386da2249f266946ebeb300bc4 GIT binary patch literal 2369 zcmbtVO>EO<82-NaCyC>RG^M3kX)$A{P1=yZrZ9dg(WZr#QnamO5Q3}_f3z-6(%H@m zKJ|n;!J*n^mC&SWr%hanCXF3-K-%E2T>?qf)e;)rPTWGdOmNv}yG~2RxXe=h{y)$A zz26)6_l5=r;O8n^n>@(^@V8;uk9$*jIYt2RH4uORC6I?{2o2pKIr2oBFm*yA^HiG3 z(`nkYNy(XarCkspw?JL%0zi&B0D^Zn0n^MR5a@4V+JihPaG3)j&AI{3Xb_x;y#oXn zVy4^eHnt>U??TJE1HK_`9fI5MlUB87%U5TPU|gck+=!W3%<M;g%)AdXH*NAZnY@kD z!7V;pLrpgB4&MFm;Jt})sXA}7$<kosK(k-eJRP<<wxr;-vuyd!>|J)2E#H~#v$Jez zWebgO+PGU<@Y_CHTDfMdK9RS?cH2H%ZgRZsc8tAn)u*%v-%c~WomSMkxfg-@UIfhh z*)yHonv|`ffX%eye%`VdH<$we?fL-7fwa%O6Kmt#$oFRLMIbO~-zDDyy#0}-&B9r5 zowx{Q;U+?B9l_}BKM`)Do%O+%=SJ&6s566EDOZxRYEj0PbFf${s7MYvbnnN-e6}!H zEPR1v?9o}Vpz>;wmkl>g^?jnsVqtQtTzBz&J}VY@KFDZ9ygQ-Mv1qtA64#tviSA@D z6xYZ^cXtxM!{MYx#iAh`Ba)G*Mw<yioycCvX;e573MVvX2%~4Oprc%8X&3Ibll$xD zSKP^xVmV9Rx^EawNk~4*jqCmV|9XNholc?LHGEp2Q>U|%RMcE4By&Rwl608T;gAjm z9imbXCZ9lx%E`a{m=~4Y6ynm^DTxycTncGoJ}YU4S<2653j&e~y7TPd*$aas=XK%& ze$j)e3u7baOU5tVgxOw%F?OI@F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1p5+X8*GA<@eO%qjvR^nlz$>u1HnXkTtux$iY z0Z)q2fL%jyUXvAUy9l;D%u*S*{a0ko#Dj$7i0w77%wpMfL(@8yr^-T)k~4K`yYZx~ z*?yLiZctfgAcD%oo{W~0soj{uB<EyY_VW!-=PS6rgq*Fgf<Z~tZMzMuWr&yM&S#)u zYSf0<;H@pPwK1ujOkXxIG1BMRFjcU0Rn?G6)NDGAjR~5|r;qkX!|}LuhRxA2J&Sc} zNJo3p!^2xem<x}klWZoF^m|w}#$_{4lkDYml#_bW22s+=<_98{pSFF@5f^q<M}BNm z$|s`{Wi#_bu<AbGOTu594nA+{de+o+e_%0GY&w4T!nzmi3eWX^+H19RFE%gl>|Y6s zR@>QPc)$t{tk;5I=;P^o(^gY#(Z3uxwGwW#4kU}=OIGmGsuu*Cp9fl>1zHz`VxaxL z|9PbMS)}*T&SK>BkAc%Apn+mIZUy6Ips9OP^R)||%Yh@`hQ8bT&E7|mCl{7qOO^~r zi($nIDlDCF^L*#Rtwm~e^gkLc?mlz(91{kc=R3YS_RzC%csbC$vZrPK%4f4yu>A#3 zwznAWvx0qpy$FbZ0O(7=mC!+}{oP{dqE&x!CAja4s}Frvpoi;{OxI$y#-9#--?((; z$$4x4#bPL7)hGU56}Wc8c!fRL?SaU^39!^v$LWbf@jl_{{yp*I!qej(#wVgRcC94o ztVSfs_DfPWhfIz0tXbYSWv!yAktCE;B#E>zNWw=SX=CJTu*N7LA}9R+h7#e7v5%2E z;3xOss=M8jgbM?!fbaJQ*GoG&<XA`DgpYiC2P=sfD{D+LtW6BUzp7=-4$hVAMaFH^ n_Lq}<gGAYpe?*NYM%bkx{2BOu0Uhh!Lof+H+4m>ld&%`55cy3D literal 0 HcmV?d00001 diff --git a/Other/WeishauptOrlando_2/src/__pycache__/interfaces.cpython-312.pyc b/Other/WeishauptOrlando_2/src/__pycache__/interfaces.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6219bfc375082ce2fd1f73bcfd756ebca8b34d4b G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f$bq;zNw!LGG7z63RGNr$2|j#=D<gKfat_;O3YSz6C=+ z6u}VNOhJLVOGnQyVV?WCqL5q@yI8oxds7j%CTEE^^#%#5>Z>_;i<VAtaE~w&l+tMq zyqp8?KRF<$Yv5pRXQHdu;JX6_*ka=7Y8qJ6%ImmU)bZPNgvngadc_X|u*baoOzRS+ zGiYiwkJ#_k`ju%+%lknrj9NsG=|pnENW6*9WFjrB;`WH4`f2-&R8h=m<;6@+)Ylx* z^OS=x`Q6F-Q+7o%j%d}?H(yjg$lKpXihif~gJb%A6eGv7tl!w;MWtpn9y=Ed)y3VC a)%adtFjN;c6hC;mU3bu4{F|Z5!ubb{(c!27 literal 0 HcmV?d00001 diff --git a/Other/WeishauptOrlando_2/src/__pycache__/string_calculator.cpython-312.pyc b/Other/WeishauptOrlando_2/src/__pycache__/string_calculator.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3598fbabdabad4ddd589f69bedaf1572f553b5e0 GIT binary patch literal 2410 zcmaJ?O-vg{6rNrGVH;xp0u2exCXgm>HW)(!3aXkPoTNVysD=ELI<hvN!7S{qo!NB| z$d;-qs$3~mLwbO=s>-1UA`T_WA(5Ix6*yGt#Su|LS3N{+59Q{Dq*A!FZ?M-GiaL_t zym{}N@4YuO`}}i7g$KcimFHp^7ec?Yg*6-nW#u(cCJ{!MQ;^CHa2(>%8HD+32-^rZ zYs=#X_%XZRvCI~J&a8U7&!Dmv>z0&gQjv@}jpku_X)i2Rc7Za92pZrp8sITUY?vqZ zK|8ixvky2JqglC`$#iK+^)jKl>7>L+QZ34taJxZgDXmbjPNEd2b7LIl(|n2>=1On{ z729SDR(cW;g<?u^*p3~ug$QAo)3!91vTe!bEOONY!aBebGVCfMoGBYF!|n!@<~0ZC z9_(d0<Nz13c|Z=ll><cI5|iRLVYaG;x8kSmDSHTg?uha+6y+}kpe{$sG0aYH)0i!+ zarsCmLOOT7-tbzG|KDN7n&7Vo?I`Vp2+oq2@bp+r%#FaQ0<Sye0Ax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1I0?wB*~j@=$xs9EUy$-j7_f3fpiw&Q%Z@xo&D#ccUS z$Y_7Z<A(0(s(V%U@DDq_3T7L+Gd>W1_^NLlTl6($%bH$3+X1m&KJ%dMT}<u_ae6bH z<b�La*B&9NY<VzT6WE*yro*AQ!fILWk`OJM18P{7$nh644};L?Wgq5>ewgsW81f z61kF;l)Q&R$40b{3C4U2t$;+di3#@CyC&E>)ma<AhH`v|qj{=5hhUm+f6gZAw{Sgv zo4E~MM+<xfgbu=Yp;PwJ<(UpJZ4JxVSIgeWXY?jL2ut>%>h&OUHjd+7I1zW~xwDgN N&ek7zfnZ+S_%Hq_R<{5E literal 0 HcmV?d00001 diff --git a/Other/WeishauptOrlando_2/stringCalculator.py b/Other/WeishauptOrlando_2/stringCalculator.py new file mode 100644 index 0000000..bd21dc8 --- /dev/null +++ b/Other/WeishauptOrlando_2/stringCalculator.py @@ -0,0 +1,88 @@ +from abc import ABC, abstractmethod +import unittest + +class IStringCalculator(ABC): + @abstractmethod + def add(self, numbers: str) -> int: + pass + +class StringCalculator(IStringCalculator): + def add(self, numbers: str) -> int: + if not numbers: + return 0 + + # Überprüfe, ob ein benutzerdefiniertes Trennzeichen angegeben ist + if numbers.startswith("//"): + delimiter_line_end = numbers.find("\n") + delimiter = numbers[2:delimiter_line_end] # Extrahiere das Trennzeichen + numbers = numbers[delimiter_line_end + 1:] # Entferne die erste Zeile mit dem Trennzeichen + else: + delimiter = ',' # Standard-Trennzeichen ist Komma + + # Ersetze alle Vorkommen des Trennzeichens und teile die Eingabe + numbers = numbers.replace("\n", delimiter) + nums = numbers.split(delimiter) + + # Filtere alle Zahlen, die größer als 1000 sind + nums = [int(num) for num in nums if int(num) <= 1000] + + # Prüfe auf negative Zahlen + negatives = [num for num in nums if num < 0] + + if negatives: + # Wenn negative Zahlen vorhanden sind, werfe eine Ausnahme + raise ValueError(f"Negatives not allowed: {', '.join(map(str, negatives))}") + + # Berechne die Summe der Zahlen, die <= 1000 sind + return sum(nums) + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + self.calculator = StringCalculator() + + def test_empty_string(self): + self.assertEqual(self.calculator.add(""), 0) + + def test_single_number(self): + self.assertEqual(self.calculator.add("1"), 1) + + def test_two_numbers(self): + self.assertEqual(self.calculator.add("1,2"), 3) + + def test_multiple_numbers(self): + self.assertEqual(self.calculator.add("1,2,3,4,5"), 15) + + def test_numbers_with_newline(self): + self.assertEqual(self.calculator.add("1\n2,3"), 6) + + def test_numbers_with_multiple_newlines(self): + self.assertEqual(self.calculator.add("1\n2\n3\n4\n5"), 15) + + def test_negative_number(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,3") + self.assertEqual(str(context.exception), "Negatives not allowed: -2") + + def test_multiple_negative_numbers(self): + with self.assertRaises(ValueError) as context: + self.calculator.add("1,-2,-3,4") + self.assertEqual(str(context.exception), "Negatives not allowed: -2, -3") + + def test_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n1;2"), 3) + + def test_custom_delimiter_with_newline(self): + self.assertEqual(self.calculator.add("//;\n1;2\n3"), 6) + + def test_custom_delimiter_with_multiple_numbers(self): + self.assertEqual(self.calculator.add("//|\n1|2|3|4"), 10) + + def test_numbers_greater_than_1000(self): + self.assertEqual(self.calculator.add("2,1001"), 2) + + def test_numbers_greater_than_1000_with_custom_delimiter(self): + self.assertEqual(self.calculator.add("//;\n2;1001"), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/Other/WeishauptOrlando_2/your_calculator.py b/Other/WeishauptOrlando_2/your_calculator.py new file mode 100644 index 0000000..967500c --- /dev/null +++ b/Other/WeishauptOrlando_2/your_calculator.py @@ -0,0 +1,74 @@ +#Meine Implementierungen auf Testfälle anderer Studierenden testen: StringCalculator + +import unittest +from stringCalculator import StringCalculator + +class TestStringCalculator(unittest.TestCase): + def setUp(self): + # Vor jedem Test wird eine Instanz des Calculators erstellt + self.calc = StringCalculator() + + def test_implements_interface(self): + self.assertIsInstance(self.calc, StringCalculator) + + def test_add_empty_string(self): + # Leerer String → 0 + self.assertEqual(self.calc.add(""), 0) + + def test_add_single_number(self): + # Ein einzelner Wert → int + self.assertEqual(self.calc.add("1"), 1) + + def test_add_two_numbers(self): + # Zwei Zahlen → Summe + self.assertEqual(self.calc.add("1,2"), 3) + + def test_add_multiple_numbers(self): + # Mehr als zwei Zahlen → Summe + self.assertEqual(self.calc.add("1,2,3"), 6) + self.assertEqual(self.calc.add("1,2,3,4,5"), 15) + + def test_add_ignores_empty_entries(self): + # Leere Einträge ignorieren → Summe + self.assertEqual(self.calc.add("1,,2"), 3) + self.assertEqual(self.calc.add("1, ,2"), 3) + self.assertEqual(self.calc.add(",,1,,2,,,"), 3) + + def test_add_with_newlines_between_numbers(self): + # Zeilenumbrüche als Trennzeichen erlauben → Summe + self.assertEqual(self.calc.add("1\n2,3"), 6) + self.assertEqual(self.calc.add("1,2\n3"), 6) + self.assertEqual(self.calc.add("1\n2\n3"), 6) + + def test_add_raises_exception_on_negative_number(self): + # Negative Zahlen → Exception mit allen negativen Werten + with self.assertRaises(ValueError) as context: + self.calc.add("1,-2") + self.assertIn("negatives not allowed: -2", str(context.exception)) + + def test_add_raises_exception_on_multiple_negatives(self): + # Negative Zahlen → Exception mit allen negativen Werten + with self.assertRaises(ValueError) as context: + self.calc.add("-1,-2,3") + self.assertIn("negatives not allowed: -1, -2", str(context.exception)) + + def test_add_with_custom_delimiter(self): + # Benutzerdefinierter Delimiter über Präfix: "//<delimiter>\n" + self.assertEqual(self.calc.add("//;\n1;2"), 3) + self.assertEqual(self.calc.add("//|\n4|5|6"), 15) + self.assertEqual(self.calc.add("//_\n7_8_9"), 24) + + def test_add_ignores_numbers_greater_than_1000(self): + # Zahlen größer als 1000 ignorieren + self.assertEqual(self.calc.add("2,1001"), 2) + self.assertEqual(self.calc.add("1000,1"), 1001) + self.assertEqual(self.calc.add("1234,1001,3"), 3) + + def test_add_with_multi_char_delimiter(self): + # Delimiter mit beliebiger Länge (Format: //[delimiter]\n) + self.assertEqual(self.calc.add("//[***]\n1***2***3"), 6) + self.assertEqual(self.calc.add("//[abc]\n4abc5abc6"), 15) + self.assertEqual(self.calc.add("//[+]\n1+2+3"), 6) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index e55739a..0000000 --- a/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# ModernDev - - - -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command: - -``` -cd existing_repo -git remote add origin https://gitlab.reutlingen-university.de/Hatice.Yildirim/moderndev.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://gitlab.reutlingen-university.de/Hatice.Yildirim/moderndev/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README - -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. -- GitLab