From 3536cc870295d79c45342d0a09a8b7848144b89e Mon Sep 17 00:00:00 2001 From: fdai7764 Date: Sun, 28 Jan 2024 15:35:21 +0100 Subject: [PATCH] added test for conversion of zero degrees to radians as well as corresponding functionality --- src/main/py/trigonometry.py | 3 +++ src/test/py/test_trigonometry.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/py/trigonometry.py b/src/main/py/trigonometry.py index 79eb798..3bfddac 100644 --- a/src/main/py/trigonometry.py +++ b/src/main/py/trigonometry.py @@ -14,6 +14,9 @@ def pi_approx_leibniz(precision): def rad2deg(radNumber): return (radNumber * 180) / math.pi +def deg2rad(degNumber): + return degNumber + def sin_approx_bhaskara(radNumber): shallFlipTheResult = False #the bhaskara function can only be used between zero and pi. For the rest of the sin period I simply mirrored the first arch of the curve to match the actual sine wave diff --git a/src/test/py/test_trigonometry.py b/src/test/py/test_trigonometry.py index ea90e73..9045e49 100644 --- a/src/test/py/test_trigonometry.py +++ b/src/test/py/test_trigonometry.py @@ -37,6 +37,9 @@ class MyTestCase(unittest.TestCase): delta *= -1 self.assertLess(delta, 0.01) + def test_0_deg_to_rad_should_be_0(self): + self.assertEqual(deg2rad(0), 0) + def test_sin_0_should_be_0(self): self.assertEqual(sin_approx_bhaskara(0), 0)