Beispiel #1
0
        static void Main(string[] args)
        {
            int[][] array = new int[3][];
            array[0] = new[] { 2, 6, 7, 9, 10 };
            array[1] = new[] { 7, -1, 11, 4 };
            array[2] = new[] { -2, 8, 5, 9, 13 };
            int[][] jaggetArray =
            {
                new[] {  0,  9, -4,  7, 2, 4 },
                new[] { 11, -3,  6, -7,12 },
                new[] {  4,  5,3 },
                new[] {  2,  2, -5, -6, 10 }
            };
            Console.WriteLine("Max sorting\n");
            SortJagArray.Sort(array);
            Show(array);
            Console.WriteLine("Min sorting\n");
            SortJagArray.Sort(array, SortJagArray.SortMinElem);
            Show(array);
            Console.WriteLine("Sum sorting\n");
            SortJagArray.Sort(array, SortJagArray.SortMaxSumm);
            Show(array);

            Console.WriteLine("Max sorting\n");
            SortJagArray.Sort(jaggetArray);
            Show(jaggetArray);
            Console.ReadKey();
        }
Beispiel #2
0
 public void SortingNullArray()
 {
     //Arrange
     int[][] j = { new[] { 1, 2 }, new [] { 5, 8, 0 } };
     //Act
     SortJagArray.Sort(null, SortJagArray.SortMinElem);
     SortJagArray.Sort(j, null);
     //SortJagArray.Sort(j, SortJagArray.SortMaxSumm);
     SortJagArray.Sort(null);
 }
Beispiel #3
0
 public void SortingSummElementsMethod()
 {
     //Arrange
     int[][] jaggetArray = { new[] { 0, 9, -4, 7, 2, 4 }, new[] { 11, -3, 6, -7, 12 }, new[] { 4, 5, 3 }, new[] { 2, 2, -5, -6, 10 } };
     int[][] temp        = { new[] { 11, -3, 6, -7, 12 }, new[] { 0, 9, -4, 7, 2, 4 }, new[] { 4, 5, 3 }, new[] { 2, 2, -5, -6, 10 } };
     //Act
     SortJagArray.Sort(jaggetArray, SortJagArray.SortMaxSumm);
     //Assert
     CollectionAssert.AreEquivalent(temp[0], jaggetArray[0]);
     CollectionAssert.AreEquivalent(temp[1], jaggetArray[1]);
     CollectionAssert.AreEquivalent(temp[2], jaggetArray[2]);
     CollectionAssert.AreEquivalent(temp[3], jaggetArray[3]);
 }
 public bool JaggetArraySortSummElemTest(int[][] arr, int[][] expected)
 {
     SortJagArray.Sort(arr, SortJagArray.SortMaxSumm);
     return(IsEquals(arr, expected));
 }