public void AddLastTest() { DoublyList <int> list = new DoublyList <int>(); for (int i = 1; i <= 10; i++) { list.AddLast(i); } Assert.AreEqual(list.Head.Data, 1); Assert.AreEqual(list.Tail.Data, 10); }
public void GetDataLastTest() { DoublyList <int> list = new DoublyList <int>(); for (int i = 1; i <= 5; i++) { list.AddLast(i); } Assert.AreEqual(list.GetDataLast(4), 1); Assert.Catch <IndexOutOfRangeException>(() => list.GetDataLast(10)); Assert.Pass(); }
public void FindLastTest() { DoublyList <int> list = new DoublyList <int>(); for (int i = 1; i <= 5; i++) { list.AddLast(i); } Assert.AreEqual(list.FindLast(5), 0); Assert.AreEqual(list.FindLast(6), -1); Assert.Pass(); }
public void RemoveTest() { DoublyList <int> list = new DoublyList <int>(); list.Remove(5); for (int i = 1; i <= 5; i++) { list.AddLast(i); } list.Remove(3); list.Remove(6); Assert.AreEqual(list.Head.Next.Next.Data, 4); Assert.Pass(); }
public void RemoveLastTest() { DoublyList <int> list = new DoublyList <int>(); list.RemoveLast(); for (int i = 1; i <= 5; i++) { list.AddLast(i); } list.RemoveLast(); Assert.AreEqual(list.Tail.Data, 4); Assert.Pass(); }