public void PartialStableSort_Comparison(int[] input, int index, int count, int[] expected) { var actual = SortExtensions.StableSort(input, index, count, IntComparison); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void StableSort_Comparer(int[] input, int[] expected) { var actual = SortExtensions.StableSort(input, IntComparer); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void StableSort_Comparison_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort(null, IntComparison)); Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort(new[] { 1 }, (Comparison <int>)null)); }
public void StableSort_Comparison(int[] input, int[] expected) { var actual = SortExtensions.StableSort(input, (l, r) => r.CompareTo(l)); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void PartialStableSort_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort((IList <int>)null, 0, 0)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.StableSort(new[] { 1, 2 }, -1, 1)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 0, -1)); Assert.Throws <ArgumentException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 2, 1)); Assert.Throws <ArgumentException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 0, 3)); }
public void PartialStableSort_Comparison_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort(null, 0, 0, IntComparison)); Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 0, 1, (Comparison <int>)null)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.StableSort(new[] { 1, 2 }, -1, 1, IntComparison)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 0, -1, IntComparison)); Assert.Throws <ArgumentException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 2, 1, IntComparison)); Assert.Throws <ArgumentException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 0, 3, IntComparison)); }
public void StableSort_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort((IList <int>)null)); }