Exemplo n.º 1
0
        public void TestNull()
        {
            ListNode head = null;

            Assert.IsNull(ReverseList.Process(head));
            Assert.IsNull(ReverseList.Process_Recursively(head));
        }
Exemplo n.º 2
0
        public void TestOnlyOneNode()
        {
            ListNode head = new ListNode(1);

            Assert.AreEqual(new ListNode(1), ReverseList.Process(head));

            head = new ListNode(1);
            Assert.AreEqual(new ListNode(1), ReverseList.Process_Recursively(head));
        }
Exemplo n.º 3
0
        public void TestLengthIsOdd()
        {
            ListNode head     = Helper.CreateLinkedList(new int[] { 1, 2, 3 });
            ListNode expected = Helper.CreateLinkedList(new int[] { 3, 2, 1 });

            Assert.IsTrue(Helper.CompareLinkedList(expected, ReverseList.Process(head)));

            head = Helper.CreateLinkedList(new int[] { 1, 2, 3 });
            Assert.IsTrue(Helper.CompareLinkedList(expected, ReverseList.Process_Recursively(head)));
        }