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()); }
public void MinTest6() { MinInStack <int> stack = new MinInStack <int>(); stack.Push(3); stack.Push(4); stack.Push(2); stack.Push(3); stack.Pop(); stack.Pop(); Assert.AreEqual(stack.Min(), 3); }
public void Test4() { MinInStack stack = new MinInStack(); stack.Push(3); stack.Push(2); stack.Push(1); Assert.Equal(1, stack.Min()); stack.Pop(); Assert.Equal(2, stack.Min()); stack.Pop(); Assert.Equal(3, stack.Min()); }
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 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 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()); }