from tree import tree
from binary_tree import binary_tree

def main():
    y = binary_tree(100)
    y.AddLeft(200)
    y.AddRight(300)
    y.getRight().AddLeft(1)
    print(y.Get_LevelOrder())
    y.getLeft().AddLeft(2)
    y.getLeft().AddRight(4)
    y.getRight().AddRight(3)
    print(y.Get_LevelOrder())
    y.AddLeft(1)
    print(y.Get_LevelOrder())
    
    x = tree("g")
    x.AddSuccessor(tree("i"))
    x.AddSuccessor(tree("j"))
    x.AddSuccessor(tree("k"))
    y = tree("c")
    y.AddSuccessor(tree("f"))
    y.AddSuccessor(x)
    y.AddSuccessor(tree("h"))
    z = tree("a")
    z.AddSuccessor(tree("b"))
    z.AddSuccessor(y)
    z.AddSuccessor(tree("d"))
    z.AddSuccessor(tree("e"))

    x = binary_tree("j")
    x.AddRight("k")
    y = binary_tree("i")
    y.AddRight(x)
    m = binary_tree("g")
    m.AddLeft(y)
    m.AddRight("h")
    q = binary_tree("f")
    q.AddRight(m)
    w = binary_tree("d")
    w.AddRight("e")
    c = binary_tree("c")
    c.AddLeft(q)
    c.AddRight(w)
    b = binary_tree("b")
    b.AddRight(c)
    a = binary_tree("a")
    a.AddLeft(b)

    print("Tree Form")
    print(z.Get_LevelOrder())
    z.Print_DepthFirst()
    print("BT to Tree Form")
    print(a.ConvertToTree()[1].Get_LevelOrder())
    a.ConvertToTree()[1].Print_DepthFirst()

    print("Binary Tree Form")
    print(a.Get_LevelOrder())
    a.Print_DepthFirst()
    print("Tree to BT Form")
    print(z.ConvertToBinaryTree().Get_LevelOrder())
    z.ConvertToBinaryTree().Print_DepthFirst()

    print("BT to Tree Test: " + str(z.Get_LevelOrder() == a.ConvertToTree()[1].Get_LevelOrder()))
    print("Tree to BT Test: " + str(a.Get_LevelOrder() == z.ConvertToBinaryTree().Get_LevelOrder()))

main()