コード例 #1
0
        public void SumArraySort_PositiveNumbers()
        {
            int[] first = new[] { 1, 2, 3, 10, 5 }; //21
            int[] second = new[] { 5, 4, 13, 2, 1 }; //25
            int[] third = new[] { 1, 12, 3, 4 }; // 20
            int[][] array = new[] { first, second, third };

            SumArraySort comparer = new SumArraySort();

            Sorter.Sort(array, comparer);

            int[][] result = new[] { second, first, third };
            
            Assert.IsTrue(CompareArrays(result, array));
        }
コード例 #2
0
        public void SumArraySort_MixedNumbers()
        {
            int[] first = new[] { -1, 2, 3, -10, 5 }; //-1
            int[] second = new[] { -5, 4, 13, 2, -1 }; //13
            int[] third = new[] { -1, 12, 3, -4 }; //10
            int[][] array = new[] { first, second, third };

            SumArraySort comparer = new SumArraySort();

            Sorter.Sort(array, comparer);

            int[][] result = new[] { second, third, first };

            Assert.IsTrue(CompareArrays(result, array));
        }
コード例 #3
0
        public void SumArraySort_NegativeNumbers()
        {
            int[] first = new[] { -1, -2, -3, -10, -5 }; //-21
            int[] second = new[] { -5, -4, -13, -2, -1 }; //-25
            int[] third = new[] { -1, -12, -3, -4 }; //-20
            int[][] array = new[] { first, second, third };

            SumArraySort comparer = new SumArraySort();

            Sorter.Sort(array, comparer);

            int[][] result = new[] { third, first, second };

            Assert.IsTrue(CompareArrays(result, array));
        }