Hw1 - #1
Open
Elderly-AI wants to merge 9 commits into
Open
Hw1#1Elderly-AI wants to merge 9 commits into
Elderly-AI wants to merge 9 commits into
Conversation
leshiy1295
requested changes
Oct 13, 2019
|
|
||
| branches: | ||
| only: | ||
| - gh-pages |
| - source ci/travis/install-$TRAVIS_OS_NAME | ||
|
|
||
| script: | ||
| - g++ -g -Wall -Wextra test1.c -o test1 |
Collaborator
There was a problem hiding this comment.
почему для .c программы используется g++?
|
|
||
| script: | ||
| - g++ -g -Wall -Wextra test1.c -o test1 | ||
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./test1 ; fi |
Collaborator
There was a problem hiding this comment.
можно было вынести всё в отдельный скрипт по аналогии с install...
чтобы не дублировать постоянно if..
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then g++ -g -o0 -coverage -Wall -Wextra -Werror test1.c -o test1 ; fi | ||
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./test1 ; fi | ||
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then uname -a ; fi | ||
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then g++ --version ; fi |
Collaborator
There was a problem hiding this comment.
смысл выводить версии после проверок?
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cppcheck --error-exitcode=1 --enable=warning,performance,information,style *.c *.h ; fi | ||
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget -q https://github.com/catchorg/Catch2/releases/download/v2.2.3/catch.hpp ; fi | ||
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then g++ -g -o0 -coverage -Wall -Wextra -Werror test1.c -o test1 ; fi | ||
| - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./test1 ; fi |
Collaborator
There was a problem hiding this comment.
зачем изначально запускался valgrind не на тестах?
|
|
||
| void test(){ | ||
|
|
||
| size_t animals_count = 1000; //Random Generated Test |
Collaborator
There was a problem hiding this comment.
тесты не должны быть случайными
- должна была быть возможность вводить числа с stdin, а тесты - это отдельная программа или она же, но запускаемая через специальные аргументы
|
|
||
| size_t animals_count = 1000; //Random Generated Test | ||
|
|
||
| size_t types_count = 21; |
| size_t animals_count = 1000; //Random Generated Test | ||
|
|
||
| size_t types_count = 21; | ||
| char types[21][10] = {"dog", "cat", "fish", "goat", "kid", |
Collaborator
There was a problem hiding this comment.
types_count...
- так память сейчас выделяется неэффективно
|
|
||
| insert_sort(animals_array, animals_count, my_custom_sort_function); | ||
|
|
||
| show(animals_array, animals_count); |
Collaborator
There was a problem hiding this comment.
это не автотест, так как нет проверки корректности вывода
| char names[12][8] = {"Caval", "Diamond", "Rogue", "Nelson", "Prim", | ||
| "Rufus", "Polly", "Dicky", "Jack", "Rapid", "Freed", "Jeremy"}; | ||
|
|
||
| Animal *animals_array = (Animal*) malloc (sizeof(Animal) * animals_count); |
Collaborator
There was a problem hiding this comment.
что если malloc вернёт ошибку?
leshiy1295
reviewed
Oct 13, 2019
| free(animals_array); | ||
| } | ||
|
|
||
| int main(){ |
Collaborator
There was a problem hiding this comment.
- структура программы должна иметь следующий вид:
- интерфейс - прототипы функций
- main, который не содержит логики, а просто вызывает функцию ввода/инициализации, обработки и вывода
- реализация интерфейса - определение функций
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
V 1.0