mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Added test for MaxLengthQueue.
This commit is contained in:
parent
5da85d4f2f
commit
63279606d9
@ -77,6 +77,10 @@ class QueueTest(unittest.TestCase):
|
||||
self.assertEqual(1, len(q), 'queue len not 1 after dequeue')
|
||||
q.dequeue()
|
||||
self.assertEqual(0, len(q), 'queue len not 0 after dequeue')
|
||||
for i in range(10):
|
||||
L = range(i)
|
||||
q = queue(L)
|
||||
self.assertEqual(len(q), i)
|
||||
|
||||
def testEq(self):
|
||||
q1 = queue()
|
||||
@ -184,6 +188,22 @@ class QueueTest(unittest.TestCase):
|
||||
self.assertEqual(q, pickle.loads(pickle.dumps(q)))
|
||||
|
||||
|
||||
class MaxLengthQueueTestCase(unittest.TestCase):
|
||||
def testMaxLength(self):
|
||||
q = MaxLengthQueue(3)
|
||||
q.enqueue(1)
|
||||
self.assertEqual(len(q), 1)
|
||||
q.enqueue(2)
|
||||
self.assertEqual(len(q), 2)
|
||||
q.enqueue(3)
|
||||
self.assertEqual(len(q), 3)
|
||||
q.enqueue(4)
|
||||
self.assertEqual(len(q), 3)
|
||||
self.assertEqual(q.peek(), 2)
|
||||
q.enqueue(5)
|
||||
self.assertEqual(len(q), 3)
|
||||
self.assertEqual(q[0], 3)
|
||||
|
||||
class FunctionsTest(unittest.TestCase):
|
||||
def testCatch(self):
|
||||
def f():
|
||||
|
Loading…
Reference in New Issue
Block a user