示例#1
0
        public virtual void TestNext()
        {
            IQueue4 queue = new NonblockingQueue();

            string[] data = { "a", "b", "c" };
            queue.Add(data[0]);
            Assert.AreSame(data[0], queue.Next());
            queue.Add(data[1]);
            queue.Add(data[2]);
            AssertNext(new object[] { data[1], data[2] }, queue);
        }
示例#2
0
        private IQueue4 NewQueue(object[] items)
        {
            var queue = new NonblockingQueue();

            for (var i = 0; i < items.Length; i++)
            {
                queue.Add(items[i]);
            }
            return(queue);
        }
示例#3
0
        public virtual void TestIterator()
        {
            IQueue4 queue = new NonblockingQueue();

            string[] data = { "a", "b", "c", "d" };
            for (var idx = 0; idx < data.Length; idx++)
            {
                AssertIterator(queue, data, idx);
                queue.Add(data[idx]);
                AssertIterator(queue, data, idx + 1);
            }
        }