Exemplo n.º 1
0
    def test_assignDepth(self):

        l473.assignDepth(self.root, -1, -1)

        self.assertEqual(self.root.depth, 0)
        self.assertEqual(self.root.right.right.depth, 2)
        self.assertEqual(self.root.right.depth, 1)
        self.assertEqual(self.root.left.right.depth, 0)
        self.assertEqual(self.root.left.left.depth, 1)
        self.assertEqual(self.root.left.depth, 0)
Exemplo n.º 2
0
    def test_computeMax(self):

        res = 0
        l473.assignDepth(self.root, -1, -1)
        res = l473.computeMax(self.root, res)
        self.assertEqual(res, 3)