public void EdgeCaseTest() { // 1x1 var input = MatrixHelpers.CreateTwoDimensionalMatrix(1); var expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(1); ValidateResult(input, expectedResult); }
public void BasicTest() { // 2x2 var input = MatrixHelpers.CreateTwoDimensionalMatrix(1, 2, 3, 4); var expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(3, 1, 4, 2); ValidateResult(input, expectedResult); // 3x3 input = MatrixHelpers.CreateTwoDimensionalMatrix(1, 2, 3, 4, 5, 6, 7, 8, 9); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(7, 4, 1, 8, 5, 2, 9, 6, 3); ValidateResult(input, expectedResult); // 4x4 input = MatrixHelpers.CreateTwoDimensionalMatrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(13, 9, 5, 1, 14, 10, 6, 2, 15, 11, 7, 3, 16, 12, 8, 4); ValidateResult(input, expectedResult); // 5x5 input = MatrixHelpers.CreateTwoDimensionalMatrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(21, 16, 11, 6, 1, 22, 17, 12, 7, 2, 23, 18, 13, 8, 3, 24, 19, 14, 9, 4, 25, 20, 15, 10, 5); ValidateResult(input, expectedResult); }
public void BasicTest() { // All ones // 1 1 1 1 1 1 // 1 1 1 -> 1 1 1 // 1 1 1 1 1 1 var input = MatrixHelpers.CreateTwoDimensionalMatrix(1, 1, 1, 1, 1, 1, 1, 1, 1); var expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(1, 1, 1, 1, 1, 1, 1, 1, 1); ValidateResult(input, expectedResult); // All zeros // 0 0 0 0 0 0 // 0 0 0 -> 0 0 0 // 0 0 0 0 0 0 input = MatrixHelpers.CreateTwoDimensionalMatrix(0, 0, 0, 0, 0, 0, 0, 0, 0); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(0, 0, 0, 0, 0, 0, 0, 0, 0); ValidateResult(input, expectedResult); // Forward slash // 1 1 0 0 0 0 // 1 0 1 -> 0 0 0 // 0 1 1 0 0 0 input = MatrixHelpers.CreateTwoDimensionalMatrix(1, 1, 0, 1, 0, 1, 0, 1, 1); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(0, 0, 0, 0, 0, 0, 0, 0, 0); ValidateResult(input, expectedResult); // Backward slash // 0 1 1 0 0 0 // 1 0 1 -> 0 0 0 // 1 1 0 0 0 0 input = MatrixHelpers.CreateTwoDimensionalMatrix(0, 1, 1, 1, 0, 1, 1, 1, 0); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(0, 0, 0, 0, 0, 0, 0, 0, 0); ValidateResult(input, expectedResult); // One zero // 0 1 1 0 0 0 // 1 1 1 -> 0 1 1 // 1 1 1 0 1 1 input = MatrixHelpers.CreateTwoDimensionalMatrix(0, 1, 1, 1, 1, 1, 1, 1, 1); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(0, 0, 0, 0, 1, 1, 0, 1, 1); ValidateResult(input, expectedResult); // Corners // 0 1 1 0 0 0 // 1 1 1 -> 0 1 0 // 1 1 0 0 0 0 input = MatrixHelpers.CreateTwoDimensionalMatrix(0, 1, 1, 1, 1, 1, 1, 1, 0); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(0, 0, 0, 0, 1, 0, 0, 0, 0); ValidateResult(input, expectedResult); // Center // 1 1 1 1 0 1 // 1 0 1 -> 0 0 0 // 1 1 1 1 0 1 input = MatrixHelpers.CreateTwoDimensionalMatrix(1, 1, 1, 1, 0, 1, 1, 1, 1); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(1, 0, 1, 0, 0, 0, 1, 0, 1); ValidateResult(input, expectedResult); // Random // 1 0 1 0 0 0 // 1 1 1 -> 1 0 1 // 1 1 1 1 0 1 input = MatrixHelpers.CreateTwoDimensionalMatrix(1, 0, 1, 1, 1, 1, 1, 1, 1); expectedResult = MatrixHelpers.CreateTwoDimensionalMatrix(0, 0, 0, 1, 0, 1, 1, 0, 1); ValidateResult(input, expectedResult); }