public void EmptyListShift() { var master = new QuickList <object>(); ExceptionAssert.Throws <InvalidOperationException>(() => { master.Shift(); }); }
public void NullElementShiftTest() { var master = new QuickList <object>(3); var result = new List <object> { null, 1, 2, null, 3 }; foreach (var r in result) { master.Push(r); } foreach (var r in result) { Assert.AreEqual(r, master.Shift()); } }
public void PushShiftData() { var num = 500000; 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.Push(v); lst2.Add(v); } foreach (var v in lst2) { Assert.AreEqual(v, lst.Shift()); } Assert.AreEqual(0, lst.Count); Assert.AreEqual(0, lst.Length); }
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()); } }
public void EmptyListShift() { var master = new QuickList <object>(); Assert.AreEqual(null, master.Shift()); }