예제 #1
0
        public void LinkedListQueue_Test()
        {
            var Queue = new AsQueue <string>(QueueType.LinkedList);

            Queue.Enqueue("a");
            Queue.Enqueue("b");
            Queue.Enqueue("c");

            Assert.AreEqual(Queue.Count, 3);
            Assert.AreEqual(Queue.Dequeue(), "a");


            Assert.AreEqual(Queue.Count, 2);
            Assert.AreEqual(Queue.Dequeue(), "b");

            Assert.AreEqual(Queue.Count, 1);
            Assert.AreEqual(Queue.Dequeue(), "c");

            Assert.AreEqual(Queue.Count, 0);

            Queue.Enqueue("a");

            Assert.AreEqual(Queue.Count, 1);
            Assert.AreEqual(Queue.Dequeue(), "a");
        }
예제 #2
0
        public void ArrayQueue_Test()
        {
            var Queue = new AsQueue <string>();

            Queue.Enqueue("a");
            Queue.Enqueue("b");
            Queue.Enqueue("c");

            Assert.AreEqual(Queue.Count, 3);
            Assert.AreEqual(Queue.Dequeue(), "a");


            Assert.AreEqual(Queue.Count, 2);
            Assert.AreEqual(Queue.Dequeue(), "b");

            Assert.AreEqual(Queue.Count, 1);
            Assert.AreEqual(Queue.Dequeue(), "c");

            Assert.AreEqual(Queue.Count, 0);

            Queue.Enqueue("a");

            Assert.AreEqual(Queue.Count, 1);
            Assert.AreEqual(Queue.Dequeue(), "a");
        }