Example #1
0
        public void TestOnlyOneElement()
        {
            MinInStack <int> stack = new MinInStack <int>();

            stack.Push(1);
            Assert.AreEqual(1, stack.Min());

            stack.Pop();
            stack.Push(2);
            Assert.AreEqual(2, stack.Min());
        }
        public void Test6()
        {
            MinInStack stack = new MinInStack();

            stack.Push(3);
            stack.Push(2);
            stack.Push(2);
            stack.Push(4);
            Assert.Equal(2, stack.Min());
            stack.Pop();
            stack.Push(1);
            Assert.Equal(1, stack.Min());
        }
        public void MinTest1()
        {
            MinInStack <int> stack = new MinInStack <int>();

            stack.Push(3);
            Assert.AreEqual(stack.Min(), 3);
        }
        public void Test()
        {
            MinInStack stack = new MinInStack();

            stack.Push(1);
            Assert.Equal(1, stack.Min());
        }
Example #5
0
        public void TestInsertUnsorted()
        {
            MinInStack <int> stack = new MinInStack <int>();

            stack.Push(2);
            Assert.AreEqual(2, stack.Min());

            stack.Push(1);
            Assert.AreEqual(1, stack.Min());

            stack.Push(3);
            Assert.AreEqual(1, stack.Min());

            stack.Pop();
            Assert.AreEqual(1, stack.Min());

            stack.Pop();
            Assert.AreEqual(2, stack.Min());
        }
Example #6
0
        public void TestInsertUnsorted()
        {
            MinInStack<int> stack = new MinInStack<int>();

            stack.Push(2);
            Assert.AreEqual(2, stack.Min());

            stack.Push(1);
            Assert.AreEqual(1, stack.Min());

            stack.Push(3);
            Assert.AreEqual(1, stack.Min());

            stack.Pop();
            Assert.AreEqual(1, stack.Min());

            stack.Pop();
            Assert.AreEqual(2, stack.Min());
        }
        public void MinTest5()
        {
            MinInStack <int> stack = new MinInStack <int>();

            stack.Push(3);
            stack.Push(4);
            stack.Push(2);
            stack.Push(3);
            stack.Pop();
            Assert.AreEqual(stack.Min(), 2);
        }
Example #8
0
        public void TestEmpty()
        {
            MinInStack <int> stack = new MinInStack <int>();

            stack.Min();
        }
Example #9
0
        public void TestWithSameElement()
        {
            MinInStack<int> stack = new MinInStack<int>();

            stack.Push(2);
            Assert.AreEqual(2, stack.Min());

            stack.Push(3);
            Assert.AreEqual(2, stack.Min());

            stack.Push(2);
            Assert.AreEqual(2, stack.Min());

            stack.Push(1);
            Assert.AreEqual(1, stack.Min());

            stack.Pop();
            Assert.AreEqual(2, stack.Min());

            stack.Pop();
            Assert.AreEqual(2, stack.Min());

            stack.Pop();
            Assert.AreEqual(2, stack.Min());
        }
Example #10
0
 public void TestEmpty()
 {
     MinInStack<int> stack = new MinInStack<int>();
     stack.Min();
 }