public void ReArrageListOddLenghtTest() { var list = SingleLinkedList <string> .CreateList("a1"); list.InsertLast("a2"); list.InsertLast("a3"); list.InsertLast("a4"); list.InsertLast("b1"); list.InsertLast("b2"); list.InsertLast("b3"); list.Print(); try { LinkedListProblems.ReArrageList(list); } catch (ArgumentException ex) { Assert.IsTrue(ex.Message.Equals("list length should be even."), "Odd length list should throw error"); } list.InsertLast("b4"); list.InsertLast("b5"); try { LinkedListProblems.ReArrageList(list); } catch (ArgumentException ex) { Assert.IsTrue(ex.Message.Equals("list length should be even."), "Odd length list should throw error"); } list.Print(); }
public void ReArrageListTwoNodeTest() { var list = SingleLinkedList <string> .CreateList("a1"); list.InsertLast("b1"); list.Print(); LinkedListProblems.ReArrageList(list); list.Print(); }
public void ReArrageListNullTest() { var list = SingleLinkedList <string> .CreateList("a1"); list.DeleteFirst(); list.Print(); LinkedListProblems.ReArrageList(list); list.Print(); }
public void ReArrageListBigListTest() { var list = SingleLinkedList <string> .CreateList("a1"); list.InsertLast("a2"); list.InsertLast("a3"); list.InsertLast("a4"); list.InsertLast("b1"); list.InsertLast("b2"); list.InsertLast("b3"); list.InsertLast("b4"); list.Print(); LinkedListProblems.ReArrageList(list); list.Print(); }