public void RadixSort() { for (int i = 0; i < targets.Length; i++) { radix.Sort(targets[i]); } }
public void NullComparison() { var sorter = new RadixSorter(); var list = GetReverseSequentialTestList(); sorter.Sort(list, SortOrder.Ascending); AssertGeneralTestListSorted(list); }
public void Simple2() { var sorter = new RadixSorter(); var list1 = new List<int> {1, 2}; sorter.Sort(list1, SortOrder.Ascending); Assert.AreEqual(1, list1[0]); Assert.AreEqual(2, list1[1]); var list2 = new List<int> {1, 2}; sorter.Sort(list2, SortOrder.Descending); Assert.AreEqual(2, list2[0]); Assert.AreEqual(1, list2[1]); }
public static void SortsArray([Random(0, 1000, 100, Distinct = true)] int n) { // Arrange var sorter = new RadixSorter(); var(correctArray, testArray) = RandomHelper.GetArrays(n); // Act sorter.Sort(testArray); Array.Sort(correctArray); // Assert Assert.AreEqual(correctArray, testArray); }
public void SortExample() { var sorter = new RadixSorter(); var list = new List<int> {13, 5, 77, 9, 12}; sorter.Sort(list); 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 Sort_DoesNotChange_OriginalInput() { //arrange const int firstElement = 5, lastElement = 3; var original = new List <int> { firstElement, 2, 4, 6, 1, lastElement }; var sorter = new RadixSorter(); //act var sorted = sorter.Sort(original); //assert original[0].Should().Be(firstElement); original[5].Should().Be(lastElement); }
public void SortExample() { var sorter = new RadixSorter(); var list = new List <int> { 13, 5, 77, 9, 12 }; sorter.Sort(list); 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 Sort_Returns_AscOrderedCollection() { //arrange var original = new List <int> { 5, 2, 4, 6, 1, 3 }; var sorter = new RadixSorter(); //act var sorted = sorter.Sort(original).ToList(); //assert var prev = sorted[0]; for (var i = 1; i < sorted.Count; i++) { prev.Should().BeLessOrEqualTo(sorted[i]); prev = sorted[i]; } }
static void TestRadixSort() { try { Sorter sorter = new RadixSorter(); Console.WriteLine("Testing sort: " + sorter.GetType().Name); int[] arr = GenerateArray(10, 0, 10); Console.WriteLine("Source array: " + ArrToString(arr)); sorter.Sort(arr); Console.WriteLine("Resulting array: " + ArrToString(arr)); Console.WriteLine("OK!"); } catch (Sorter.InvalidRealizationException ex) { Console.WriteLine(ex.Info); } }
public void ExceptionNullList3() { var sorter = new RadixSorter(); sorter.Sort(null, SortOrder.Ascending); }
public void ExceptionNullList1() { var sorter = new RadixSorter(); sorter.Sort(null); }