diff --git a/ProjektTest/__pycache__/stringCalculator.cpython-313.pyc b/ProjektTest/__pycache__/stringCalculator.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..269227fe4ae0ca3fece8068c0dc8f3ece3f43caf Binary files /dev/null and b/ProjektTest/__pycache__/stringCalculator.cpython-313.pyc differ diff --git a/other/AliciMuhamed/Stringcalculator b/ProjektTest/other/AliciMuhamed/Stringcalculator similarity index 97% rename from other/AliciMuhamed/Stringcalculator rename to ProjektTest/other/AliciMuhamed/Stringcalculator index fc44a5aa2e889ec677e3551e4659dcd805a9cb33..227c1af02f001a628f3dcfeae26e49a2582d7078 100644 --- a/other/AliciMuhamed/Stringcalculator +++ b/ProjektTest/other/AliciMuhamed/Stringcalculator @@ -27,6 +27,9 @@ import unittest import re +import sys +sys.path.append("/Users/marvin/Documents/GitHub/assignment-2") +from ProjektTest.stringCalculator import StringCalculator as Calc class StringCalculator: def __init__(self): diff --git a/other/BerishaAlma/Feature6.py b/ProjektTest/other/BerishaAlma/Feature6.py similarity index 100% rename from other/BerishaAlma/Feature6.py rename to ProjektTest/other/BerishaAlma/Feature6.py diff --git a/other/BerishaAlma/__pycache__/Feature6.cpython-313.pyc b/ProjektTest/other/BerishaAlma/__pycache__/Feature6.cpython-313.pyc similarity index 100% rename from other/BerishaAlma/__pycache__/Feature6.cpython-313.pyc rename to ProjektTest/other/BerishaAlma/__pycache__/Feature6.cpython-313.pyc diff --git a/other/BerishaAlma/stringCalculator.py b/ProjektTest/other/BerishaAlma/stringCalculator.py similarity index 100% rename from other/BerishaAlma/stringCalculator.py rename to ProjektTest/other/BerishaAlma/stringCalculator.py diff --git a/other/GotsisWasilios/TDD_StringCalculator.py b/ProjektTest/other/GotsisWasilios/TDD_StringCalculator.py similarity index 100% rename from other/GotsisWasilios/TDD_StringCalculator.py rename to ProjektTest/other/GotsisWasilios/TDD_StringCalculator.py diff --git a/other/RafehDaniel/__pycache__/stringCalculator.cpython-313.pyc b/ProjektTest/other/RafehDaniel/__pycache__/stringCalculator.cpython-313.pyc similarity index 100% rename from other/RafehDaniel/__pycache__/stringCalculator.cpython-313.pyc rename to ProjektTest/other/RafehDaniel/__pycache__/stringCalculator.cpython-313.pyc diff --git a/other/RafehDaniel/stringCalculator.py b/ProjektTest/other/RafehDaniel/stringCalculator.py similarity index 100% rename from other/RafehDaniel/stringCalculator.py rename to ProjektTest/other/RafehDaniel/stringCalculator.py diff --git a/other/YildirimHatice/StringCalculator.py b/ProjektTest/other/YildirimHatice/StringCalculator.py similarity index 100% rename from other/YildirimHatice/StringCalculator.py rename to ProjektTest/other/YildirimHatice/StringCalculator.py diff --git a/other/YildirimHatice/__pycache__/StringCalculator.cpython-313.pyc b/ProjektTest/other/YildirimHatice/__pycache__/StringCalculator.cpython-313.pyc similarity index 100% rename from other/YildirimHatice/__pycache__/StringCalculator.cpython-313.pyc rename to ProjektTest/other/YildirimHatice/__pycache__/StringCalculator.cpython-313.pyc diff --git a/other/YildirimHatice/feature6.py b/ProjektTest/other/YildirimHatice/feature6.py similarity index 100% rename from other/YildirimHatice/feature6.py rename to ProjektTest/other/YildirimHatice/feature6.py diff --git a/report.md b/ProjektTest/report.md similarity index 50% rename from report.md rename to ProjektTest/report.md index a4b8de5f2a1db8e6ab8f91f80b3a440d8699b4ad..56caa0b4cf6cd706d2872e53963bbdc491868c27 100644 --- a/report.md +++ b/ProjektTest/report.md @@ -9,3 +9,17 @@ | RafehDaniel | no | 2 | | WeishauptOrlando | – | – | | YildirimHatice | – | 10 | + + + +## Eigene Implementierung gegen andere Tests + +| Name | Interface break | Failed Testcases | +|-------------------|------------------|-------------------| +| AliciMuhamed | no | 0 | +| BerishaAlma | - | - | +| GotsisWasilios | - | - | +| PikkemaatLasse | – | – | +| RafehDaniel | - | - | +| WeishauptOrlando | – | – | +| YildirimHatice | – | - | diff --git a/stringCalculator.py b/ProjektTest/stringCalculator.py similarity index 100% rename from stringCalculator.py rename to ProjektTest/stringCalculator.py diff --git a/feature7 b/feature7 index e8d1959c5f05679732d0234effd0fbc6fb40277c..e8ed4b257687833874c5bad485735629fc5dc2e1 100644 --- a/feature7 +++ b/feature7 @@ -1,54 +1,54 @@ import re import unittest -from other.YildirimHatice.StringCalculator import StringCalculator as Hatice -#class StringCalculator: - # def add(self, numbers: str) -> int: - # Feature 1: Leerer String ergibt 0 - #if not numbers: - # return 0 + +class StringCalculator: + def add(self, numbers: str) -> int: + #Feature 1: Leerer String ergibt 0 + if not numbers: + return 0 # Vorbereitung für weiter features - #delimiters = [",", "\n"] - #if numbers.startswith("//"): - # delimiter_end_index = numbers.index("\n") - # delimiter_section = numbers[2:delimiter_end_index] - # numbers = numbers[delimiter_end_index + 1:] + delimiters = [",", "\n"] + if numbers.startswith("//"): + delimiter_end_index = numbers.index("\n") + delimiter_section = numbers[2:delimiter_end_index] + numbers = numbers[delimiter_end_index + 1:] # Feature 7: Delimiter beliebiger Länge im Format //[***] - #if delimiter_section.startswith("[") and delimiter_section.endswith("]"): - # delimiter = re.escape(delimiter_section[1:-1]) - #else: - # delimiter = re.escape(delimiter_section) + if delimiter_section.startswith("[") and delimiter_section.endswith("]"): + delimiter = re.escape(delimiter_section[1:-1]) + else: + delimiter = re.escape(delimiter_section) - #delimiters.append(delimiter) + delimiters.append(delimiter) # Feature 3: Erlaube Zeilenumbrüche als Trenner - #split_pattern = "|".join(delimiters) - #number_list = re.split(split_pattern, numbers) + split_pattern = "|".join(delimiters) + number_list = re.split(split_pattern, numbers) # Feature 4: Negativzahlen abfangen - #negatives = [] - #for num in number_list: - # if num.strip() != "": - # value = int(num) - # if value < 0: - # negatives.append(value) + negatives = [] + for num in number_list: + if num.strip() != "": + value = int(num) + if value < 0: + negatives.append(value) # Exception bei negativen Zahlen - #if negatives: - # raise ValueError(f"Negative numbers are not allowed: {', '.join(map(str, negatives))}") + if negatives: + raise ValueError(f"Negative numbers are not allowed: {', '.join(map(str, negatives))}") - # Feature 2: Beliebig viele Zahlen summieren - #return sum(int(n) for n in number_list if n.strip() != "" and int(n) <= 1000) + #Feature 2: Beliebig viele Zahlen summieren + return sum(int(n) for n in number_list if n.strip() != "" and int(n) <= 1000) @@ -57,7 +57,7 @@ class TestStringCalculator(unittest.TestCase): def setUp(self): """neue Instanz des StringCalculators vor jedem Test""" - self.calculator = Hatice() + self.calculator = StringCalculator() def test_empty_string_returns_zero(self): """Feature 1: Leerer String soll 0 ergeben""" diff --git a/other/AliciMuhamed/__pycache__/__init__.cpython-313.pyc b/other/AliciMuhamed/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index f59d9aef39912fbf3c48c517faee693e27ca18af..0000000000000000000000000000000000000000 Binary files a/other/AliciMuhamed/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/other/__pycache__/__init__.cpython-313.pyc b/other/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 2f81337b3f670f5b88bbb598ac7352a7f961b3d1..0000000000000000000000000000000000000000 Binary files a/other/__pycache__/__init__.cpython-313.pyc and /dev/null differ