public void ReorderList_ReturnsList() { TLinkedList testInput = new TLinkedList(new int[] { 1, 1 }); ListNode result = new TLinkedList(new int[] { 1, 1 }).Head; this.executeFunctionInputTypeListNode(result, testInput, TestInstance.ReorderList); }
public void SwapPairs_RetunsList() { TLinkedList testInput = new TLinkedList(new int[] { 1, 2 }); ListNode result = new TLinkedList(new int[] { 2, 1 }).Head; this.executeFunctionInputTypeListNode(result, testInput, TestInstance.SwapPairs); }
public void RotateRight_ReturnsRotatedList() { TLinkedList testInput = new TLinkedList(new int[] { 1, 1, 2, 2, 3, 3, 6 }); ListNode result = new TLinkedList(new int[] { 1, 1, 2, 2, 3, 3, 6 }).Head; this.executeFunctionInputTypeListNodeInt(result, testInput, TestInstance.RotateRight, 70); }
public void LPalin_ReturnInt() { TLinkedList testInput = new TLinkedList(new int[] { 1, 2, 1 }); ListNode response = TestInstance.deleteDuplicates(testInput.Head); ListNode result = testInput.Head; // Assert Assert.IsTrue(this.compareLinkedLists(result, response)); }
public void ReverseBetween_ReturnReversedList() { TLinkedList testInput = new TLinkedList(new int[] { 1, 2, 3, 4, 5 }); ListNode result = new TLinkedList(new int[] { 5, 4, 3, 2, 1 }).Head; ListNode response = TestInstance.ReverseBetween(testInput.Head, 1, 5); // Assert the test. Assert.IsTrue(this.compareLinkedLists(result, response)); }
public void deleteDuplicates_ReturnsList() { TLinkedList testInput = new TLinkedList(new int[] { 1, 1, 2, 2, 3, 4, 4, 5, 5, 6 }); ListNode result = new TLinkedList(new int[] { 1, 2, 3, 4, 5, 6 }).Head; ListNode response = TestInstance.deleteDuplicates(testInput.Head); // Assert the test. Assert.IsTrue(this.compareLinkedLists(result, response)); }
public void AddTwoNumbers_ReturnSumAsList() { TLinkedList testInput1 = new TLinkedList(new int[] { 9, 9 }); TLinkedList testInput2 = new TLinkedList(new int[] { 9, 9 }); ListNode result = new TLinkedList(new int[] { 8, 9, 1 }).Head; ListNode response = TestInstance.addTwoNumbers(testInput1.Head, testInput2.Head); // Assert the test. Assert.IsTrue(this.compareLinkedLists(result, response)); }
public void RemoveNthFromEnd_ReturnHead() { TLinkedList testInput = new TLinkedList(new int[] { 1, 1, 2, 2, 3, 4, 4, 5, 5, 6 }); ListNode result = new TLinkedList(new int[] { 1, 2, 2, 3, 4, 4, 5, 5, 6 }).Head; ListNode response = TestInstance.RemoveNthFromEnd(testInput.Head, 15); // Assert the test. Assert.IsTrue(this.compareLinkedLists(result, response)); }
public void mergeTwoLists_returnListHead() { TLinkedList testInput_1 = new TLinkedList(new int[] { 1, 2, 3 }); TLinkedList testInput_2 = new TLinkedList(new int[] { 4, 5, 6 }); ListNode result = new TLinkedList(new int[] { 1, 2, 3, 4, 5, 6 }).Head; ListNode response = TestInstance.MergeTwoLists(testInput_1.Head, testInput_2.Head); // Assert the test. Assert.IsTrue(this.compareLinkedLists(result, response)); }
private void executeFunctionInputTypeListNodeInt(ListNode result, TLinkedList testInput, Func <ListNode, int, ListNode> f, int pos) { ListNode response = f(testInput.Head, pos); Assert.IsTrue(this.compareLinkedLists(result, response)); }