Browse Source

Added test for fraction conversion to decimal as well as corresponding functionality

remotes/origin/feature/feature-fractions
fdai7764 11 months ago
parent
commit
fcf1b7cbc9
  1. 2
      src/main/py/fractions.py
  2. 17
      src/test/py/test_fractions.py

2
src/main/py/fractions.py

@ -0,0 +1,2 @@
def frac_to_dec(num, denom):
return num/denom

17
src/test/py/test_fractions.py

@ -0,0 +1,17 @@
import unittest
from src.main.py.fractions import *
class fractions(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_dec_value_of_20_by_5_should_be_4(self):
self.assertEqual(frac_to_dec(20,5), 4) # add assertion here
if __name__ == '__main__':
unittest.main()
Loading…
Cancel
Save