diff --git a/stringCalculator.py b/stringCalculator.py index 7466966eda7708d599657884b0f273db74adafac..046696aed38d562fac9db7364da6dbe5d82daba9 100644 --- a/stringCalculator.py +++ b/stringCalculator.py @@ -23,6 +23,9 @@ class StringCalculator(IStringCalculator): '''Leere Eingabe soll 0 ausgeben''' if numbers == "": return 0 + '''Eingabe einer Zahl als String soll den Integer Wert ausgeben''' + return int(numbers) + class TestStringCalculator(unittest.TestCase): def setUp(self): @@ -32,5 +35,9 @@ class TestStringCalculator(unittest.TestCase): res = self.c.add("") self.assertEqual(res, 0) + def test_oneNumber(self): + res = self.c.add("1") + self.assertEqual(res, 1) + if __name__ == "__main__": unittest.main() \ No newline at end of file