Exemplo n.º 1
0
        public void JaggedArraySortByMaxElementsInRowsNullTest()
        {
            int[][]     data        = null;
            JaggedArray jaggedArray = new JaggedArray(data);

            Assert.Throws <ArgumentNullException>(() => jaggedArray.SortRowsByMaxElementsInRows(true));
        }
Exemplo n.º 2
0
        public void JaggedArraySortByMaxElementsInRowsTest5()
        {
            int[][]     data = { new int[7] {
                                     4, 5, 6, -13, -22, 33, -17
                                 },
                                 new int[7]     {
                                     4, 5, 6, -13, -22, 33, -17
                                 },
                                 new int[7]     {
                                     4, 5, 6, -13, -22, 33, -17
                                 } };
            JaggedArray jaggedArray = new JaggedArray(data);

            int[][] expected = { new int[7] {
                                     4, 5, 6, -13, -22, 33, -17
                                 },
                                 new int[7] {
                                     4, 5, 6, -13, -22, 33, -17
                                 },
                                 new int[7] {
                                     4, 5, 6, -13, -22, 33, -17
                                 } };
            int[][] actual = jaggedArray.SortRowsByMaxElementsInRows(true);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void JaggedArraySortByMaxElementsInRowsTest2()
        {
            int[][]     data = { new int[4] {
                                     4, 5, 6, 11
                                 },
                                 new int[2]     {
                                     7, 9
                                 },
                                 new int[3]     {
                                     1, 2, 6
                                 } };
            JaggedArray jaggedArray = new JaggedArray(data);

            int[][] expected = { new int[4] {
                                     4, 5, 6, 11
                                 },
                                 new int[2] {
                                     7, 9
                                 },
                                 new int[3] {
                                     1, 2, 6
                                 } };
            int[][] actual = jaggedArray.SortRowsByMaxElementsInRows(false);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void JaggedArraySortByMaxElementsInRowsRowNullTest()
        {
            int[][]     data = { null,
                                 new int[1] {
                                     17
                                 },
                                 new int[3] {
                                     19, 22, 33
                                 } };
            JaggedArray jaggedArray = new JaggedArray(data);

            Assert.Throws <ArgumentNullException>(() => jaggedArray.SortRowsByMaxElementsInRows(false));
        }
Exemplo n.º 5
0
        public void JaggedArraySortByMaxElementsInRowsTest4()
        {
            int[][]     data = { new int[6] {
                                     4, 5, 6, 11, 18, -11
                                 },
                                 new int[5]     {
                                     7, 9, 0, 5, 1
                                 },
                                 new int[6]     {
                                     1, 2, 6, 1, -1, 3
                                 },
                                 new int[1]     {
                                     5
                                 },
                                 new int[2]     {
                                     -19, 22
                                 },
                                 new int[4]     {
                                     100, 100, -150, 88
                                 } };
            JaggedArray jaggedArray = new JaggedArray(data);

            int[][] expected = { new int[4] {
                                     100, 100, -150, 88
                                 },
                                 new int[2] {
                                     -19, 22
                                 },
                                 new int[6] {
                                     4, 5, 6, 11, 18, -11
                                 },
                                 new int[5] {
                                     7, 9, 0, 5, 1
                                 },
                                 new int[6] {
                                     1, 2, 6, 1, -1, 3
                                 },
                                 new int[1] {
                                     5
                                 } };
            int[][] actual = jaggedArray.SortRowsByMaxElementsInRows(false);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void JaggedArraySortByMaxElementsInRowsTest6()
        {
            int[][]     data = { new int[5] {
                                     0, 0, 0, 0, 0
                                 },
                                 new int[3]     {
                                     0, 0, 0
                                 },
                                 new int[5]     {
                                     0, 0, 0, 0, 0
                                 },
                                 new int[2]     {
                                     0, 0
                                 },
                                 new int[5]     {
                                     0, 0, 0, 0, 0
                                 } };
            JaggedArray jaggedArray = new JaggedArray(data);

            int[][] expected = { new int[5] {
                                     0, 0, 0, 0, 0
                                 },
                                 new int[3] {
                                     0, 0, 0
                                 },
                                 new int[5] {
                                     0, 0, 0, 0, 0
                                 },
                                 new int[2] {
                                     0, 0
                                 },
                                 new int[5] {
                                     0, 0, 0, 0, 0
                                 } };
            int[][] actual = jaggedArray.SortRowsByMaxElementsInRows(false);

            Assert.AreEqual(expected, actual);
        }