public void SortTest_DESC_DuplicateKey() { String[] a = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "3", "4", "5", "3", "4", "5", "3", "4", "5" }; Shuffle.Do(a); Assert.IsFalse(SortHelper.IsSorted(a, SortOrder.DESC)); Quick3WaySort.Sort(a, SortOrder.DESC); Assert.IsTrue(SortHelper.IsSorted(a, SortOrder.DESC)); }
public void SortTest() { String[] a = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; Shuffle.Do(a); Assert.IsFalse(SortHelper.IsSorted(a)); Quick3WaySort.Sort(a); Assert.IsTrue(SortHelper.IsSorted(a)); }
public void TestCaseDescending() { SampleArray <int> .Get(out int[] arr, out int[] arrCopy, () => _random.Next(0, 100)); Array.Sort(arrCopy, new Comparison <int>((x, y) => y.CompareTo(x))); var sort = new Quick3WaySort <int>(Comparer <int> .Create(new Comparison <int>((x, y) => y.CompareTo(x)))); sort.Sort(arr); Assert.Equal(arr, arrCopy); }
public void TestCaseAscending() { SampleArray <int> .Get(out int[] arr, out int[] arrCopy, () => _random.Next(0, 100)); Array.Sort(arrCopy); var sort = new Quick3WaySort <int>(); sort.Sort(arr); Assert.Equal(arr, arrCopy); }
public void SortWithComparerTest_DESCOrder_NullComparer() { Point[] points = new Point[10]; for (int i = 0; i < 10; i++) { points[i] = new Point(i, 10 - i); } Quick3WaySort.Sort(points, null, SortOrder.DESC); }
public void SortWithComparerTest_DESC() { Point[] points = new Point[10]; for (int i = 0; i < 10; i++) { points[i] = new Point(i, 10 - i); } Shuffle.Do(points); Assert.IsFalse(SortHelper.IsSorted(points, Point.X_ORDER, SortOrder.DESC)); Quick3WaySort.Sort(points, Point.X_ORDER, SortOrder.DESC); Assert.IsTrue(SortHelper.IsSorted(points, Point.X_ORDER, SortOrder.DESC)); }
public void SortWithComparerTest_DESC_DuplicateKey() { Point[] points = new Point[19]; for (int i = 0; i < 10; i++) { points[i] = new Point(i, 10 - i); } for (int i = 0; i < 3; i++) { for (int j = 3; j <= 5; j++) { points[10 + i * 3 + j - 3] = new Point(j, 10 - i); } } Shuffle.Do(points); Assert.IsFalse(SortHelper.IsSorted(points, Point.X_ORDER, SortOrder.DESC)); Quick3WaySort.Sort(points, Point.X_ORDER, SortOrder.DESC); Assert.IsTrue(SortHelper.IsSorted(points, Point.X_ORDER, SortOrder.DESC)); }
public void SortWithComparerTest_DESCOrder_NullArray() { Quick3WaySort.Sort(null, Point.X_ORDER, SortOrder.DESC); }
public void SortWithComparerTest_NullArray() { Quick3WaySort.Sort(null, Point.X_ORDER); }
public void SortTest_DESCOrder_NullArray() { Quick3WaySort.Sort(null, SortOrder.DESC); }
public void SortTest_NullArray() { Quick3WaySort.Sort(null); }