diff options
author | Hardik Ghaghada | 2014-06-12 13:22:13 +0530 |
---|---|---|
committer | Hardik Ghaghada | 2014-06-12 13:22:13 +0530 |
commit | 1f7318ca9553270899537d98d75e9f4fced85ed4 (patch) | |
tree | 7d149f9203f7eb122e749696e570d10086275ce4 /tdd/math_utils | |
parent | 985adfa4f8a8b9cfba2b0a573dadc77283651957 (diff) | |
download | sees-1f7318ca9553270899537d98d75e9f4fced85ed4.tar.gz sees-1f7318ca9553270899537d98d75e9f4fced85ed4.tar.bz2 sees-1f7318ca9553270899537d98d75e9f4fced85ed4.zip |
restructring repo
Diffstat (limited to 'tdd/math_utils')
-rw-r--r-- | tdd/math_utils/gcd.py | 22 | ||||
-rw-r--r-- | tdd/math_utils/gcd_testcases.dat | 50 | ||||
-rw-r--r-- | tdd/math_utils/test_gcd.py | 29 |
3 files changed, 0 insertions, 101 deletions
diff --git a/tdd/math_utils/gcd.py b/tdd/math_utils/gcd.py deleted file mode 100644 index 7204ac0..0000000 --- a/tdd/math_utils/gcd.py +++ /dev/null @@ -1,22 +0,0 @@ -def gcd(a, b): - """Returns the Greatest Common Divisor of the two integers - passed as arguments. - - Args: - a: an integer - b: another integer - - Returns: Greatest Common Divisor of a and b - - >>> gcd(48, 64) - 16 - >>> gcd(44, 19) - 1 - """ - if b == 0: - return b - return gcd(b, a%b) - -if __name__ == "__main__": - import doctest - doctest.testmod() diff --git a/tdd/math_utils/gcd_testcases.dat b/tdd/math_utils/gcd_testcases.dat deleted file mode 100644 index 3829b12..0000000 --- a/tdd/math_utils/gcd_testcases.dat +++ /dev/null @@ -1,50 +0,0 @@ -6, 22, 2 -6, 48744, 6 -14, 143295, 1 -22, 751, 1 -35, 79, 1 -35, 96, 1 -52, 12, 4 -73, 79, 1 -73, 184790, 1 -86, 11, 1 -93, 8, 1 -93, 798, 3 -113, 42785, 1 -209, 2135, 1 -395, 8989, 1 -587, 331, 1 -643, 751, 1 -721, 242525, 1 -733, 5622, 1 -854, 42785, 1 -1695, 57, 3 -1695, 798, 3 -3429, 177203, 1 -4603, 12, 1 -4603, 48744, 1 -6139, 57, 1 -6139, 204, 1 -6660, 96, 12 -6660, 410400, 180 -6703, 410400, 1 -8964, 22, 2 -9673, 751, 1 -9673, 7909, 1 -9673, 3335, 1 -16028, 891, 1 -44231, 378, 1 -49020, 751, 1 -57908, 184790, 2 -65482, 548045, 1 -79715, 8, 1 -79715, 891, 1 -79715, 66371, 1 -321807, 891, 3 -366607, 97, 1 -402212, 5595, 1 -448426, 66371, 1 -575271, 4617, 9 -575271, 402152, 1 -680256, 48744, 72 -779565, 184790, 5 diff --git a/tdd/math_utils/test_gcd.py b/tdd/math_utils/test_gcd.py deleted file mode 100644 index c81c72b..0000000 --- a/tdd/math_utils/test_gcd.py +++ /dev/null @@ -1,29 +0,0 @@ -import gcd -import unittest - -class TestGcdFunction(unittest.TestCase): - - def setUp(self): - self.test_file = open('gcd_testcases.dat') - self.test_cases = [] - for line in self.test_file: - values = line.split(', ') - a = int(values[0]) - b = int(values[1]) - g = int(values[2]) - - self.test_cases.append([a, b, g]) - - def test_gcd(self): - for case in self.test_cases: - a = case[0] - b = case[1] - g = case[2] - self.assertEqual(gcd.gcd(a, b), g) - - def tearDown(self): - self.test_file.close() - del self.test_cases - -if __name__ == '__main__': - unittest.main() |