def test_binary_tree_add_root_node(self):
     bt = BinaryTree()
     bt.add_node(4)
     self.assertEqual(4, bt.root.value)
     self.assertEqual(1, bt.count)
     self.assertEqual(None, bt.root.left_child)
     self.assertEqual(None, bt.root.right_child)
 def test_binary_tree_add_second_smaller_node(self):
     bt = BinaryTree()
     bt.add_node(4)
     bt.add_node(2)
     self.assertEqual(4, bt.root.value)
     self.assertEqual(2, bt.root.left_child.value)
     self.assertEqual(None, bt.root.right_child)
     self.assertEqual(2, bt.count)
 def test_binary_tree_add_smaller_and_larger_nodes(self):
     bt = BinaryTree()
     bt.add_node(4)
     bt.add_node(6)
     bt.add_node(2)
     self.assertEqual(4, bt.root.value)
     self.assertEqual(2, bt.root.left_child.value)
     self.assertEqual(6, bt.root.right_child.value)
     self.assertEqual(3, bt.count)
 def test_binary_tree_multiple_smaller_and_larger_nodes(self):
     bt = BinaryTree()
     bt.add_node(4)
     bt.add_node(2)
     bt.add_node(6)
     bt.add_node(3)
     bt.add_node(4)
     bt.add_node(8)
     bt.add_node(7)
     bt.add_node(12)
     self.assertEqual(4, bt.root.value)
     self.assertEqual(2, bt.root.left_child.value)
     self.assertEqual(6, bt.root.right_child.value)
     self.assertEqual(3, bt.root.left_child.right_child.value)
     self.assertEqual(4, bt.root.right_child.left_child.value)
     self.assertEqual(8, bt.root.right_child.right_child.value)
     self.assertEqual(7, bt.root.right_child.right_child.left_child.value)
     self.assertEqual(12, bt.root.right_child.right_child.right_child.value)
     self.assertEqual(8, bt.count)
 def test_binary_tree_add_three_larger_nodes(self):
     bt = BinaryTree()
     bt.add_node(4)
     bt.add_node(6)
     bt.add_node(8)
     bt.add_node(10)
     self.assertEqual(4, bt.root.value)
     self.assertEqual(6, bt.root.right_child.value)
     self.assertEqual(8, bt.root.right_child.right_child.value)
     self.assertEqual(10, bt.root.right_child.right_child.right_child.value)
     self.assertEqual(None, bt.root.left_child)
     self.assertEqual(4, bt.count)