Exemple #1
0
        public void TestLenght()
        {
            Stopwatch sw = new Stopwatch();

            for (int i = 10; i < 1000000; i *= 2)
            {
                int[] arr  = GenerateArray(i);
                int[] copy = new int[arr.Length];
                arr.CopyTo(copy, 0);
                sw.Reset();
                sw.Start();
                ParallelSorting.MergeSort(arr);
                sw.Stop();
                chartLenght.Series[0].Points.AddXY(i, sw.ElapsedMilliseconds);
                sw.Reset();
                sw.Start();
                ParallelSorting.PMergeSort(arr, 200000);
                sw.Stop();
                chartLenght.Series[1].Points.AddXY(i, sw.ElapsedMilliseconds);
                chartLenght.Update();
            }
            chartLenght.ChartAreas[0].AxisX.IsLogarithmic = true;
            chartLenght.Update();
        }
 public void TestPMergeCorrectess()
 {
     int[] arr = GenerateArr();
     ParallelSorting.PMergeSort(arr, 10000);
     Assert.IsTrue(ParallelSorting.IsSorted(arr));
 }