コード例 #1
0
def test_get_size():
    queue = Queue()
    assert queue.get_size() == 0
    queue.enqueue(1)
    assert queue.get_size() == 1
    queue.dequeue()
    assert queue.get_size() == 0
コード例 #2
0
ファイル: tests.py プロジェクト: tordisuna/Gagnaskipan
print(lis.pop_front())
print(lis.pop_front())
print("container of size: " + str(lis.get_size()) + ":")
print(lis)
print(lis.pop_front())
print(lis.pop_front())
print("container of size: " + str(lis.get_size()) + ":")
print(lis)

print("\nTESTING QUEUE WITH ARRAYS\n")

queue = Queue("array")
queue.add(2)
queue.add(4)
queue.add(7)
print("the data structure is of size: " + str(queue.get_size()))
print(queue.remove())
print(queue.remove())
print(queue.remove())
print(queue.remove())
print("the data structure is of size: " + str(queue.get_size()))

print("\nTESTING STACK WITH ARRAYS\n")

stack = Stack("array")
stack.push(2)
stack.push(4)
stack.push(7)
print("the data structure is of size: " + str(stack.get_size()))
print(stack.pop())
print(stack.pop())