예제 #1
0
        public void TestMassive1000El()
        {
            var rnd   = new Random(42);
            var array = new int[1000];

            for (var i = 0; i < array.Length; i++)
            {
                array[i] = rnd.Next(-100, 100);
            }
            QuickSorting.QuickSort(array);
            for (var i = 0; i < 10; i++)
            {
                var j = rnd.Next(0, array.Length - 2);
                var k = rnd.Next(0, array.Length - 1);
                if (k >= j)
                {
                    Assert.GreaterOrEqual(array[k], array[j]);
                }
                else
                {
                    Assert.GreaterOrEqual(array[j], array[k]);
                }
            }
            SortingGuardian(array);
        }
예제 #2
0
        public void TestMassive3El()
        {
            var array = new int[] { 3, 2, 1 };

            QuickSorting.QuickSort(array);
            SortingGuardian(array);
        }
예제 #3
0
        public void TestMassiveOver1000El()
        {
            var rnd   = new Random(42);
            var array = new int[300000000];

            for (var i = 0; i < array.Length; i++)
            {
                array[i] = rnd.Next(int.MinValue, int.MaxValue);
            }
            QuickSorting.QuickSort(array);
            SortingGuardian(array);
        }
예제 #4
0
        public void TestMassive100El()
        {
            var rnd   = new Random(42);
            var array = new int[100];

            for (var i = 0; i < array.Length - 1; i++)
            {
                array[i] = rnd.Next(-100, 100);
            }
            QuickSorting.QuickSort(array);
            SortingGuardian(array);
        }
예제 #5
0
 public void TestMassive0El()
 {
     QuickSorting.QuickSort(new int[0]);
 }