Пример #1
0
        public void TestIsOrder()
        {
            int[] pushOrder = new int[] { 1, 2, 3, 4, 5 };
            int[] popOrder  = new int[] { 2, 5, 4, 3, 1 };

            Assert.IsTrue(StackPushPopOrder.Process(pushOrder, popOrder));
        }
Пример #2
0
        public void TestHasDifferentElement()
        {
            int[] pushOrder = new int[] { 1, 2, 3, 4, 5 };
            int[] popOrder  = new int[] { 3, 5, 4, 0, 1 };

            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));
        }
Пример #3
0
        public void TestIsNotOrder()
        {
            int[] pushOrder = new int[] { 1, 2, 3, 4, 5 };
            int[] popOrder  = new int[] { 2, 5, 4, 1, 3 };

            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));
        }
Пример #4
0
        public void TestLengthIsNotEqual()
        {
            int[] pushOrder = new int[] { 1 };
            int[] popOrder  = new int[] { 1, 2 };
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));

            pushOrder = new int[] { 1, 2, 3 };
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));
        }
Пример #5
0
        public void TestOnlyOneElement()
        {
            int[] pushOrder = new int[] { 1 };
            int[] popOrder  = new int[] { 1 };
            Assert.IsTrue(StackPushPopOrder.Process(pushOrder, popOrder));

            popOrder = new int[] { 2 };
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));
        }
Пример #6
0
        public void TestEmptyArray()
        {
            int[] pushOrder = new int[] { 1 };
            int[] popOrder  = new int[0];
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));

            pushOrder = new int[0];
            popOrder  = new int[] { 1 };
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));

            popOrder = new int[0];
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));
        }
Пример #7
0
        public void TestNull()
        {
            int[] pushOrder = new int[] { 1 };
            int[] popOrder  = null;
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));

            pushOrder = null;
            popOrder  = new int[] { 1 };
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));

            popOrder = null;
            Assert.IsFalse(StackPushPopOrder.Process(pushOrder, popOrder));
        }