diff --git a/src/main/py/more_advanced_calculations.py b/src/main/py/more_advanced_calculations.py new file mode 100644 index 0000000..449119c --- /dev/null +++ b/src/main/py/more_advanced_calculations.py @@ -0,0 +1,6 @@ +def gcd(a,b): + while a != b: + if a < b: + (a,b) = (b,a) + a -= b + return a \ No newline at end of file diff --git a/src/test/py/test_more_advanced_calculations.py b/src/test/py/test_more_advanced_calculations.py new file mode 100644 index 0000000..720df91 --- /dev/null +++ b/src/test/py/test_more_advanced_calculations.py @@ -0,0 +1,18 @@ +import unittest +from src.main.py.more_advanced_calculations import * + + +class more_advanced_calculations(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + pass + + def test_gcd_of_747_and_81_should_be_9(self): + self.assertEqual(gcd(747,81), 9) + + + +if __name__ == '__main__': + unittest.main()