예제 #1
0
 def test_EmptyTree(self):
     # print("Test2: Test Empty Tree:")
     root = None
     self.assertEqual(None, LCA.findLCA(root, 6, 7),
                      " The output should be -1 since the tree is empty")
     print("Finished test_EmptyTree")
예제 #2
0
 def test_BothNodesNotPresent(self):
     # print("Test3: testBothNodesNotPresent:")
     root = Node(1)
     self.assertEqual(None, LCA.findLCA(root, 6, 7),
                      " The output should be -1 both nodes are missing")
     print("Finished test_BothNodesNotPresent")
 def test(self):
     self.assertEqual(LCA.findLCA(None, 1, 2), -1)
예제 #4
0
    def test_Single(self):
        # print("Test9: testSingle")
        root = Node(1)

        assert LCA.findLCA(root, 1, 1).key == 1, \
            "Should be 1 but got: " + str(LCA.findLCA(root, 1, 1))
 def test_lca6_2(self):
     self.assertEqual(LCA.findLCA(LCA.root, 6, 2).key, 1)
예제 #6
0
 def testEmpty(self):
     self.assertEqual(-1, LCA.findLCA(
         None,
         None,
         None,
     ))
 def test_lca_fake(self):
     self.assertEqual(LCA.findLCA(LCA.root, 8, 8), None)
예제 #8
0
파일: TestLCA.py 프로젝트: mcmanutom/LCA
 def test_BothNodesNotPresent(self):
     root = LCA.Node(1)
     self.assertEqual(-1, LCA.findLCA(root, 6, 7))
 def test_lca2_3(self):
     self.assertEqual(LCA.findLCA(LCA.root, 2, 3).key, 1)
 def test_lca6_7(self):
     self.assertEqual(LCA.findLCA(LCA.root, 6, 7).key, 3)
 def test_lca_same(self):
     self.assertEqual(LCA.findLCA(LCA.root, 1, 1).key, 1)
 def test_lca1_5(self):
     self.assertEqual(LCA.findLCA(LCA.root, 1, 5).key, 1)
 def test_lca_none(self):
     self.assertEqual(LCA.findLCA(None, 4, 5), None)
예제 #14
0
def test_answer1():
    root = LCA.Node(1)
    assert LCA.findLCA(root, 1, 1) == 1
 def test_lca4_5(self):
     self.assertEqual(LCA.findLCA(LCA.root, 4, 5).key, 2)
예제 #16
0
def test_answer():
    assert LCA.findLCA(None, None, None) == None
예제 #17
0
파일: TestLCA.py 프로젝트: mcmanutom/LCA
 def test_EmptyTree(self):
     root = None
     self.assertEqual(-1, LCA.findLCA(root, 6, 7))