Ejemplo n.º 1
0
        public void BitwiseSortEmptyElementsShouldNotSort()
        {
            const int  MaxValue = 0;
            const uint BitMask  = (uint)int.MaxValue + 1;

            Element[] elements = new Element[MaxValue];
            BitwiseSortAlgorithm.BitwiseSort(elements, 0, MaxValue - 1, BitMask);
            CheckSortingOrder(elements);
        }
Ejemplo n.º 2
0
        public void BitwiseSortRandomInputShouldBeSorted()
        {
            const int MaxValue = 100;

            NodeElement head = BitwiseSortAlgorithm.Initialize(MaxValue);

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

            Assert.Pass("Collection is sorted");
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
 public void BitwiseSortNullElementsShouldThrowException()
 {
     BitwiseSortAlgorithm.BitwiseSort(null, 0, 0, 0);
 }
Ejemplo n.º 5
0
 public void BitwiseSortNullInputShouldThrowException()
 {
     BitwiseSortAlgorithm.BitwiseSort(null);
 }