Skip to content

Commit 901a976

Browse files
authored
Merge pull request #174 from kir0ul/issue_88
test: kadanes algorithm
2 parents 9f9ce3f + 6895720 commit 901a976

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11

22
*.exe
3+
**/__pycache__
4+
*.pyc
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import unittest
2+
from classical_algorithms.python.kadanes_algorithm import kadanes_algorithm
3+
4+
5+
NUMS_LIST = [([-2, 1, -3, 4, -1, 2, 1, -5, 4], 6), ([-1], -1)]
6+
7+
8+
class TestKadanesAlgorithm(unittest.TestCase):
9+
def test_kadanes_algorithm(self):
10+
for nums, expected_res in NUMS_LIST:
11+
with self.subTest():
12+
res = kadanes_algorithm(nums)
13+
self.assertEqual(res, expected_res)
14+
15+
16+
if __name__ == "__main__":
17+
unittest.main()

0 commit comments

Comments
 (0)