From f793a2d5e7b0ac021472ae99edc167e547589898 Mon Sep 17 00:00:00 2001 From: fdai7764 Date: Sat, 27 Jan 2024 13:46:39 +0100 Subject: [PATCH] added test to check if multiplication of two roots with both positive numbers returns the right number as well as corresponding functionality --- src/main/py/calculations_with_roots.py | 4 +++- src/test/py/test_calculations_with_roots.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/py/calculations_with_roots.py b/src/main/py/calculations_with_roots.py index 3cf4ee6..fb73efe 100644 --- a/src/main/py/calculations_with_roots.py +++ b/src/main/py/calculations_with_roots.py @@ -1,2 +1,4 @@ +import math + def multiplyRoots(first_number, second_number): - return 0 \ No newline at end of file + return math.sqrt(first_number * second_number) \ No newline at end of file diff --git a/src/test/py/test_calculations_with_roots.py b/src/test/py/test_calculations_with_roots.py index 713dcc2..17fb5c2 100644 --- a/src/test/py/test_calculations_with_roots.py +++ b/src/test/py/test_calculations_with_roots.py @@ -12,6 +12,9 @@ class calculationsWithRoots(unittest.TestCase): def test_sqrt_0_times_sqrt_8_should_be_0(self): self.assertEqual(multiplyRoots(0, 8), 0) + def test_sqrt_2_times_sqrt_8_should_be_4(self): + self.assertEqual(multiplyRoots(2, 8), 4) + if __name__ == '__main__': unittest.main()