public void RunTests()
        {
            main.SetProgressBar();
            while (test_ordinal < n_rep && !main.backgroundWorker.CancellationPending)
            {
                CreateArray();

                if (algorithms[0] && !main.backgroundWorker.CancellationPending)
                {
                    array_copy = (int[])array.Clone();
                    swatch.Reset();
                    swatch.Start();
                    comparisonCounterBubble[test_ordinal] = Algorithms.BubbleSort(array_copy, array_size[test_ordinal]);
                    swatch.Stop();
                    timeBubble[test_ordinal] = swatch.Elapsed.TotalSeconds;
                    main.graphForm.DisplayDataToGraph("Bubble", test_ordinal, timeBubble[test_ordinal], array_size[test_ordinal], comparisonCounterBubble[test_ordinal]);
                    main.testProgress.PerformStep();
                    Thread.Sleep(100);
                }
                if (algorithms[1] && !main.backgroundWorker.CancellationPending)
                {
                    array_copy = (int[])array.Clone();
                    swatch.Reset();
                    swatch.Start();
                    comparisonCounterHeap[test_ordinal] = Algorithms.HeapSort(array_copy, array_size[test_ordinal]);
                    swatch.Stop();
                    timeHeap[test_ordinal] = swatch.Elapsed.TotalSeconds;
                    main.graphForm.DisplayDataToGraph("Heap", test_ordinal, timeHeap[test_ordinal], array_size[test_ordinal], comparisonCounterHeap[test_ordinal]);
                    main.testProgress.PerformStep();
                    Thread.Sleep(100);
                }
                if (algorithms[2] && !main.backgroundWorker.CancellationPending)
                {
                    array_copy = (int[])array.Clone();
                    swatch.Reset();
                    swatch.Start();
                    comparisonCounterInsertion[test_ordinal] = Algorithms.InsertionSort(array_copy, array_size[test_ordinal]);
                    swatch.Stop();
                    timeInsertion[test_ordinal] = swatch.Elapsed.TotalSeconds;
                    main.graphForm.DisplayDataToGraph("Insertion", test_ordinal, timeInsertion[test_ordinal], array_size[test_ordinal], comparisonCounterInsertion[test_ordinal]);
                    main.testProgress.PerformStep();
                    Thread.Sleep(100);
                }
                if (algorithms[3] && !main.backgroundWorker.CancellationPending)
                {
                    array_copy = (int[])array.Clone();
                    swatch.Reset();
                    swatch.Start();
                    comparisonCounterMerge[test_ordinal] = Algorithms.MergeSort(array_copy, 0, array_size[test_ordinal] - 1);
                    swatch.Stop();
                    timeMerge[test_ordinal] = swatch.Elapsed.TotalSeconds;
                    main.graphForm.DisplayDataToGraph("Merge", test_ordinal, timeMerge[test_ordinal], array_size[test_ordinal], comparisonCounterMerge[test_ordinal]);
                    main.testProgress.PerformStep();
                    Thread.Sleep(100);
                }
                if (algorithms[4] && !main.backgroundWorker.CancellationPending)
                {
                    array_copy = (int[])array.Clone();
                    swatch.Reset();
                    swatch.Start();
                    comparisonCounterQuick[test_ordinal] = Algorithms.QuickSort(array_copy, 0, array_size[test_ordinal] - 1);
                    swatch.Stop();
                    timeQuick[test_ordinal] = swatch.Elapsed.TotalSeconds;
                    main.graphForm.DisplayDataToGraph("Quick", test_ordinal, timeQuick[test_ordinal], array_size[test_ordinal], comparisonCounterQuick[test_ordinal]);
                    main.testProgress.PerformStep();
                    Thread.Sleep(100);
                }
                if (algorithms[5] && !main.backgroundWorker.CancellationPending)
                {
                    array_copy = (int[])array.Clone();
                    swatch.Reset();
                    swatch.Start();
                    comparisonCounterSelection[test_ordinal] = Algorithms.SelectionSort(array_copy, array_size[test_ordinal]);
                    swatch.Stop();
                    timeSelection[test_ordinal] = swatch.Elapsed.TotalSeconds;
                    main.graphForm.DisplayDataToGraph("Selection", test_ordinal, timeSelection[test_ordinal], array_size[test_ordinal], comparisonCounterSelection[test_ordinal]);
                    main.testProgress.PerformStep();
                    Thread.Sleep(100);
                }
                test_ordinal++;
                main.chartSeriesOrdinal++;
                if (main.backgroundWorker.CancellationPending)
                {
                    main.testProgress.Value         = main.testProgress.Maximum;
                    main.btnStopTesting.Enabled     = false;
                    main.btnSaveTestResults.Enabled = false;
                    complete = false;
                    main.swatch.Stop();
                    main.timer.Stop();
                    ShowCancelledMessage();
                    break;
                }
            }
        }