示例#1
0
        public void CheckClearQueue()
        {
            MyQueue <int> queueArray = new ArrayQueue <int>();
            MyQueue <int> queueList  = new ListQueue <int>();

            for (int i = 1; i < 11; i++)
            {
                queueArray.Enqueue(i);
                queueList.Enqueue(i);
            }

            queueArray.Clear();
            queueList.Clear();

            Assert.Equal(0, queueArray.Count());
            Assert.Equal(0, queueList.Count());
        }
示例#2
0
        public void CheckCountQueue()
        {
            MyQueue <int> queueArray = new ArrayQueue <int>();
            MyQueue <int> queueList  = new ListQueue <int>();

            for (int i = 1; i < 11; i++)
            {
                queueArray.Enqueue(i);
                queueList.Enqueue(i);
            }

            var countArray = queueArray.Count();
            var countList  = queueList.Count();

            Assert.Equal(10, countArray);
            Assert.Equal(10, countList);
        }