diff --git a/Project_Test/other/GotsisWasilios/TDD_StringCalculator.py b/Project_Test/other/GotsisWasilios/TDD_StringCalculator.py index ab815fa39c47d98569acffd1e808502bcb285a94..6da3cb91f23dc1aa2a4fbcee873c182aba860ef4 100644 --- a/Project_Test/other/GotsisWasilios/TDD_StringCalculator.py +++ b/Project_Test/other/GotsisWasilios/TDD_StringCalculator.py @@ -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__": diff --git a/Project_Test/report.md b/Project_Test/report.md index 9322248952e790bdae8b2160b7d91b615bfd605b..9b4ca975bd076cfcef910a1aa647a3c73f237ea0 100644 --- a/Project_Test/report.md +++ b/Project_Test/report.md @@ -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 | | |