-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
31 lines (25 loc) · 747 Bytes
/
test.py
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
import unittest
import kdegree
class TestKDegreeAlgorithms(unittest.TestCase):
d_list = [
[8,7,7,6,3,2,2,1],
[3,2,2,2],
[3,3,3,2,1],
[4,3,3,2,1,1]
]
results_k_2 = [
[8,8,7,7,3,3,2,2],
[3,3,2,2],
[3,3,3,2,2],
[4,4,3,3,1,1]
]
def test_dp_k_2(self):
for i in range(len(self.d_list)):
result = kdegree.dp_algorithm(self.d_list[i], 2)
self.assertEqual(result, self.results_k_2[i])
def test_greedy_k_2(self):
for i in range(len(self.d_list)):
result = kdegree.greedy_algorithm(self.d_list[i], 2)
self.assertEqual(result, self.results_k_2[i])
if __name__ == '__main__':
unittest.main()