Exemplo n.º 1
0
        private static bool Test(string testname, ISortingAlgorithm sort, int[] arr1)
        {
            int[] _sort()
            {
                return(sort.Sort(arr1));
            }

            CallSort <int> delSort = new CallSort <int>(_sort);

            return(Test(testname, delSort, arr1));
        }
Exemplo n.º 2
0
        private static bool Test <T>(string testname, CallSort <T> delSort, T[] arr1)
        {
            Console.WriteLine(testname);
            Console.WriteLine("Input:");
            Util.PrintArray(arr1);
            arr1 = delSort.Invoke();
            Console.WriteLine("Result:");
            Util.PrintArray(arr1);
            //bool isSuccess = Util.DoArraysMatch(arr1, arr2);
            bool isSuccess = isSorted(arr1);

            if (isSuccess)
            {
                Console.WriteLine(testname + " Passed");
            }
            else
            {
                Console.WriteLine(testname + " Failed");
            }
            return(isSuccess);
        }