public void ThreeWayQuickSortTest() { //Arrange var threeWayQuickSort = new ThreeWayQuickSort <int>(); var arrayToSort = new[] { 53, 14, 39, 96, 37, 27, 53, 73, 53, 53 }; arrayToSort.CopyTo(arrayToSort, 0); //Act arrayToSort.Sort(threeWayQuickSort); //Assert Assert.IsTrue(arrayToSort.IsSorted()); }
public void testSort() { var a = new int[100]; var b = new int[100]; for (var i = 0; i < a.Length; ++i) { a[i] = i; b[i] = i; } KnuthShuffle.Shuffle(a); Assert.NotEqual(b, a); ThreeWayQuickSort.Sort(a); for (var i = 0; i < a.Length; ++i) { Assert.Equal(b[i], a[i]); } }
public void ThreeWayQuickSortTest() { //Arrange var threeWayQuickSort = new ThreeWayQuickSort<int>(); var arrayToSort = new []{ 53, 14, 39, 96, 37, 27, 53, 73, 53, 53}; arrayToSort.CopyTo(arrayToSort, 0); //Act arrayToSort.Sort(threeWayQuickSort); //Assert Assert.IsTrue(arrayToSort.IsSorted()); }
public static void ThreeWayQuickSort(int[] a, SortDirection direction) { ThreeWayQuickSort<int> qs = new ThreeWayQuickSort<int>(); qs.Sort(a, direction); }