def test_tree_intersection():
    tree_1 = BinaryTree()
    tree_1.add(150)
    tree_1.add(100)
    tree_1.add(250)
    tree_1.add(75)
    tree_1.add(160)
    tree_1.add(200)
    tree_1.add(350)
    tree_1.root.left.right.left = TreeNode(125)
    tree_1.root.left.right.right = TreeNode(175)
    tree_1.root.right.right.left = TreeNode(300)
    tree_1.root.right.right.right = TreeNode(500)

    tree_2 = BinaryTree()
    tree_2.add(42)
    tree_2.add(100)
    tree_2.add(600)
    tree_2.add(15)
    tree_2.add(160)
    tree_2.add(200)
    tree_2.add(350)
    tree_2.root.left.right.left = TreeNode(125)
    tree_2.root.left.right.right = TreeNode(175)
    tree_2.root.right.right.left = TreeNode(4)
    tree_2.root.right.right.right = TreeNode(500)

    actural = tree_intersection(tree_1, tree_2)
    expected = [100, 160, 125, 175, 200, 350, 500]
    assert actural == expected
def test_example1():
    tree1 = BinaryTree()
    tree1.add(150)
    tree1.add(100)
    tree1.add(250)
    tree1.add(75)
    tree1.add(160)
    tree1.add(200)
    tree1.add(350)
    tree1.add(125)
    tree1.add(175)
    tree1.add(300)
    tree1.add(500)

    tree2 = BinaryTree()
    tree2.add(42)
    tree2.add(100)
    tree2.add(600)
    tree2.add(15)
    tree2.add(160)
    tree2.add(200)
    tree2.add(350)
    tree2.add(125)
    tree2.add(175)
    tree2.add(4)
    tree2.add(500)

    actual = tree_intersection(tree1, tree2)
    expected = [100, 160, 200, 350, 125, 175, 500]
    assert actual == expected
def test_example2():
    tree1 = BinaryTree()
    tree1.add(100)

    tree2 = BinaryTree()
    tree2.add(100)

    actual = tree_intersection(tree1, tree2)
    expected = [100]
    assert actual == expected
def test_example3():
    tree1 = BinaryTree()
    tree1.add(100)
    tree1.add(23)
    tree1.add(55)

    tree2 = BinaryTree()
    tree2.add(77)
    tree2.add(5)
    tree2.add(27)

    actual = tree_intersection(tree1, tree2)
    expected = []
    assert actual == expected
def test_tree_intersection():
    bst1 = BinaryTree()
    bst1.add(1)
    bst1.add(2)
    bst1.add(3)

    bst2 = BinaryTree()
    bst2.add(2)
    bst2.add(3)
    bst2.add(4)

    actual = tree_intersection(bst1, bst2)
    expected = [2, 3]
    assert actual == expected
def test_one():
    actual = tree_intersection([1, 3, 2, 1, 4], [1, 6, 88, 6, 4])
    expected = 1, 4
    assert actual == expected