Skip to content

Tests sorted list#17

Open
EStarikov wants to merge 8 commits intomainfrom
tests_sorted_list
Open

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

Conversation

@EStarikov
Copy link
Owner

No description provided.

@EStarikov EStarikov requested a review from chernishev November 24, 2025 22:20
src/sortedlist.c Outdated
Comment on lines 6 to 8
#ifdef TESTS
#include "tests.h"
#endif
Copy link
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?

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




Copy link
Collaborator

Choose a reason for hiding this comment

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

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

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

Choose a reason for hiding this comment

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

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

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
Collaborator

Choose a reason for hiding this comment

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

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


void deleting(List* l, int a);

void destroy(List* l); 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.

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

Comment on lines +59 to +61
emptyList();
sortedList();
deletingList();
Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Collaborator

@p-senichenkov p-senichenkov left a comment

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