Ejemplo n.º 1
0
        public void BubbleSortInterface_SortSummElementAscendArray_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 SortSummElementAscendArray();

            Assert.Throws <OverflowException>(() => BubbleSortAcrossInterface.BubbleSortInterface(inputArray, comparer));
        }
Ejemplo n.º 2
0
        public void BubbleSortInterface_SortSummElementAscendArray_Axpected_ArgumentNullException()
        {
            int[][] inputArray = null;

            var comparer = new SortSummElementAscendArray();

            Assert.Throws <ArgumentNullException>(() => BubbleSortAcrossInterface.BubbleSortInterface(inputArray, comparer));
        }
Ejemplo n.º 3
0
        public void BubbleSortInterface_SortSummElementAscendArray_With_Valid_Data()
        {
            var inputArray = HelperSort.GetJaggedArray();

            var comparer = new SortSummElementAscendArray();

            BubbleSortAcrossInterface.BubbleSortInterface(inputArray, comparer);

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

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