public void TestMethodRemovHead4() { DLLNode p = new DLLNode("1"); DLList dll = new DLList(); dll.addToHead(p); dll.removHead(); //Before removal, list should be 1 //After, head and tail should point to null Assert.AreEqual(true, (dll.head == null && dll.tail == null)); }//End of TestMethodRemovHead4
public void TestMethodRemovHead2() { DLLNode p = new DLLNode("1"); DLList dll = new DLList(); dll.addToHead(p); p = new DLLNode("2"); dll.addToHead(p); p = new DLLNode("3"); dll.addToHead(p); dll.removHead(); //Before removal, order should be 3,2,1 //After, should be null -> 2 -> 1 -> null Assert.AreEqual(true, (dll.head.previous == null && dll.head.str == "2" && dll.head.next.str == "1" && dll.head.next.next == null)); }//End of TestMethodRemovHead2
public void TestMethodRemovHead3() { DLLNode p = new DLLNode("1"); DLList dll = new DLList(); dll.addToHead(p); p = new DLLNode("2"); dll.addToHead(p); p = new DLLNode("3"); dll.addToHead(p); dll.removHead(); //Before removal, order should be 3,2,1 //After, should be null <- 2 <- 1 <- null Assert.AreEqual(true, (dll.tail.str == "1" && dll.tail.previous.str == "2")); }//End of TestMethodRemovHead3
public void TestMethodRemovHead1() { DLLNode p = new DLLNode("1"); DLList dll = new DLList(); dll.addToHead(p); p = new DLLNode("2"); dll.addToHead(p); p = new DLLNode("3"); dll.addToHead(p); dll.removHead(); //Before removal, order should be 3,2,1 //After, should be 2,1, with head.previous null, and tail.next null Assert.AreEqual(true, (dll.head.str == "2" && dll.tail.str == "1")); Assert.AreEqual(true, (dll.head.previous == null && dll.tail.next == null)); }//End of TestMethodRemovHead1