Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nBuild queue to challenge example.");
            PseudoQ<int> qu = new PseudoQ<int>();
            qu.Enqueue(20);
            qu.Enqueue(15);
            qu.Enqueue(10);
            qu.Print();
            Console.ReadLine();
            Console.Write("Adding 5 to the rear of the queue: ");
            qu.Enqueue(5);
            qu.Print();
            Console.ReadLine();
            qu.Dequeue();
            qu.Dequeue();
            qu.Dequeue();
            qu.Dequeue();

            Console.WriteLine("\nQueue reset.");
            qu.Enqueue(20);
            qu.Enqueue(15);
            qu.Enqueue(10);
            qu.Enqueue(5);
            qu.Print();
            Console.ReadLine();
            Console.Write($"Removed: {qu.Dequeue().Value}; New queue: ");
            qu.Print();
            Console.ReadLine();

        }
Пример #2
0
        public void Dequeue_ReassignsFrontendTop()
        {
            PseudoQ <int> qu = new PseudoQ <int>();

            qu.Enqueue(5);
            qu.Enqueue(3);
            qu.Enqueue(1);
            qu.Dequeue();
            Assert.Equal(3, qu.Backend.Top.Value);
        }
Пример #3
0
        public void Dequeue_ReturnsFrontNode()
        {
            PseudoQ <int> qu = new PseudoQ <int>();

            qu.Enqueue(5);
            qu.Enqueue(3);
            qu.Enqueue(1);
            Node <int> removed = qu.Dequeue();

            Assert.Equal(5, removed.Value);
        }