Пример #1
0
 public void TestSortByLengthDecrease()
 {
     int[][] a = new int[3][];
     a[0] = new int[] { 20, 6, 12, -5, 7 };
     a[1] = new int[] { 1, 2, 9 };
     a[2] = new int[] { 2, 11, 0, -4 };
     int[][] b = new int[3][];
     b[0] = new int[] { 1, 2, 9 };
     b[1] = new int[] { 2, 11, 0, -4 };
     b[2] = new int[] { 20, 6, 12, -5, 7 };
     MethodsSortArray.Sort(a, new MethodsSortArray.ComparisonArray((x, y) => y.Length.CompareTo(x.Length)));
     Assert.ReferenceEquals(a, b);
 }
Пример #2
0
 public void TestSortByMaxElemDecrease()
 {
     int[][] a = new int[3][];
     a[0] = new int[] { 20, 6, 12, -5, 7 };
     a[1] = new int[] { 1, 2, 9 };
     a[2] = new int[] { 2, 11, 0, -4 };
     int[][] b = new int[3][];
     b[2] = new int[] { 1, 2, 9 };
     b[1] = new int[] { 2, 11, 0, -4 };
     b[0] = new int[] { 20, 6, 12, -5, 7 };
     MethodsSortArray.Sort(a, new MethodsSortArray.ComparisonArray(
                               (x, y) => Math.Abs(y.Max()).CompareTo(Math.Abs(x.Max()))));
     Assert.ReferenceEquals(a, b);
 }