Browse Source

added test for sin of 0 as well as corresponding functionality

remotes/origin/feature/feature-trigonometry
fdai7764 11 months ago
parent
commit
c37fec2514
  1. 5
      src/main/py/trigonometry.py
  2. 3
      src/test/py/test_trigonometry.py

5
src/main/py/trigonometry.py

@ -12,4 +12,7 @@ def pi_approx_leibniz(precision):
return multiply(result, 4) return multiply(result, 4)
def rad2deg(radNumber): def rad2deg(radNumber):
return (radNumber * 180) / math.pi
return (radNumber * 180) / math.pi
def sin_approx_bhaskara(radNumber):
return radNumber

3
src/test/py/test_trigonometry.py

@ -36,6 +36,9 @@ class MyTestCase(unittest.TestCase):
delta *= -1 delta *= -1
self.assertLess(delta, 0.01) self.assertLess(delta, 0.01)
def test_sin_0_should_be_0(self):
self.assertEqual(sin_approx_bhaskara(0), 0)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Loading…
Cancel
Save