Ejemplo n.º 1
0
 def testSizeOfQ(self):
     q = qu.Queue()
     w1 = wd.Word(address=22)
     w2 = wd.Word(address=3)
     q.enqueue(word=w1)
     q.enqueue(word=w2)
     self.assertEqual(q.size(), 2, 'Size does not work properly')
Ejemplo n.º 2
0
 def testEnqueueIntoNonEmptyQ(self):
     q = qu.Queue()
     w1 = wd.Word(address=22)
     w2 = wd.Word(address=3)
     q.enqueue(word=w1)
     q.enqueue(word=w2)
     self.assertEqual(q.size(), 2, 'Enqueue does not work properly')
Ejemplo n.º 3
0
 def testDequeueFromNonEmptyQReturnValue(self):
     q = qu.Queue()
     w1 = wd.Word(address=22)
     w2 = wd.Word(address=3)
     q.enqueue(word=w1)
     q.enqueue(word=w2)
     self.assertEqual(q.dequeue().getTerminalAddress(), 22,
                      'Dequeue does not work properly')
Ejemplo n.º 4
0
 def testDequeueFromNonEmptyQQueueStatus(self):
     q = qu.Queue()
     w1 = wd.Word(address=22)
     w2 = wd.Word(address=3)
     q.enqueue(word=w1)
     q.enqueue(word=w2)
     q.dequeue()
     self.assertEqual(q.queue.count(w1), 0,
                      'Dequeue does not work properly')
Ejemplo n.º 5
0
 def testDequeueFromEmptyQErrorMessage(self):
     q = qu.Queue()
     self.assertRaisesRegexp(Exception, "^Queue.dequeue:\s\s", q.dequeue)
Ejemplo n.º 6
0
 def testDequeueFromEmptyQErrorType(self):
     q = qu.Queue()
     self.assertRaises(ValueError, q.dequeue)
Ejemplo n.º 7
0
 def testEnqueueIntoEmptyQ(self):
     q = qu.Queue()
     w = wd.Word(address=22)
     q.enqueue(word=w)
     self.assertEqual(q.size(), 1, 'Enqueue does not work properly')
Ejemplo n.º 8
0
 def testEmptyQIsEmpty(self):
     q = qu.Queue()
     self.assertEqual(q.isEmpty(), True, 'isEmpty does not work properly')
Ejemplo n.º 9
0
 def testNonEmptyQIsEmpty(self):
     q = qu.Queue()
     w = wd.Word(address=22)
     q.enqueue(word=w)
     self.assertEqual(q.isEmpty(), False, 'isEmpty does not work properly')
Ejemplo n.º 10
0
 def testQInstantiation(self):
     q = qu.Queue()
     assert isinstance(q, qu.Queue), 'queue is not an instance of Queue'
Ejemplo n.º 11
0
 def testSizeExists(self):
     q = qu.Queue()
     assert "size" in dir(q), 'Method by name size does not exists'
Ejemplo n.º 12
0
 def testDequeueExists(self):
     q = qu.Queue()
     assert "dequeue" in dir(q), 'Method by name dequeue does not exists'
Ejemplo n.º 13
0
 def testIsEmptyExists(self):
     q = qu.Queue()
     assert "isEmpty" in dir(q), 'Method by name isEmpty does not exists'
Ejemplo n.º 14
0
 def testInitExists(self):
     q = qu.Queue()
     assert "__init__" in dir(q), 'Method by name __init__ does not exists'