예제 #1
0
        //this test Clear() and Size() methods
        public void Enqueue12_Clear_Size_0returned()
        {
            int expected = 0;
            int dequeue_buffer;

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

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

            test_queue.Clear();
            dequeue_buffer = test_queue.Size();

            Assert.AreEqual(expected, dequeue_buffer);
        }
예제 #2
0
        //this test Copy() method
        public void Enqueue12345678910_Copy_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);
            }

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

            test_copy_queue = test_queue.Copy();
            test_queue.Clear();

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

            Assert.AreEqual(expected, dequeue_buffer);
        }