public void SortSimpleArray() { var array = GenerateRandomArray(3); HoareSort.QuickSort(array); Assert.That(array[0] < array[1] && array[1] < array[2], "Simple array sorting"); }
public void SortHugeArray() { var array = GenerateRandomArray(1500000000); HoareSort.QuickSort(array); for (var i = 1; i < array.Length; i++) { Assert.That(array[i - 1] < array[i]); } }
public void SortArrayEqualsElements() { var array = new int[100]; HoareSort.QuickSort(array); foreach (var n in array) { Assert.That(n == array[0]); } }
public void SortNormalArray() { var array = GenerateRandomArray(1000); var indexes = GenerateRandomArray(20, array.Length); HoareSort.QuickSort(array); for (var i = 0; i < indexes.Length; i += 2) { Assert.That((array[indexes[i]] < array[indexes[1 + i]] && indexes[i] < indexes[1 + i]) || (array[indexes[i]] > array[indexes[1 + i]] && indexes[i] > indexes[1 + i]), "Normal array sorting"); } }
public void SortEmptyArray() { var array = new int[0]; HoareSort.QuickSort(array); }