Skip to content

Conversation

@DmKazakov
Copy link
Owner

No description provided.

Copy link
Collaborator

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Всё ок, но плохо с некорректным вводом --- надо больше тестов и адекватную реакцию на плохие случаи


for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data.length; j++) {
matrix[i][j] = data[j][i];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это хорошо, если в data лежат данные в правильном формате. Для public-методов public-классов на это никогда не следует рассчитывать

int[][] matrix = new int[][]{{3, 1, 5},
{54, 43, 32},
{21, 53, 76}};
SpiralMatrix spiral = new SpiralMatrix(matrix);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сама переменная не нужна, вызвали конструктор и забыли

}

@Test
public void testPrintMatrix15x5() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15x5?


assertEquals("3", outContent.toString().trim());
}
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хочется ещё тесты на корректное поведение на некорректном вводе. null-ы, неквадратные матрицы, матрицы с чётными длинами массивов, "рваные" матрицы

Copy link
Collaborator

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Окей, зачтена

@@ -0,0 +1,4 @@
package ru.spbau.mit.kazakov.SpiralMatrix;

public class EvenDimensionException extends Exception {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

К исключениям тоже нужны комментарии, например, в каких ситуациях бросается

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants