public InsertionSort() { algorithm = new InsertionSorting(); displayInputMessage(); this.complexity = "n-square"; this.takeInput(); }
public void Sort_PassEmptyArray_ReturnEmptyArray() { var insertSorting = new InsertionSorting(); var sortedArray = insertSorting.Sort(_emptyArray, 0, _emptyArray.Length - 1); CollectionAssert.AreEqual(sortedArray, _emptyArray); }
public void Sort_PassValidArray_ReturnSortedArray() { var insertSorting = new InsertionSorting(); var sortedArray = insertSorting.Sort(_toSortArray, 0, _toSortArray.Length - 1); CollectionAssert.AreEqual(sortedArray, _referenceSortedArray); }
public void Sort_PassOneElementArray_ReturnOneElementArray() { var insertSorting = new InsertionSorting(); var sortedArray = insertSorting.Sort(_oneElementArray, 0, _oneElementArray.Length - 1); CollectionAssert.AreEqual(sortedArray, _oneElementArray); }
public void InsertionSorting_Sort__SuccessResult() { ISorting testClass = new InsertionSorting(); int[] array = new int[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; testClass.Sort(array); array.Should().Equal(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); }
public void InsertionSorting_Test() { var rand = new Random(); var list = Enumerable .Range(1, 10000) .Select(x => rand.Next()) .ToList(); var actual = InsertionSorting.Sort(list); list.Sort(); Assert.Equal(list, actual); }
static void Main() { SelectionSorting.SelectionSortArray(); InsertionSorting.InsertionSortArray(); QuickSorting.QuickSortArray(); }
public void InsertionSorting_Sort() { ISorting testClass = new InsertionSorting(); testClass.Sort(SortedData); }