-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_unique_paths.py
More file actions
38 lines (31 loc) · 1.05 KB
/
test_unique_paths.py
File metadata and controls
38 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import unittest
from parameterized import parameterized
from algorithms.dynamic_programming.unique_paths import (
unique_paths_top_down,
unique_paths_math,
unique_paths_bottom_up,
)
UNIQUE_PATHS_TEST_CASES = [
(3, 7, 28),
(3, 2, 3),
(2, 2, 2),
(3, 3, 6),
(1, 1, 1),
(10, 10, 48620),
(20, 20, 35345263800),
]
class UniquePathsTestCase(unittest.TestCase):
@parameterized.expand(UNIQUE_PATHS_TEST_CASES)
def test_unique_paths_top_down(self, m: int, n: int, expected: int):
actual = unique_paths_top_down(m, n)
self.assertEqual(expected, actual)
@parameterized.expand(UNIQUE_PATHS_TEST_CASES)
def test_unique_paths_bottom_up(self, m: int, n: int, expected: int):
actual = unique_paths_bottom_up(m, n)
self.assertEqual(expected, actual)
@parameterized.expand(UNIQUE_PATHS_TEST_CASES)
def test_unique_paths_math(self, m: int, n: int, expected: int):
actual = unique_paths_math(m, n)
self.assertEqual(expected, actual)
if __name__ == "__main__":
unittest.main()