示例#1
0
        public void ForeachReverseListTest()
        {
            var master = new QuickList <int>(5);

            master.Push(0);
            master.Push(1);
            master.Push(2);
            master.Push(3);
            master.Push(4);
            master.Push(5);
            master.Push(6);
            master.Push(7);
            master.Push(8);
            master.Push(9);

            master.ReverseIterator();

            var i = 0;

            foreach (var v in master)
            {
                Assert.AreEqual(9 - i++, v);
                break;
            }
            i = 0;
            foreach (var v in master)
            {
                Assert.AreEqual(9 - i++, v);
            }
        }
示例#2
0
        public void EmptyListForeach()
        {
            var master = new QuickList <int>(5);

            foreach (var v in master)
            {
                Assert.Fail();
                if (v < 0)
                {
                }
            }

            master.ReverseIterator();
            foreach (var v in master)
            {
                Assert.Fail();
                if (v < 0)
                {
                }
            }
        }