def test_3(): node1 = TNode(1) binary_tree = BinaryTree(node1) maximum = binary_tree.find_maximum_value() actual = maximum expected = 1 assert actual == expected
def test_1(): node1 = TNode(1) node1.left = TNode(2) node1.right = TNode(3) binary_tree = BinaryTree(node1) maximum = binary_tree.find_maximum_value() actual = maximum expected = 3 assert actual == expected
def test_instantiate_tree(): tree = BinaryTree() tree.root = Node(2) tree.root.left = Node(7) tree.root.left.left = Node(2) tree.root.left.right = Node(6) tree.root.left.right.left = Node(5) tree.root.left.right.right = Node(11) tree.root.right = Node(5) tree.root.right.right = Node(9) tree.root.right.right.left = Node(4) actual = tree.find_maximum_value() expected = 11 assert actual == expected
def test_find_max_value_within_tree(): test_node = Node(1) test_node.left = Node(2) test_node.right = Node(3) test_node.left.left = Node(4) test_node.left.right = Node(5) test_node.right.left = Node(6) test_node.right.right = Node(7) test_tree = BinaryTree(test_node) expected = 7 actual = test_tree.find_maximum_value() assert actual == expected
def test_2(): node1 = TNode(1) node1.left = TNode(2) node1.right = TNode(3) node1.right.left = TNode(5) node1.right.right = TNode(4) node1.left.right = TNode(88) node1.left.left = TNode(7) binary_tree = BinaryTree(node1) maximum = binary_tree.find_maximum_value() actual = maximum expected = 88 assert actual == expected