Esempio n. 1
0
 def test_is_empty_true(self):
     #testing if queue is empty
     print("\n")
     s = lab1.Stack()
     print("return true if the stack is empty")
     self.assertEqual(s.isEmpty(), True)
     print("\n")
 def test_is_empty_false(self):
     #testing if stack is empty
     print("\n")
     s = lab1.Stack()
     s.push("4")
     print("return false if the stack is not empty")
     self.assertEqual(s.isEmpty(), False)
     print("\n")
 def test_pop(self):
     #testing stack push operation
     print("\n")
     print ("Testing Stack: Returning Empty Stack")
     s = lab1.Stack()
     s.pop()
     self.assertEqual(s.printStack(), [])
     print("\n")
Esempio n. 4
0
 def test_basic_pop(self):
     print("\n")
     s = lab1.Stack()
     s.push(1)
     s.push(2)
     s.push(3)
     s.push(4)
     s.push(5)
     self.assertEqual(s.pop(), 5)
     print("\n")
 def test_basic_push(self):
     #testing the basic enqueue operation
     print("\n")
     print("Testing Stack : Push")
     s = lab1.Stack()
     s.push(1)
     s.push(2)
     s.push(3)
     s.push(4)
     self.assertEqual(s.printStack(), [4,3,2,1])
     print("\n")
Esempio n. 6
0
 def test_basic_push(self):
     #testing stack push operation
     print("\n")
     s = lab1.Stack()
     s.push(1)
     s.push(2)
     s.push(3)
     s.push(4)
     s.push(5)
     self.assertEqual(s.printStack(), [5,4,3,2,1])
     print("\n")
 def test_push_pop(self):
     #testing stack push operation
     print("\n")
     print ("Testing Stack: Push and Pop")
     s = lab1.Stack()
     s.push(1)
     s.push(2)
     s.pop()
     s.push(3)
     s.push(4)
     s.push(5)
     self.assertEqual(s.printStack(), [5,4,3,1])
     print("\n")
Esempio n. 8
0
 def test_pop_empty(self):
     print("\n")
     s = lab1.Stack()
     self.assertEqual(s.pop(), None)
     print("\n")