public void Test1() { var list = new List <int> { 8, 5, 1, 2, 5, 4, 7, 5, 2, 1, 2, 1 }; CountingSorter.CountingSort(list); }
public void ShouldCreateSameSizedResult() { var sorter = new CountingSorter(); int[] result = sorter.CountingSort(new int[] { 3, 1, 5, 4 }, 5); Assert.AreEqual(4, result.Length); }
public void ShouldSortSingleItem() { var sorter = new CountingSorter(); int[] result = sorter.CountingSort(new int[] { 3 }, 5); Assert.AreEqual(3, result[0]); }
public void ShouldNotAllowItemsOutOfRange() { var sorter = new CountingSorter(); int[] items = { 3, 1, 5, 4 }; Assert.Throws <ArgumentOutOfRangeException>(() => sorter.CountingSort(items, 4)); }
public void ShouldSortEmptyArray() { var sorter = new CountingSorter(); int[] result = sorter.CountingSort(new int[] { }, 5); Assert.IsEmpty(result); }
public void ShouldSortMultipleItemsWithRepeats() { var sorter = new CountingSorter(); int[] result = sorter.CountingSort(new int[] { 4, 3, 4, 5, 1, 1, 5, 4 }, 5); int[] expected = { 1, 1, 3, 4, 4, 4, 5, 5 }; Assert.AreEqual(expected, result); }