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")
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)
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)
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)
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)
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)
def test_answer(): assert LCA.findLCA(None, None, None) == None
def test_EmptyTree(self): root = None self.assertEqual(-1, LCA.findLCA(root, 6, 7))