public void TestMethod12()
        {
            SNode head = null;

            head = SinglyLinkedListOps.AddTail(head, 1);
            head = SinglyLinkedListOps.DeleteAll(head, 1);
            ValidateList(head, new List <int>());
        }
        public void TestMethod4()
        {
            SNode head = null;

            head = SinglyLinkedListOps.AddTail(head, 1);

            Assert.AreEqual(1, head.data);
            Assert.IsNull(head.next);
        }
        public void TestMethod28()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);

            // Swap 1 and 2
            SinglyLinkedListOps.Swap(ref head, head, head.next);
            ValidateList(head, new List <int> {
                2, 1
            });
        }
        public void TestMethod23()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);

            head = SinglyLinkedListOps.Reverse(head);

            Assert.AreEqual(2, head.data);
            Assert.AreEqual(1, head.next.data);
            Assert.IsNull(head.next.next);
        }
        public void TestMethod32()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);
            head = SinglyLinkedListOps.AddTail(head, 3);

            // Try to swap nodes, where 'b' doesn't exist.
            SinglyLinkedListOps.Swap(ref head, head.next, new SNode {
                data = 20
            });
            ValidateList(head, new List <int> {
                1, 2, 3
            });
        }
        public void TestMethod26()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);
            head = SinglyLinkedListOps.AddTail(head, 3);
            head = SinglyLinkedListOps.AddTail(head, 4);
            head = SinglyLinkedListOps.AddTail(head, 5);

            // Swap 2 and 3
            SinglyLinkedListOps.Swap(ref head, head.next, head.next.next);
            ValidateList(head, new List <int> {
                1, 3, 2, 4, 5
            });
        }
        public void TestMethod30()
        {
            SNode head = new SNode {
                data = 1
            };

            head = SinglyLinkedListOps.AddTail(head, 2);
            head = SinglyLinkedListOps.AddTail(head, 3);

            // Try to swap nodes that don't exist.
            SinglyLinkedListOps.Swap(ref head, new SNode {
                data = 10
            }, new SNode {
                data = 20
            });
            ValidateList(head, new List <int> {
                1, 2, 3
            });
        }