Example #1
0
        public void Sort_PassEmptyArray_ReturnEmptyArray()
        {
            var quickSorting = new QuickSorting();
            var sortedArray  = quickSorting.Sort(_emptyArray, 0, _emptyArray.Length - 1);

            CollectionAssert.AreEqual(sortedArray, _emptyArray);
        }
Example #2
0
        public void Sort_PassOneElementArray_ReturnOneElementArray()
        {
            var quickSorting = new QuickSorting();
            var sortedArray  = quickSorting.Sort(_oneElementArray, 0, _oneElementArray.Length - 1);

            CollectionAssert.AreEqual(sortedArray, _oneElementArray);
        }
Example #3
0
        public void Sort_PassValidArray_ReturnSortedArray()
        {
            var quickSorting = new QuickSorting();
            var sortedArray  = quickSorting.Sort(_toSortArray, 0, _toSortArray.Length - 1);

            CollectionAssert.AreEqual(sortedArray, _referenceSortedArray);
        }
Example #4
0
 public static void Sort(NSJSArray s, int low, int high, Func <NSJSValue, NSJSValue, bool> max)
 {
     if (!(s.Length <= 1 || low >= high))
     {
         int middle = QuickSorting.Middle(s, low, high, max);
         QuickSorting.Sort(s, low, middle - 1, max);  // 向左向中心扩散
         QuickSorting.Sort(s, middle + 1, high, max); // 从中心向右扩散
     }
 }
Example #5
0
        public void QuickSorting_Sort()
        {
            ISorting testClass = new QuickSorting();

            testClass.Sort(SortedData);
        }