コード例 #1
0
        public void TestMethod12()
        {
            DNode head = null;

            head = DoublyLinkedListOps.AddTail(head, 1);
            head = DoublyLinkedListOps.DeleteFirstOf(head, 1);
            Assert.IsNull(head);
        }
コード例 #2
0
        public void TestMethod4()
        {
            DNode head = null;

            head = DoublyLinkedListOps.AddTail(head, 1);

            // 1 <-> null
            Assert.AreEqual(1, head.data);
            Assert.IsNull(head.next);
        }
コード例 #3
0
        public void TestMethod14()
        {
            DNode head = null;

            head = DoublyLinkedListOps.AddTail(head, 1);
            head = DoublyLinkedListOps.AddTail(head, 2);
            head = DoublyLinkedListOps.DeleteFirstOf(head, 2);

            ValidateList(head, new List <int> {
                1
            });
        }
コード例 #4
0
        public void TestMethod6()
        {
            DNode head = null;

            head = DoublyLinkedListOps.AddTail(head, 1);
            head = DoublyLinkedListOps.AddTail(head, 2);
            head = DoublyLinkedListOps.AddTail(head, 3);

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