From 2736a4561103c3828ce8bca0a62148e4ceecdb05 Mon Sep 17 00:00:00 2001 From: DaniRafeh28 <daniel.rafeh@student.reutlingen-university.de> Date: Sat, 5 Apr 2025 13:28:41 +0200 Subject: [PATCH] 2 Testcases failed - Report table adjusted --- .../GotsisWasilios/TDD_StringCalculator.py | 25 +++++++++++-------- Project_Test/report.md | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Project_Test/other/GotsisWasilios/TDD_StringCalculator.py b/Project_Test/other/GotsisWasilios/TDD_StringCalculator.py index ab815fa..6da3cb9 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 9322248..9b4ca97 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 | | | -- GitLab