summaryrefslogtreecommitdiff
path: root/lecture_notes/tdd/math_utils/test_gcd.py
diff options
context:
space:
mode:
authorhardythe12014-06-12 14:44:39 +0530
committerhardythe12014-06-12 14:44:39 +0530
commitf4ff073c0e144546d7c205f6c99df6baed763b04 (patch)
tree3c6163a3d3aa22362ab9009ece2019e60fc267a6 /lecture_notes/tdd/math_utils/test_gcd.py
parent2a0aa076b9879a71dba6235ef84efa9cd15fda80 (diff)
downloadsees-f4ff073c0e144546d7c205f6c99df6baed763b04.tar.gz
sees-f4ff073c0e144546d7c205f6c99df6baed763b04.tar.bz2
sees-f4ff073c0e144546d7c205f6c99df6baed763b04.zip
restructuring and renaming files/directories with underscores instead of spaces & '-'
Diffstat (limited to 'lecture_notes/tdd/math_utils/test_gcd.py')
-rw-r--r--lecture_notes/tdd/math_utils/test_gcd.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/lecture_notes/tdd/math_utils/test_gcd.py b/lecture_notes/tdd/math_utils/test_gcd.py
new file mode 100644
index 0000000..c81c72b
--- /dev/null
+++ b/lecture_notes/tdd/math_utils/test_gcd.py
@@ -0,0 +1,29 @@
+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()