public void JaggedArraySortByRowsSumsTest2() { 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.SortRowsByElementsSumInRows(false); Assert.AreEqual(expected, actual); }
public void JaggedArraySortByRowsSumsNullTest() { int[][] data = null; JaggedArray jaggedArray = new JaggedArray(data); Assert.Throws <ArgumentNullException>(() => jaggedArray.SortRowsByElementsSumInRows(true)); }
public void JaggedArraySortByRowsSumsTest5() { 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.SortRowsByElementsSumInRows(true); Assert.AreEqual(expected, actual); }
public void JaggedArraySortByRowsSumsRowNullTest() { int[][] data = { null, new int[1] { 17 }, new int[3] { 19, 22, 33 } }; JaggedArray jaggedArray = new JaggedArray(data); Assert.Throws <ArgumentNullException>(() => jaggedArray.SortRowsByElementsSumInRows(false)); }
public void JaggedArraySortByRowsSumsTest3() { 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[2] { -19, 22 }, new int[1] { 5 }, new int[6] { 1, 2, 6, 1, -1, 3 }, new int[5] { 7, 9, 0, 5, 1 }, new int[6] { 4, 5, 6, 11, 18, -11 }, new int[4] { 100, 100, -150, 88 } }; int[][] actual = jaggedArray.SortRowsByElementsSumInRows(true); Assert.AreEqual(expected, actual); }
public void JaggedArraySortByRowsSumsOverflowTest() { int[][] data = { new int[5] { 0, int.MaxValue, int.MaxValue, 0, 1 }, new int[5] { 0, int.MinValue, int.MinValue, 0, 0 }, new int[5] { 1, int.MaxValue, 2, 3, 0 }, new int[5] { int.MinValue, 0, -11, 0, -11 }, new int[5] { int.MaxValue, int.MinValue, int.MaxValue, int.MinValue, int.MaxValue } }; JaggedArray jaggedArray = new JaggedArray(data); Assert.Throws <OverflowException>(() => jaggedArray.SortRowsByElementsSumInRows(true)); }
public void JaggedArraySortByRowsSumsTest6() { int[][] data = { new int[5] { 0, 0, 0, 0, 0 }, new int[3] { 11, 33, -44 }, new int[5] { 0, 0, 0, 0, 0 }, new int[2] { -7, 7 }, 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] { 11, 33, -44 }, new int[5] { 0, 0, 0, 0, 0 }, new int[2] { -7, 7 }, new int[5] { 0, 0, 0, 0, 0 } }; int[][] actual = jaggedArray.SortRowsByElementsSumInRows(false); Assert.AreEqual(expected, actual); }