summaryrefslogtreecommitdiff
path: root/queue-test.py
blob: 131c2c5841243a61d1129a5697e5f7ce2e06e515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from circular_queue import circular_queue


def test_queue_average():
    a = circular_queue(50)
    a.add(1)
    a.add(2)
    a.add(3)
    assert a.average() == 2


def test_queue_average_null():
    a = circular_queue(50)
    assert a.average() == 0

def test_queue_average_size():
    a = circular_queue(50)
    print(len(a.queue))
    a.average()
    print(len(a.queue))
    assert len(a.queue) == 50

def test_queue_circle():
    a = circular_queue(20)
    for i in range(0,2000): 
        a.add(1)
    assert a.average() == 1