예제 #1
0
        public void BitwiseSortRandomInputShouldBeSorted()
        {
            const int MaxValue = 100;

            NodeElement head = BitwiseSortAlgorithm.Initialize(MaxValue);

            head = BitwiseSortAlgorithm.BitwiseSort(head);
            CheckSortOrder(head);

            Assert.Pass("Collection is sorted");
        }
예제 #2
0
        public void BitwiseSortRandomElementsSholdSortCorrectly()
        {
            const int  MaxValue   = 100;
            const int  TestsCount = 100;
            const uint BitMask    = (uint)int.MaxValue + 1;

            Element[] elements = new Element[MaxValue];
            for (int i = 0; i < TestsCount; i++)
            {
                BitwiseSortAlgorithm.Initialize(elements, MaxValue);
                BitwiseSortAlgorithm.BitwiseSort(elements, 0, MaxValue - 1, BitMask);
                CheckSortingOrder(elements);
            }
        }