Exemplo n.º 1
0
        public void UnShiftPopTest()
        {
            var num  = 50000;
            var lst  = new QuickList <int>();
            var rand = new System.Random();
            var lst2 = new List <int>();

            for (var i = 0; i < num; i++)
            {
                var v = rand.Next();
                lst.UnShift(v);
                lst2.Add(v);
            }
            foreach (var v in lst2)
            {
                Assert.AreEqual(v, lst.Pop());
            }
            Assert.AreEqual(0, lst.Count);
            Assert.AreEqual(0, lst.Length);
        }
Exemplo n.º 2
0
        public void NullElementUnShiftTest()
        {
            var master = new QuickList <object>(3);
            var result = new List <object> {
                null, 1, 2, null, 3
            };

            foreach (var r in result)
            {
                master.UnShift(r);
            }

            result.Reverse();
            var index = 0;

            foreach (var r in master)
            {
                Assert.AreEqual(result[index++], r);
            }
        }