예제 #1
0
        public void BubbleSortInterface_SortSummElementDescendArray_Apected_OverflowException()
        {
            Random random    = new Random();
            int    lengthRow = 100;

            int[][] inputArray = new int[lengthRow][];

            for (int i = 0; i < lengthRow; ++i)
            {
                var lengthColumn = random.Next(100000, 1000000);

                inputArray[i] = new int[lengthColumn];

                if (lengthColumn != 0)
                {
                    for (int j = 0; j < lengthColumn; ++j)
                    {
                        inputArray[i][j] = random.Next(-100, 100000);
                    }
                }
            }
            var comparer = new SortSummElementDescendArray();

            Assert.Throws <OverflowException>(() => BubbleSortAcrossInterface.BubbleSortInterface(inputArray, comparer));
        }
예제 #2
0
        public void BubbleSortInterface_SortSummElementDescendArray_Axpected_ArgumentNullException()
        {
            int[][] inputArray = null;

            var comparer = new SortSummElementDescendArray();

            Assert.Throws <ArgumentNullException>(() => BubbleSortAcrossInterface.BubbleSortInterface(inputArray, comparer));
        }
예제 #3
0
        public void BubbleSortInterface_SortSummElementDescendArray_With_Valid_Data()
        {
            var inputArray = HelperSort.GetJaggedArray();

            var comparer = new SortSummElementDescendArray();

            BubbleSortAcrossInterface.BubbleSortInterface(inputArray, comparer);

            var outputSummRowArray = HelperSort.SortSummDescendHelper(inputArray).Item2;

            Assert.IsTrue(HelperSort.SortSummDescendHelper(inputArray).Item1);
        }