Ejemplo n.º 1
0
 def test_case_12(self):
     test = BinaryTree(1).insert([
         -5,
         -3,
         0,
         2,
         2,
         1,
         -3,
         -4,
         1,
         1,
         0,
         5,
         1,
         1,
         0,
         1,
         3,
         -1,
         -1,
         -6,
         -1,
         -100,
         -9,
         -91,
         2,
         1,
         0,
         1,
         -5,
         0,
         3,
         1,
         2,
         2,
         7,
         -5,
     ])
     self.assertEqual(program.maxPathSum(test), 10)
Ejemplo n.º 2
0
2
import unittest
3
​
4
​
5
class TestProgram(unittest.TestCase):
6
​
7
    def test_case_1(self):
8
        test = BinaryTree(1).insert([2, 3])
9
        self.assertEqual(program.maxPathSum(test), 6)
10
​
11
    def test_case_2(self):
12
        test = BinaryTree(1).insert([2, -1])
13
        self.assertEqual(program.maxPathSum(test), 3)
14
​
15
    def test_case_3(self):
16
        test = BinaryTree(1).insert([-5, 3, 6])
17
Ejemplo n.º 3
0
 def test_case_1(self):
     test = BinaryTree(1).insert([2, 3])
     self.assertEqual(program.maxPathSum(test), 6)
Ejemplo n.º 4
0
 def test_case_9(self):
     test = BinaryTree(1).insert([-150, -5, 30, 75, -20, -21, 5, 1, 3, -3, 100, 2, 100, 1, 100, 100, 5, 10, 150, 151])
     self.assertEqual(program.maxPathSum(test), 304)
Ejemplo n.º 5
0
 def test_case_6(self):
     test = BinaryTree(1).insert([-10, -5, 30, 45, -20, -21, 5, 1, 3, -3, 100, 2, 100, 1, 100])
     self.assertEqual(program.maxPathSum(test), 201)
Ejemplo n.º 6
0
 def test_case_4(self):
     test = BinaryTree(1).insert([2, 3, 4, 5, 6, 7])
     self.assertEqual(program.maxPathSum(test), 18)