Skip to content
Snippets Groups Projects
Commit 3dd15b32 authored by Daniel Rafeh's avatar Daniel Rafeh
Browse files

Test successful

parent 27612a3f
No related branches found
No related tags found
Loading
Pipeline #20037 passed
......@@ -41,6 +41,9 @@ class StringCalculator(IStringCalculator):
result = 0
for num in list:
result += int(num.strip())
'''Negative Ergebnisse nicht gestatten'''
if result < 0:
return "negatives not allowed"
return result
......@@ -77,6 +80,10 @@ class TestStringCalculator(unittest.TestCase):
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")
if __name__ == "__main__":
unittest.main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment