public void SortExample() { var sorter = new CombSorter<int>(); var list = new List<int> {13, 5, 77, 9, 12}; sorter.Sort(list, Comparer<int>.Default); Assert.AreEqual(5, list[0]); Assert.AreEqual(9, list[1]); Assert.AreEqual(12, list[2]); Assert.AreEqual(13, list[3]); Assert.AreEqual(77, list[4]); }
public static void ArraySorted_WithCustomShrinkFactor([Random(0, 1000, 100, Distinct = true)] int n) { // Arrange var sorter = new CombSorter <int>(1.5); var intComparer = new IntComparer(); var(correctArray, testArray) = RandomHelper.GetArrays(n); // Act sorter.Sort(testArray, intComparer); Array.Sort(correctArray, intComparer); // Assert Assert.AreEqual(testArray, correctArray); }
public void SortExample() { var sorter = new CombSorter <int>(); var list = new List <int> { 13, 5, 77, 9, 12 }; sorter.Sort(list, Comparer <int> .Default); Assert.AreEqual(5, list[0]); Assert.AreEqual(9, list[1]); Assert.AreEqual(12, list[2]); Assert.AreEqual(13, list[3]); Assert.AreEqual(77, list[4]); }
public void ExceptionNullComparer1() { var sorter = new CombSorter<int>(); sorter.Sort(new List<int>(), (IComparer<int>)null); }
public void ExceptionNullList3() { var sorter = new CombSorter<int>(); sorter.Sort(null, SortOrder.Ascending); }
public void ExceptionNullList2() { var sorter = new CombSorter<int>(); sorter.Sort(null, Comparer<int>.Default); }
public void ExceptionNullList1() { var sorter = new CombSorter<int>(); sorter.Sort(null); }
public void TestCombSortNullComparer1() { CombSorter <int> sorter = new CombSorter <int>(); sorter.Sort(new List <int>(), (IComparer <int>)null); }
public void TestCombSortNullList3() { CombSorter <int> sorter = new CombSorter <int>(); sorter.Sort(null, SortOrder.Ascending); }
public void TestCombSortNullList2() { CombSorter <int> sorter = new CombSorter <int>(); sorter.Sort(null, Comparer <int> .Default); }
public void TestCombSortNullList1() { CombSorter <int> sorter = new CombSorter <int>(); sorter.Sort(null); }