Browse Source

added test for conversion from radian to degree with some tolerance as well as corresponding functionality

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

3
src/main/py/trigonometry.py

@ -0,0 +1,3 @@
import math
def rad2deg(radNumber):
return (radNumber * 180) / math.pi

20
src/test/py/test_trigonometry.py

@ -0,0 +1,20 @@
import unittest
from src.main.py.trigonometry import *
class MyTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_rad_2_to_deg_should_be_114_point_59(self):
delta = rad2deg(2) - 114.59
if delta < 0:
delta *= -1
self.assertLess(delta, 0.01)
if __name__ == '__main__':
unittest.main()
Loading…
Cancel
Save