public void MergeSortMethod_UnsortedArray_ReturnedSortedArray()
        {
            int[] expectedArray = { 10, 45, 66, 110 };

            int[] actArray = { 110, 66, 10, 45 };
            SortMaker <int> .MergeSort(actArray);

            CollectionAssert.AreEqual(expectedArray, actArray);
        }
        public void MergeSortMethod_UnsortedLargeArray_ReturnedSortedArray()
        {
            const int largeLength = 1000000;

            int[] expectedArray = new int[largeLength];

            expectedArray = TestHelper.GetLargeArray(largeLength);

            int[] actArray = new int[largeLength];
            Array.Copy(expectedArray, actArray, expectedArray.Length);
            Array.Sort(expectedArray);

            SortMaker <int> .MergeSort(actArray);

            CollectionAssert.AreEqual(expectedArray, actArray);
        }
Esempio n. 3
0
 public void QuickSortMethod_ArrayLengthEqualsNull_ThrowArgumentNullException()
 => SortMaker <int> .QuickSort(new int[] { });
        public void MergeSortMethod_ArrayLengthEqualsNull_ThrowArgumentNullException()
        {
            int[] array = new int[] { };

            Assert.Throws <ArgumentException>(() => SortMaker <int> .MergeSort(array));
        }
Esempio n. 5
0
 public void QuickSortMethod_QuickSortWithNull_ThrowArgumentNullException()
 => SortMaker <int> .QuickSort(null);