コード例 #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")
コード例 #3
0
 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))
コード例 #5
0
 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,
     ))
コード例 #7
0
 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))
コード例 #9
0
 def test_lca2_3(self):
     self.assertEqual(LCA.findLCA(LCA.root, 2, 3).key, 1)
コード例 #10
0
 def test_lca6_7(self):
     self.assertEqual(LCA.findLCA(LCA.root, 6, 7).key, 3)
コード例 #11
0
 def test_lca_same(self):
     self.assertEqual(LCA.findLCA(LCA.root, 1, 1).key, 1)
コード例 #12
0
 def test_lca1_5(self):
     self.assertEqual(LCA.findLCA(LCA.root, 1, 5).key, 1)
コード例 #13
0
 def test_lca_none(self):
     self.assertEqual(LCA.findLCA(None, 4, 5), None)
コード例 #14
0
ファイル: test_LCA.py プロジェクト: kinanec/software
def test_answer1():
    root = LCA.Node(1)
    assert LCA.findLCA(root, 1, 1) == 1
コード例 #15
0
 def test_lca4_5(self):
     self.assertEqual(LCA.findLCA(LCA.root, 4, 5).key, 2)
コード例 #16
0
ファイル: test_LCA.py プロジェクト: kinanec/software
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))