Beispiel #1
0
        //this test Sort() method
        public void Enqueue19410723856_Sort_12345678910returned()
        {
            string expected       = "12345678910";
            string dequeue_buffer = "";

            simple_ds.Structures.Queue <int> test_queue = new simple_ds.Structures.Queue <int>();

            test_queue.Enqueue(1);
            test_queue.Enqueue(9);
            test_queue.Enqueue(4);
            test_queue.Enqueue(10);
            test_queue.Enqueue(7);
            test_queue.Enqueue(2);
            test_queue.Enqueue(3);
            test_queue.Enqueue(8);
            test_queue.Enqueue(5);
            test_queue.Enqueue(6);

            test_queue.Sort();
            while (!test_queue.isEmpty())
            {
                dequeue_buffer += test_queue.Dequeue().ToString();
            }

            Assert.AreEqual(expected, dequeue_buffer);
        }
Beispiel #2
0
        //this test Enqueue(), Dequeue() and IsEmpty() methods
        public void Enqueue12345678910_Dequeue12345678910_12345678910returned()
        {
            string expected       = "12345678910";
            string dequeue_buffer = "";

            simple_ds.Structures.Queue <int> test_queue = new simple_ds.Structures.Queue <int>();

            for (var item = 1; item <= 10; ++item)
            {
                test_queue.Enqueue(item);
            }

            while (!test_queue.isEmpty())
            {
                dequeue_buffer += test_queue.Dequeue().ToString();
            }

            Assert.AreEqual(expected, dequeue_buffer);
        }