-
Notifications
You must be signed in to change notification settings - Fork 0
Spiral #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
yurii-litvinov
left a comment
There was a problem hiding this 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]; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сама переменная не нужна, вызвали конструктор и забыли
| } | ||
|
|
||
| @Test | ||
| public void testPrintMatrix15x5() { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хочется ещё тесты на корректное поведение на некорректном вводе. null-ы, неквадратные матрицы, матрицы с чётными длинами массивов, "рваные" матрицы
yurii-litvinov
left a comment
There was a problem hiding this 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 { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
К исключениям тоже нужны комментарии, например, в каких ситуациях бросается
No description provided.