//prints int test private static void PrintIntTest(UnorderedLinkedList <int> listInt) { string listType = "int"; Console.Write("Intial List of {0}: ", listType); listInt.print(); int s = 3; Console.WriteLine("\nRemove() - Test. Removes first occurence of {0}\t", s); Console.Write("Initial List:\t\t"); listInt.print(); listInt.remove(ref s); Console.Write("List without {0}:\t\t", s); listInt.print(); int sAll = 4; Console.WriteLine("\nRemoveAll() - Test. Remove all occurences of {0}", sAll); Console.Write("Initial List:\t\t"); listInt.print(); listInt.removeAll(ref sAll); Console.Write("List without ALL {0}:\t", sAll); listInt.print(); Console.WriteLine("\nMax() Test"); Console.WriteLine("Maximum {0} value expected:\t22", listType); Console.WriteLine("Max() {0} value returned: \t{1}", listType, listInt.Max().ToString()); Console.WriteLine("\nMin() Test"); Console.WriteLine("Minimum {0} value expected: \t1", listType); Console.WriteLine("Min() {0} value returned: \t{1}", listType, listInt.Min().ToString()); Console.WriteLine("\nSort() Test"); Console.Write("Initial {0} List: \t", listType); listInt.print(); Console.Write("Sorted {0} List: \t", listType); listInt.Sort(); listInt.print(); Console.WriteLine("Insertion Sort used in Sort() Method"); }
//prints string test private static void PrintStringTest(UnorderedLinkedList <string> listString) { string listType = "string"; Console.Write("Intial List of {0}: ", listType); listString.print(); string s = "GA"; Console.WriteLine("\nRemove() - Test. Removes first occurence of {0}", s); Console.Write("Initial List: \t\t"); listString.print(); listString.remove(ref s); Console.Write("List without {0}:\t", s); listString.print(); string sAll = "ZA"; Console.WriteLine("\nRemoveAll() - Test. Remove all occurences of {0}", sAll); Console.Write("Initial List:\t\t"); listString.print(); listString.removeAll(ref sAll); Console.Write("List without ALL {0}:\t ", sAll); listString.print(); Console.WriteLine("\nMax() Test"); Console.WriteLine("Maximum {0} value expected:\tZZ", listType); Console.WriteLine("Max() {0} value returned: \t{1}", listType, listString.Max().ToString()); Console.WriteLine("\nMin() Test"); Console.WriteLine("Minimum {0} value expected: \tAA", listType); Console.WriteLine("Min() {0} value returned: \t{1}", listType, listString.Min().ToString()); Console.WriteLine("\nSort() Test"); Console.Write("Initial {0} List: \t", listType); listString.print(); Console.Write("Sorted {0} List: \t", listType); listString.Sort(); listString.print(); Console.WriteLine("Insertion Sort used in Sort() Method"); }
//prints double test private static void PrintDoubleTest(UnorderedLinkedList <double> listDouble) { string listType = "double"; Console.Write("Intial List of {0}: ", listType); listDouble.print(); double s = 5.99d; Console.WriteLine("\nRemove() - Test. Removes first occurence of {0}", s); Console.Write("Initial List: \t\t"); listDouble.print(); listDouble.remove(ref s); Console.Write("List without {0}:\t", s); listDouble.print(); double sAll = 12.2d; Console.WriteLine("\nRemoveAll() - Test. Remove all occurences of {0}", sAll); Console.Write("Initial List:\t\t"); listDouble.print(); listDouble.removeAll(ref sAll); Console.Write("List without ALL {0}:\t", sAll); listDouble.print(); Console.WriteLine("\nMax() Test"); Console.WriteLine("Maximum {0} value expected:\t122", listType); Console.WriteLine("Max() {0} value returned: \t{1}", listType, listDouble.Max().ToString()); Console.WriteLine("\nMin() Test"); Console.WriteLine("Minimum {0} value expected: \t0.33", listType); Console.WriteLine("Min() {0} value returned: \t{1}", listType, listDouble.Min().ToString()); Console.WriteLine("\nSort() Test"); Console.Write("Initial {0} List: \t", listType); listDouble.print(); Console.Write("Sorted {0} List: \t", listType); listDouble.Sort(); listDouble.print(); Console.WriteLine("Insertion Sort used in Sort() Method"); }