-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest3.py
More file actions
39 lines (29 loc) · 1.16 KB
/
Test3.py
File metadata and controls
39 lines (29 loc) · 1.16 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
39
import unittest
import Problem_3
class TestLca(unittest.TestCase):
#unit test for node 6 and 7
def test_node6_7(self):
self.assertEqual(Problem_3.LCA(Problem_3.root, 6, 7).key, 3)
#unit test for node 3 and 7
def test_node3_7(self):
self.assertEqual(Problem_3.LCA(Problem_3.root, 3, 7).key, 3)
#unit test for node 1 and 5
def test_node6_5(self):
self.assertEqual(Problem_3.LCA(Problem_3.root, 6, 5).key, 1)
#unit test for same nodes
def test_node_same(self):
self.assertEqual(Problem_3.LCA(Problem_3.root, 2, 2).key, 2)
#unit test for node 2 and 3
def test_node2_3(self):
self.assertEqual(Problem_3.LCA(Problem_3.root, 2, 3).key, 1)
#unit test for node 8 and 9
def test_node8_9(self):
self.assertEqual(Problem_3.LCA(Problem_3.root, 8, 9).key, 4)
#unit test for non existing nodes
def test_node_none(self):
self.assertEqual(Problem_3.LCA(Problem_3.root, 10, 10), None)
#unit test for no root
def test_node_no_root(self):
self.assertEqual(Problem_3.LCA(None, 4, 5), None)
if __name__ == '__main__':
unittest.main()