Example #1
0
        public void Two()
        {
            QueueByLinkedList <int> sa = new QueueByLinkedList <int>();

            sa.Enqueue(1);
            sa.Enqueue(2);
            Assert.Equal(1, sa.Dequeue());
            Assert.False(sa.IsEmpty);
            Assert.Equal(2, sa.Dequeue());
            Assert.True(sa.IsEmpty);
        }
Example #2
0
        public void Five()
        {
            QueueByLinkedList <int> sa = new QueueByLinkedList <int>();

            sa.Enqueue(1);
            sa.Enqueue(2);
            sa.Enqueue(3);
            sa.Enqueue(4);
            sa.Enqueue(5);
            Assert.Equal(1, sa.Dequeue());
            Assert.False(sa.IsEmpty);
            Assert.Equal(2, sa.Dequeue());
            Assert.False(sa.IsEmpty);
            Assert.Equal(3, sa.Dequeue());
            Assert.False(sa.IsEmpty);
            Assert.Equal(4, sa.Dequeue());
            Assert.False(sa.IsEmpty);
            Assert.Equal(5, sa.Dequeue());
            Assert.True(sa.IsEmpty);
        }
Example #3
0
        public void Bulk()
        {
            QueueByLinkedList <int> sa = new QueueByLinkedList <int>();

            for (int i = 0; i < 2000000; i++)
            {
                sa.Enqueue(i);
            }

            for (int i = 0; i < 2000000; i++)
            {
                Assert.Equal(i, sa.Dequeue());
            }
        }