Exemple #1
0
        public void TestMethod7()
        {
            DNode head = null;

            head = DoublyLinkedListOps.Insert(head, 1, 0);

            // 1 <-> null
            Assert.AreEqual(1, head.data);
            Assert.IsNull(head.next);
        }
Exemple #2
0
        public void TestMethod11()
        {
            DNode head = null;

            head = DoublyLinkedListOps.Insert(head, 1, 0);
            head = DoublyLinkedListOps.Insert(head, 2, 0);
            head = DoublyLinkedListOps.Insert(head, 3, 100);

            // 2 <-> 1 <-> 3 <-> null
            Assert.AreEqual(2, head.data);
            Assert.AreEqual(1, head.next.data);
            Assert.AreEqual(2, head.next.prev.data);
            Assert.AreEqual(3, head.next.next.data);
            Assert.AreEqual(1, head.next.next.prev.data);
            Assert.IsNull(head.next.next.next);
        }