Example #1
0
        private static void Helper2(Int32[] a, Int32[] b)
        {
            var slimDeque = new SlimDeque <Int32>();

            for (var i = 0; i != a.Length; i++)
            {
                slimDeque.EnqueueFront(a[i]);
                Assert.Equal(i + 1, slimDeque.Count);
            }

            for (var i = 0; i != a.Length; i++)
            {
                slimDeque.DequeueFront();
                //Assert.Equal(i + 1, slimDeque.Count);
            }

            for (var i = 0; i != b.Length; i++)
            {
                slimDeque.EnqueueBack(b[i]);
                Assert.Equal(i + a.Length + 1, slimDeque.Count);
            }

            for (var i = 0; i != b.Length; i++)
            {
                slimDeque.DequeueBack();
            }
        }
Example #2
0
        public void EmptySlimDequeExceptionTests()
        {
            var slimDeque = new SlimDeque <Int32>();

            Assert.Throws <EmptySlimDequeException>(() => slimDeque.DequeueFront());
            Assert.ThrowsAny <InvalidOperationException>(() => slimDeque.DequeueFront());
            Assert.Throws <EmptySlimDequeException>(() => slimDeque.DequeueBack());
            Assert.ThrowsAny <InvalidOperationException>(() => slimDeque.DequeueBack());

            slimDeque = new SlimDeque <Int32>();
            slimDeque.EnqueueFront(1);
            Assert.Equal(1, slimDeque.DequeueFront());

            slimDeque = new SlimDeque <Int32>();
            slimDeque.EnqueueBack(1);
            Assert.Equal(1, slimDeque.DequeueBack());
        }