public void QuickSort_EmptyArray_ArgumentExceptionExpected() { // arrange int[] testarr = { }; ArrayIntExtension.QuickSort(testarr); }
public void QuickSort_NullArray_ArgumentNullExceptionExpected() { // arrange int[] testarr = null; ArrayIntExtension.QuickSort(testarr); }
public void QuickSort_10PosAndNegNumbers_SortedExpected() { // arrange int[] testarr = { 74, 23, 7, -7, 0, 1, 8 }; int[] expected = { -7, 0, 1, 7, 8, 23, 74 }; ArrayIntExtension.QuickSort(testarr); // assert CollectionAssert.AreEqual(expected, testarr); }
public void QuickSort_5PosNumbers_SortedExpected() { // arrange int[] testarr = { 4, 3, 2, 1, 0 }; int[] expected = { 0, 1, 2, 3, 4 }; // act ArrayIntExtension.QuickSort(testarr); // assert CollectionAssert.AreEqual(expected, testarr); }
public void QuickSort_10000Numbers_SortedExpected() { Random rand = new Random(); int[] testarr = new int[10000]; for (int i = 0; i < testarr.Length; i++) { testarr[i] = rand.Next(int.MinValue, int.MaxValue); } ArrayIntExtension.QuickSort(testarr); Assert.IsTrue(IsSorted(testarr)); }