Created
November 20, 2013 03:28
-
-
Save animatedlew/7557202 to your computer and use it in GitHub Desktop.
This is the test suite for algorithms.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import algorithms | |
class TestCalcTotalPaths(unittest.TestCase): | |
def setUp(self): | |
self.loc = {'three': (1, 2), 'two': (1, 1), 'fiftySix': (5, 3), 'nine': (4, 1)} | |
self.list_comp = [(x, y) for x in range(6) for y in range(4)] | |
def test_calc_total_paths_1_2_ret3(self): | |
self.assertEqual(3, algorithms.count_paths(*self.loc['three']), | |
"Wrong # of paths to {0}".format(self.loc['three'])) | |
def test_calc_total_paths_1_1_ret2(self): | |
self.assertEqual(2, algorithms.count_paths(*self.loc['two']), | |
"Wrong # of paths to {0}".format(str(self.loc['two']))) | |
def test_calc_total_paths_5_3_ret56(self): | |
self.assertEqual(56, algorithms.count_paths(*self.loc['fiftySix']), | |
"Wrong # of paths to {0}".format(self.loc['fiftySix'])) | |
def test_calc_total_paths_4_1_ret5(self): | |
self.assertEquals(5, algorithms.count_paths(*self.loc['nine']), | |
"Wrong # of paths to {0}".format(self.loc['nine'])) | |
def test_list_comp(self): | |
self.assertEquals(24, len(self.list_comp)) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment