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

2 Testcases failed - Report table adjusted

parent 95c2c26b
No related branches found
No related tags found
No related merge requests found
Pipeline #20144 passed
......@@ -13,6 +13,9 @@
import unittest
from abc import ABC, abstractmethod
import sys
sys.path.append(r'C:\Users\HP\Downloads\ReportingService\ReportingService\Frontend\Neuer Ordner\Neuer Ordner\modern-dev-tdd-assignments')
from Project_Test.stringCalculator import StringCalculator as DaniCalc
#Interface für StringCalculator
class IStringCalculator(ABC):
......@@ -58,52 +61,52 @@ class StringCalculator(IStringCalculator):
#mplementierung der Testklasse für StringCalculator
class TestStringCalculator(unittest.TestCase):
def test_add_empty(self):
c = StringCalculator()
c = DaniCalc()
self.assertEqual(c.add(""), 0)
def test_add_one_string(self):
c = StringCalculator()
c = DaniCalc()
self.assertEqual(c.add("1"), 1)
def test_add_two_string(self):
c = StringCalculator()
c = DaniCalc()
self.assertEqual(c.add("1,2"), 3)
def test_add_multiple_string(self):
c = StringCalculator()
c = DaniCalc()
self.assertEqual(c.add("1,2,3,4,5,6,7"), 28)
def test_add_new_lines(self):
c = StringCalculator()
c = DaniCalc()
self.assertEqual(c.add("1\n2,3,4"), 10)
def test_add_exception(self):
c = StringCalculator()
c = DaniCalc()
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()
c = DaniCalc()
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()
c = DaniCalc()
self.assertEqual(c.add("//;\n1;2"), 3)
def test_add_numbers_greater_than_1000(self):
c = StringCalculator()
c = DaniCalc()
self.assertEqual(c.add("2,1001"),2)
self.assertEqual(c.add("2,10022\n6"),8)
def test_delimiters_of_any_length(self):
c = StringCalculator()
c = DaniCalc()
self.assertEqual(c.add("//[***]\n1***2***3"), 6)
def test_delimiters_of_any_length2(self):
c = StringCalculator()
c = DaniCalc()
self.assertEqual(c.add("//[*+*+*]\n1*+*+*2*+*+*3*+*+*220"), 226)
if __name__ == "__main__":
......
......@@ -16,7 +16,7 @@ String Calculator - My Code tested with the other students testcases
|------------------|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| AliciMuhamed | no | 4 failed testcases (the tests expected a ValueError to be raised but it wasn´t - test_add_numbers_greater_1000_and_minus, test_add_numbers_with_custom_delimiter, test_multiple_negative_numbers_exception, test_negative_number_exception) |
| BerishaAlma | no | 2 failed testcases (the tests expected a ValueError to be raised but it wasn't - test_negative_number, test_multiple_negative_numbers) |
| GotsisWasilios | | |
| GotsisWasilios | no | 2 failed testcases ( the test expected a ValueError to be raised but it wasn't - test_add_exception, test_add_negative_numbers) |
| PikkemaatLasse | | |
| YildirimHatice | | |
| WeishauptOrlando | | |
......
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