Example #1
0
        private void testPeek(BasicStack <DSString> the_stack)
        {
            //check multiple peeks
            Assert.AreEqual("9", the_stack.peek().value);
            Assert.AreEqual("9", the_stack.peek().value);

            //peek after removal
            the_stack.pop();
            Assert.AreEqual("8", the_stack.peek().value);

            //peek with nothing on the stack
            while (!the_stack.isEmpty())
            {
                the_stack.pop();
            }
            Assert.AreEqual(null, the_stack.peek());
        }