public void Example2_Can_rotate_four_by_four_matrix() { // [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]] var input = new int[][] { new int[] { 5, 1, 9, 11 }, new int[] { 2, 4, 8, 10 }, new int[] { 13, 3, 6, 7 }, new int[] { 15, 14, 12, 16 } }; // [[15,13,2,5],[14,3,4,1],[12,6,8,9],[16,7,10,11]] var expeceted = new int[][] { new int[] { 15, 13, 2, 5 }, new int[] { 14, 3, 4, 1 }, new int[] { 12, 6, 8, 9 }, new int[] { 16, 7, 10, 11 } }; var sut = new Solution(); sut.Rotate(input); AssertTwoDemensionalArrays.AreEqual(expeceted, input); }
public void Example3_Can_rotate_1_by_1_matrix() { var input = new int[][] { new int[] { 1 }, }; var expeceted = new int[][] { new int[] { 1 }, }; var sut = new Solution(); sut.Rotate(input); AssertTwoDemensionalArrays.AreEqual(expeceted, input); }
public void Example2_Can_turn_problems_with_zeros_correctly() { var input = new int[][] { new int[] { 0, 1, 2, 0 }, new int[] { 3, 4, 5, 2 }, new int[] { 1, 3, 1, 5 } }; var expected = new int[][] { new int[] { 0, 0, 0, 0 }, new int[] { 0, 4, 5, 0 }, new int[] { 0, 3, 1, 0 } }; var sut = new Solution(); sut.SetZeroes(input); AssertTwoDemensionalArrays.AreEqual(input, expected); }
public void Example1_Can_turn_numbers_to_zeros() { var input = new int[][] { new int[] { 1, 1, 1 }, new int[] { 1, 0, 1 }, new int[] { 1, 1, 1 } }; var expected = new int[][] { new int[] { 1, 0, 1 }, new int[] { 0, 0, 0 }, new int[] { 1, 0, 1 } }; var sut = new Solution(); sut.SetZeroes(input); AssertTwoDemensionalArrays.AreEqual(input, expected); }
public void Test1_test_extremese() { //[[-4,-2147483648,6,-7,0],[-8,6,-8,-6,0],[2147483647,2,-9,-6,-10]] var input = new int[][] { new int[] { -4, -2147483648, 6, -7, 0 }, new int[] { -8, 6, -8, -6, 0 }, new int[] { 2147483647, 2, -9, -6, -10 } }; //[[0,0,0,0,0],[0,0,0,0,0],[2147483647,2,-9,-6,0]] var expected = new int[][] { new int[] { 0, 0, 0, 0, 0 }, new int[] { 0, 0, 0, 0, 0 }, new int[] { 2147483647, 2, -9, -6, 0 } }; var sut = new Solution(); sut.SetZeroes(input); AssertTwoDemensionalArrays.AreEqual(input, expected); }
public void Example4_Can_rotate_two_by_two_matrix() { // [[1,2],[3,4]] var input = new int[][] { new int[] { 1, 2 }, new int[] { 3, 4 }, }; // [[3,1],[4,2]] var expeceted = new int[][] { new int[] { 3, 1 }, new int[] { 4, 2 }, }; var sut = new Solution(); sut.Rotate(input); AssertTwoDemensionalArrays.AreEqual(expeceted, input); }
public void Example1_Can_rotate_three_by_three_matrix() { // [[1,2,3],[4,5,6],[7,8,9]] var input = new int[][] { new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 }, new int[] { 7, 8, 9 } }; // [[7,4,1],[8,5,2],[9,6,3]] var expeceted = new int[][] { new int[] { 7, 4, 1 }, new int[] { 8, 5, 2 }, new int[] { 9, 6, 3 } }; var sut = new Solution(); sut.Rotate(input); AssertTwoDemensionalArrays.AreEqual(expeceted, input); }