Exemple #1
0
        public override async Task ComparisonTestAsync()
        {
            var data = await GetDuplicateDataAsync();

            ShellSortOeisA003462.Sort(data, (x, y) => x.CompareTo(y));
            CollectionAssert.AreEqual(data, DataAscendingOrdered);
        }
Exemple #2
0
        public override async Task AscendingTestAsync()
        {
            var data = await GetDuplicateDataAsync();

            ShellSortOeisA003462.Sort(data);
            CollectionAssert.AreEqual(data, DataAscendingOrdered);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            var rand         = new Random();
            var originalData = new int[DataLength];

            for (var i = 0; i < originalData.Length; originalData[i++] = rand.Next())
            {
                ;
            }
            var sortedData = originalData.OrderBy(q => q).ToArray();

            for (var i = 0; i < TestLoop; ++i)
            {
                SortTest((data) => Array.Sort(data), originalData, sortedData);
                SortTest((data) => ExchangeSort.Sort(data), originalData, sortedData);
                SortTest((data) => InsertionSort.Sort(data), originalData, sortedData);
                SortTest((data) => ShellSort.Sort(data), originalData, sortedData);
                SortTest((data) => ShellSortOeisA003462.Sort(data), originalData, sortedData);
                SortTest((data) => ShellSortParallel.Sort(data), originalData, sortedData);
                SortTest((data) => ShellSortOeisA003462Parallel.Sort(data), originalData, sortedData);
                Console.WriteLine();
            }
        }