예제 #1
0
    def test_is_empty_true(self):
        #testing if queue is empty
        print("\n")
        q = lab1.Queue()

        self.assertTrue(q.isEmpty())
        print("\n")
예제 #2
0
    def test_dequeue_empty(self):
        #testing dequeue operation with empty queue
        print("\n")
        q = lab1.Queue()

        self.assertEqual(q.dequeue(), None)
        print("\n")
예제 #3
0
 def test_is_empty_false(self):
     #testing if queue is empty
     print("\n")
     s = lab1.Queue()
     s.enqueue("4")
     print("return false if the queue is not empty")
     self.assertEqual(s.isEmpty(), False)
     print("\n")
예제 #4
0
    def test_is_empty_false(self):
        #testing if queue is empty
        print("\n")
        q = lab1.Queue()
        q.enqueue(1)

        self.assertFalse(q.isEmpty())
        print("\n")
예제 #5
0
 def test_dequeue(self):
     #testing the basic enqueue operation
     print("\n")
     print("Testing Queue : Returning Empty Queue")
     q = lab1.Queue()
     q.enqueue(1)
     q.dequeue()
     self.assertEqual(q.printQueue(), [])
     print("\n")
예제 #6
0
 def test_basic_enqueue(self):
     #testing the basic enqueue operation
     print("\n")
     print("Testing Queue : Enqueue")
     q = lab1.Queue()
     q.enqueue(1)
     q.enqueue(2)
     q.enqueue(3)
     q.enqueue(4)
     self.assertEqual(q.printQueue(), [1,2,3,4])
     print("\n")
예제 #7
0
 def test_enter_dequeque(self):
     print()
     print("Testing enter and de...")
     ss = 'abcde'
     q = lab1.Queue()
     for s in ss:
         q.enqueue(s)
     res = ''
     while not q.isEmpty():
         res += q.dequeue()
     self.assertEqual(res, ss)
예제 #8
0
    def test_basic_dequeue(self):
        #testing the basic dequeue operation
        print("\n")
        q = lab1.Queue()
        q.enqueue(1)
        q.enqueue(2)
        q.enqueue(3)
        q.enqueue(4)

        self.assertEqual(q.dequeue(), 1)
        print("\n")
예제 #9
0
    def test_enqueue_dequeue(self):
        #testing enqueue dequeue operation
        print("\n")
        q = lab1.Queue()
        q.enqueue(1)
        q.enqueue(2)
        q.enqueue(3)
        q.enqueue(4)
        q.dequeue()

        self.assertEqual(q.printQueue(), [2,3,4])
        print("\n")
예제 #10
0
 def test_empty_enqueue(self):
     #testing the basic enqueue operation
     print("\n")
     print("Testing empty Queue : Empty")
     q = lab1.Queue()
     self.assertEqual(q.isEmpty(), True)
     self.assertIsNone(q.dequeue())
     data = 1
     q.enqueue(data)
     _data = q.dequeue()
     self.assertEqual(q.isEmpty(), True)
     self.assertIsNone(q.dequeue())
     self.assertEqual(data, _data)
예제 #11
0
    def test_print_empty_queue(self):
        print("\n")
        q = lab1.Queue()

        self.assertEqual(q.printQueue(), [])
        print("\n")