public void MergeSort_TestArraySort_ExpectedArray() { int[] testArray = { 7, -2, 1, 4, 0, 9, 5, 3, 1, 8 }; int[] expectedArray = { -2, 0, 1, 1, 3, 4, 5, 7, 8, 9 }; Sortings.MergeSort(testArray); CollectionAssert.AreEqual(expectedArray, testArray); }
public void MergeSort_NullArray() { // Arrange int[] array = null; // Act Sortings.MergeSort(array); }
public void MergeSort_IntArrayOfNegativeAndBigEl() { // Arrange var expexted = new[] { int.MinValue, -333, 0, 1, 9999, int.MaxValue }; var actual = new[] { 9999, int.MaxValue, -333, int.MinValue, 0, 1 }; // Act Sortings.MergeSort(actual); // Assert Assert.IsTrue(expexted.SequenceEqual(actual)); }
public void MergeSort_IntArrayOf5El() { // Arrange var expexted = new[] { 1, 2, 3, 4, 5 }; var actual = new[] { 3, 1, 2, 5, 4 }; // Act Sortings.MergeSort(actual); // Assert Assert.IsTrue(expexted.SequenceEqual(actual)); }
public void MergeSort_LargeArray_ExtectedArray() { int minPossibleValue = 0; int maxPossibleValue = 1000000; Random randNum = new Random(); int[] largeTestArray = new int[Int32.MaxValue / 10000]; for (int i = 0; i < largeTestArray.Length; i++) { largeTestArray[i] = randNum.Next(minPossibleValue, maxPossibleValue); } int[] expectedArray = largeTestArray; Array.Sort(expectedArray); Sortings.MergeSort(largeTestArray); CollectionAssert.AreEqual(expectedArray, largeTestArray); }
public void MergeSort_EmptyArray_ArgumentNullException() { Sortings.MergeSort(new int[] { }); }
public void MergeSort_Null_ArgumentNullException() { Sortings.MergeSort(null); }