예제 #1
0
        public void DecreaseAmountBubbleSortIComparerTests()
        {
            for (int j = 0; j < CountRepeat; j++)
            {
                var array = SorterTestsHelper.GenerateArray(Guid.NewGuid().GetHashCode());

                ArraySorter.BubbleSort(array, ComparatorFactory.GetAmountComparisonDelegate(false));

                Assert.IsTrue(SorterTestsHelper.IsTrustOrder(array, arr => arr.Sum(), (a, b) => a < b));
            }
        }
예제 #2
0
        public void DecreaseMaxItemBubbleSortTests()
        {
            for (int j = 0; j < CountRepeat; j++)
            {
                var array = SorterTestsHelper.GenerateArray(Guid.NewGuid().GetHashCode());

                ArraySorter.BubbleSort(array, ComparatorFactory.GetMaxItemComparer(false));

                Assert.IsTrue(SorterTestsHelper.IsTrustOrder(array, arr => arr.Max(), (a, b) => a < b));
            }
        }
예제 #3
0
        public void IncreaseMinItemBubbleIComparerSortTests()
        {
            for (int j = 0; j < CountRepeat; j++)
            {
                var array = SorterTestsHelper.GenerateArray(Guid.NewGuid().GetHashCode());

                ArraySorter.BubbleSort(array, ComparatorFactory.GetMinItemComparisonDelegate(true));

                Assert.IsTrue(SorterTestsHelper.IsTrustOrder(array, arr => arr.Min(), (a, b) => a > b));
            }
        }