@ -8,3 +8,7 @@ def reduceFraction(num, denom):
num /= gcdOfFraction
denom /= gcdOfFraction
return (num, denom)
def addFractions(num1, denom1, num2, denom2):
result_num = num1 + num2
return (result_num, denom1)
@ -18,6 +18,9 @@ class fractions(unittest.TestCase):
def test_reduce_fraction_56_by_32_should_be_7_by_4(self):
self.assertEqual(reduceFraction(56,32), (7,4))
def test_add_fractions_1_by_5_and_2_by_5_should_be_3_by_5(self):
self.assertEqual(addFractions(1,5,2,5), (3,5))
if __name__ == '__main__':
unittest.main()