Beispiel #1
0
        public void BoundFirstTest()
        {
            var master = new QuickList <int>(5);

            ExceptionAssert.Throws <InvalidOperationException>(() =>
            {
                master.First();
            });
        }
Beispiel #2
0
        public void BoundFirstTest()
        {
            var master = new QuickList <int>(5);

            ExceptionAssert.DoesNotThrow(() =>
            {
                master.First();
            });
        }
Beispiel #3
0
        public void FirstLastTest()
        {
            var master = new QuickList <int>(5);

            for (var i = 0; i < 255; i++)
            {
                master.Push(i);
            }

            Assert.AreEqual(0, master.First());
            Assert.AreEqual(254, master.Last());

            for (var i = 0; i < 255; i++)
            {
                master.Shift();
                if (i < 254)
                {
                    Assert.AreEqual(i + 1, master.First());
                }
            }

            Assert.AreEqual(0, master.Count);

            master = new QuickList <int>(5);
            for (var i = 0; i < 255; i++)
            {
                master.Push(i);
            }

            for (var i = 0; i < 255; i++)
            {
                if (i < 254)
                {
                    Assert.AreEqual(254 - i, master.Last());
                }
                Assert.AreEqual(254 - i, master.Pop());
            }
        }