Skip to content

Commit 75a7212

Browse files
authored
test for min_cost_path
1 parent 08fba2b commit 75a7212

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/test_dynamic_programming.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
from pygorithm.dynamic_programming import (
55
binary_knapsack,
6-
lis
6+
lis,
7+
min_cost_path
78
)
89

910

@@ -21,5 +22,14 @@ def test_lis(self):
2122
self.assertEqual(ans[0], 5)
2223
self.assertEqual(ans[1], [10, 22, 33, 50, 60])
2324

25+
class TestMinCostPath(unittest.TestCase):
26+
def test_min_cost_path(self):
27+
matrix = [[5, 3, 10, 17, 1],
28+
[4, 2, 9, 8, 5],
29+
[11, 12, 3, 9, 6],
30+
[1, 3, 4, 2, 10],
31+
[7, 11, 13, 7, 3]]
32+
self.assertEqual(min_cost_path.find_path(matrix), 38)
33+
2434
if __name__ == '__main__':
2535
unittest.main()

0 commit comments

Comments
 (0)