From 506a816f1000fae13ee8da564a7955086649c7da Mon Sep 17 00:00:00 2001
From: linopino <lasse.pikkemaat@web.de>
Date: Wed, 19 Mar 2025 11:39:38 +0100
Subject: [PATCH] 1

1
---
 Test.py       |  3 ++-
 calculator.py | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 calculator.py

diff --git a/Test.py b/Test.py
index 3dc0985..903e6d7 100644
--- a/Test.py
+++ b/Test.py
@@ -1 +1,2 @@
-print("Hello WORLD")
\ No newline at end of file
+print("Hello WORLD")
+print("test")
\ No newline at end of file
diff --git a/calculator.py b/calculator.py
new file mode 100644
index 0000000..e799761
--- /dev/null
+++ b/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()
-- 
GitLab