public void MergeNodeBeforeTest() { var master = new QuickList <int>(10); //node 1 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); //node 2 master.Push(10); master.Push(11); master.Push(12); master.Push(13); master.Push(14); master.Push(15); master.Push(16); master.Push(17); master.Push(18); master.Push(19); //node 3 master.Push(20); master.Push(21); master.Push(22); master.Push(23); master.Push(24); master.Push(25); master.Push(26); master.Push(27); master.Push(28); master.Push(29); master.InsertBefore(12, 777); master.InsertBefore(12, 666); master.InsertBefore(12, 555); Assert.AreEqual(4, master.Length); master.InsertBefore(555, 444); Assert.AreEqual(4, master.Length); }
public void NotFindToInsterBefore() { var master = new QuickList <int>(); master.InsertBefore(999, 199); Assert.AreEqual(0, master.Count); }
public void InsertBeforeBound() { var lst = new QuickList <int>(5); for (var i = 0; i < 10; i++) { lst.Push(i); } lst.InsertBefore(4, 999); lst.InsertBefore(999, 888); lst.InsertBefore(888, 777); Assert.AreEqual(777, lst[4]); Assert.AreEqual(888, lst[5]); Assert.AreEqual(999, lst[6]); }
public void InsertNodeAtHeaderTest() { var master = new QuickList <int>(5); for (var i = 0; i < 255; i++) { master.Push(i); } master.Remove(4); master.InsertBefore(5, 999); Assert.AreEqual(999, master[4]); }
public void FullNodeAndInsert() { var master = new QuickList <int>(5); for (var i = 0; i < 255; i++) { master.Push(i); } master.InsertBefore(5, 999); Assert.AreEqual(999, master[5]); master = new QuickList <int>(5); for (var i = 0; i < 255; i++) { master.Push(i); } master.InsertAfter(4, 999); Assert.AreEqual(999, master[5]); }