public void TestSeggregateOddEven() { var list = new Node(5).Append(1).Append(2).Append(3).Append(4).Append(6); var list1 = new Node(2).Append(4).Append(6).Append(5).Append(1).Append(3); var list2 = LinkedListProblems.SeggregateOddEven(list); Assert.AreEqual(0, list1.CompareTo(list2)); }
public void TestNodeCompare() { var lowerNode = new Node<int>(1); var lowerNode2 = new Node<int>(1); var higherNode = new Node<int>(2); Assert.AreEqual(-1, lowerNode.CompareTo(higherNode)); Assert.AreEqual(1, higherNode.CompareTo(lowerNode)); Assert.AreEqual(-1, lowerNode.CompareTo(null)); Assert.AreEqual(0, lowerNode.CompareTo(lowerNode2)); }