Example #1
0
        public void MultiplePushAndMin()
        {
            Stack.MinStackConstantSpace stackCS = new Stack.MinStackConstantSpace();
            Stack.MinStack stack = new Stack.MinStack();

            stackCS.Push(10);
            stackCS.Push(9);
            stackCS.Push(8);
            stack.Push(10);
            stack.Push(9);
            stack.Push(8);

            Assert.AreEqual(8, stackCS.GetMin());
            Assert.AreEqual(8, stack.GetMin());
        }
Example #2
0
        public void PopAndMinAfterPop()
        {
            Stack.MinStackConstantSpace stackCS = new Stack.MinStackConstantSpace();
            Stack.MinStack stack = new Stack.MinStack();

            stackCS.Push(10);
            stackCS.Push(9);
            stackCS.Push(8);
            stackCS.Pop();
            stackCS.Push(11);

            stack.Push(10);
            stack.Push(9);
            stack.Push(8);
            stack.Pop();
            stack.Push(11);

            Assert.AreEqual(9, stackCS.GetMin());
            Assert.AreEqual(11, stackCS.Pop());
            Assert.AreEqual(9, stack.GetMin());
            Assert.AreEqual(11, stack.Pop());
        }