"""race different types of containers..."""


from container import Container
from stack import Stack
from queue import Queue
import linked_stack
import linked_queue
from time import time


def container_cycle(c, r):
    """
    Add/remove c r times.

    @param Container c: Container to add/remove
    @param int r: number of times to add/remove
    @rtype: str
    """
#    start = time()
    for i in range(r):
        c.add(i)
    start = time()
    for i in range(r):
        # repeatedly add and remove
        c.remove()
        c.add(i)
    print("{} add/remove in {} seconds".format(r, time() - start))


if __name__ == "__main__":
    s = Stack()
    q = Queue()
    ls = linked_stack.Stack()
    lq = linked_queue.Queue()
    # which are linear?
    for j in [10, 100, 1000, 10000, 100000]:
        container_cycle(q, j)
