public void Stack_Is_Empty()
        {
            var stack = new StackWithArray <int>();

            var isEmpty = stack.IsEmpty();

            Assert.True(isEmpty);
            Assert.Equal(0, stack.Length);
            Assert.Equal(0, stack.Top);
            Assert.Equal(0, stack.Bottom);
        }
示例#2
0
 public int Min()
 {
     if (_minStack.IsEmpty())
     {
         return(int.MaxValue);
     }
     else
     {
         return(_minStack.Peek());
     }
 }
        public void Stack_Is_Not_Empty()
        {
            var stack = new StackWithArray <int>();

            stack.Push(10);
            var isEmpty = stack.IsEmpty();

            Assert.False(isEmpty);
            Assert.Equal(1, stack.Length);
            Assert.Equal(10, stack.Top);
            Assert.Equal(10, stack.Bottom);
        }
 public void StackWithArray_IsEmpty_should_return_true_when_stack_is_empty()
 {
     Assert.AreEqual(true, st.IsEmpty());
 }