Skip to content

Tests sorted list - #17

Open
EStarikov wants to merge 8 commits into
mainfrom
tests_sorted_list
Open

Tests sorted list#17
EStarikov wants to merge 8 commits into
mainfrom
tests_sorted_list

Conversation

@EStarikov

Copy link
Copy Markdown
Owner

No description provided.

@EStarikov
EStarikov requested a review from chernishev November 24, 2025 22:20
Comment thread src/sortedlist.c Outdated
Comment on lines +6 to +8
#ifdef TESTS
#include "tests.h"
#endif

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Сортированный список -- это по сути библиотека, и он не должен включать свои тесты. В Вашем случае надо вынести main в отдельный файл.

И в CMake это будет выглядеть так же: два add_library и один add_executable. Кстати, где CMake?

Comment thread src/sortedlist.c Outdated
Comment on lines +9 to +12




Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Сомневаюсь, что по стайлгайду здесь должна быть такая дыра.

Comment thread src/sortedlist.c Outdated
Comment on lines +61 to +62
}
void destroy(List* l) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

А вот здесь как раз должен быть отступ.

Comment thread src/sortedlist.c Outdated
int main(int argc, char* argv[]) {
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--test") == 0) {
#ifdef TESTS

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Довольно устаревший подход с макросами. С CMake всё можно сделать гораздо проще.

Comment thread src/sortedlist.h

void deleting(List* l, int a);

void destroy(List* l); No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FYI: Возможно я это уже Вам говорил, но объекты уничтожают (destruct), а не разрушают (destroy).

Comment thread src/tests.c
Comment on lines +59 to +61
emptyList();
sortedList();
deletingList();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Как-то мало тестов для задачи на 4 балла. Как минимум, ещё надо проверить, что все функции работают на пустом списке и на списке с дубликатами.

@p-senichenkov p-senichenkov left a comment

Copy link
Copy Markdown
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.

2 participants