public void PartialMergeSort_Comparison(int[] input, int index, int count, int[] expected) { var actual = SortExtensions.MergeSort(input, index, count, IntComparison); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void MergeSort_Comparison_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort(null, IntComparison)); Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort(new[] { 1 }, (Comparison <int>)null)); }
public void MergeSort_Comparison(int[] input, int[] expected) { var actual = SortExtensions.MergeSort(input, (l, r) => r.CompareTo(l)); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void MergeSort_Comparer(int[] input, int[] expected) { var actual = SortExtensions.MergeSort(input, IntComparer); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void PartialMergeSort_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort((IList <int>)null, 0, 0)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, -1, 1)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, -1)); Assert.Throws <ArgumentException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 2, 1)); Assert.Throws <ArgumentException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, 3)); }
public void PartialMergeSort_Comparison_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort(null, 0, 0, IntComparison)); Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, 1, (Comparison <int>)null)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, -1, 1, IntComparison)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, -1, IntComparison)); Assert.Throws <ArgumentException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 2, 1, IntComparison)); Assert.Throws <ArgumentException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, 3, IntComparison)); }
public void MergeSort_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort((IList <int>)null)); }