public void InsertionSortArrayListTest(int[] toSortInts, int[] expectedSortedInts) { ArrayList<int> toSort = new ArrayList<int>(); toSort.AddRange(toSortInts); toSort.InsertionSort(); CollectionAssert.AreEqual(toSort, expectedSortedInts); }
public void InsertionSortArrayListTest(int[] toSortInts, int[] expectedSortedInts) { ArrayList <int> toSort = new ArrayList <int>(); toSort.AddRange(toSortInts); toSort.InsertionSort(); CollectionAssert.AreEqual(toSort, expectedSortedInts); }
public static void DoTest() { var list1 = new ArrayList <int> { 23, 42, 4, 16, 8, 15, 9, 55, 0, 34, 12, 2 }; var list2 = new List <long> { 23, 42, 4, 16, 8, 15, 9, 55, 0, 34, 12, 2 }; // sort both lists list1.InsertionSort(); list2.InsertionSort(); bool isListEqual = true; for (int i = 0; i < list1.Count; i++) { if (list1[i] != list2[i]) { isListEqual = false; break; } } Assert.True(isListEqual); }
public static void DoTest () { ArrayList<int> list = new ArrayList<int> (); list.Add (23); list.Add (42); list.Add (4); list.Add (16); list.Add (8); list.Add (15); list.Add (9); list.Add (55); list.Add (0); list.Add (34); list.Add (12); list.Add (2); Console.WriteLine ("Before Sort:\r\n" + list.ToHumanReadable() + "\r\n"); list.InsertionSort (); Console.WriteLine ("After Sort:\r\n" + list.ToHumanReadable() + "\r\n"); // ANOTHER LIST TO SORT List<long> list2 = new List<long> (); list2.Add (23); list2.Add (42); list2.Add (4); list2.Add (16); list2.Add (8); list2.Add (15); list2.Add (9); list2.Add (55); list2.Add (0); list2.Add (34); list2.Add (12); list2.Add (2); list2.InsertionSort (); }
public static void DoTest() { ArrayList <int> list = new ArrayList <int> (); list.Add(23); list.Add(42); list.Add(4); list.Add(16); list.Add(8); list.Add(15); list.Add(9); list.Add(55); list.Add(0); list.Add(34); list.Add(12); list.Add(2); Console.WriteLine("Before Sort:\r\n" + list.ToHumanReadable() + "\r\n"); list.InsertionSort(); Console.WriteLine("After Sort:\r\n" + list.ToHumanReadable() + "\r\n"); // ANOTHER LIST TO SORT List <long> list2 = new List <long> (); list2.Add(23); list2.Add(42); list2.Add(4); list2.Add(16); list2.Add(8); list2.Add(15); list2.Add(9); list2.Add(55); list2.Add(0); list2.Add(34); list2.Add(12); list2.Add(2); list2.InsertionSort(); }
public static void DoTest() { var list = new ArrayList <int> { 23, 42, 4, 16, 8, -8, 9, 55, 0, 34, 12, 2, -10, -98 }; list.InsertionSort <int>(); Assert.True(list.IsSorted()); }