public void GenerateMatrix_1() { var solution = new _059_SpiralMatrix2(); var result = solution.GenerateMatrix(1); AssertHelper.AssertMatrix(new int[, ] { { 1 } }, result); }
public void GenerateMatrix_3() { var solution = new _059_SpiralMatrix2(); var result = solution.GenerateMatrix(3); AssertHelper.AssertMatrix(new int[, ] { { 1, 2, 3 }, { 8, 9, 4 }, { 7, 6, 5 } }, result); }
public void GenerateMatrix_4() { var solution = new _059_SpiralMatrix2(); var result = solution.GenerateMatrix(4); AssertHelper.AssertMatrix(new int[, ] { { 1, 2, 3, 4 }, { 12, 13, 14, 5 }, { 11, 16, 15, 6 }, { 10, 9, 8, 7 } }, result); }
public void SetZeroesTest_HasZero_TopLeft() { var input = new int[, ] { { 0, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; var solution = new _073_SetMatrixZeroes(); solution.SetZeroes(input); AssertHelper.AssertMatrix(new int[, ] { { 0, 0, 0 }, { 0, 5, 6 }, { 0, 8, 9 } }, input); }
public void SetZeroesTest_NoZero() { var input = new int[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; var solution = new _073_SetMatrixZeroes(); solution.SetZeroes(input); AssertHelper.AssertMatrix(new int[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }, input); }
public void SetZeroes_2Test_HasZero_FirstColumn() { var input = new int[, ] { { 1, 2, 3 }, { 0, 5, 6 }, { 7, 8, 9 } }; var solution = new _073_SetMatrixZeroes(); solution.SetZeroes_2(input); AssertHelper.AssertMatrix(new int[, ] { { 0, 2, 3 }, { 0, 0, 0 }, { 0, 8, 9 } }, input); }
public void SetZeroes_2Test_HasZero_Multiple() { var input = new int[, ] { { 1, 2, 3, 4 }, { 4, 0, 6, 7 }, { 7, 8, 0, 10 }, { 10, 11, 12, 13 } }; var solution = new _073_SetMatrixZeroes(); solution.SetZeroes_2(input); AssertHelper.AssertMatrix(new int[, ] { { 1, 0, 0, 4 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 10, 0, 0, 13 } }, input); }