diff --git a/src/main/py/trigonometry.py b/src/main/py/trigonometry.py new file mode 100644 index 0000000..ac7fbce --- /dev/null +++ b/src/main/py/trigonometry.py @@ -0,0 +1,3 @@ +import math +def rad2deg(radNumber): + return (radNumber * 180) / math.pi \ No newline at end of file diff --git a/src/test/py/test_trigonometry.py b/src/test/py/test_trigonometry.py new file mode 100644 index 0000000..fcd919b --- /dev/null +++ b/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()