Update from 22
This commit is contained in:
parent
b2a8856b19
commit
1733a44582
3 changed files with 36 additions and 2 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
# Instructions for running tests
|
# Instructions for running tests
|
||||||
|
|
||||||
In addition to testing for correct output data, the autotest system will check your program and its source code for the
|
In addition to testing for correct output, the automated testing system will
|
||||||
following points:
|
check your program and its source code. To successfully pass the test, you must
|
||||||
|
make sure that your program meets the requirements below. To do this,
|
||||||
|
run the commands below locally and make sure that they do not output any errors.
|
||||||
|
|
||||||
* **Style tests.** To check how much the beauty of your code meets the standards, for example, you can test your code
|
* **Style tests.** To check how much the beauty of your code meets the standards, for example, you can test your code
|
||||||
using the _clang-format_ utility. The ```materials/linters``` folder contains the ```.clang-format``` file, which
|
using the _clang-format_ utility. The ```materials/linters``` folder contains the ```.clang-format``` file, which
|
||||||
|
|
@ -23,6 +25,22 @@ following points:
|
||||||
|
|
||||||
Google Style: https://google.github.io/styleguide/cppguide.html
|
Google Style: https://google.github.io/styleguide/cppguide.html
|
||||||
|
|
||||||
|
* **Static code analysis.** Sometimes (or not quite sometimes) it happens that
|
||||||
|
a correctly compiled C program runs completely incorrectly or terminates
|
||||||
|
with an error trying to access the wrong memory area. To prevent this from happening
|
||||||
|
errors at the stage of writing the program, use special utilities that analyze
|
||||||
|
check your source code for potential errors. Our autotest system uses
|
||||||
|
```cppcheck``` for this.
|
||||||
|
|
||||||
|
You can test your source code: \
|
||||||
|
```cppcheck --enable=all --std=c11 --check-level=exhaustive --disable=information --suppress=missingIncludeSystem --suppress=missingInclude --suppress=checkersReport src/soursefile_name.c```
|
||||||
|
You can also check all the source code files in the directory at once:
|
||||||
|
```cppcheck --enable=all --std=c11 --check-level=exhaustive --disable=information --suppress=missingIncludeSystem --suppress=missingInclude --suppress=checkersReport src```
|
||||||
|
|
||||||
|
Required version of cppcheck: \
|
||||||
|
**Mac** 2.13 \
|
||||||
|
**Linux** 2.13
|
||||||
|
|
||||||
|
|
||||||
* **Test for correct operation with memory.** When writing C programs, it is very important to watch for memory leaks.
|
* **Test for correct operation with memory.** When writing C programs, it is very important to watch for memory leaks.
|
||||||
To do this the _valgrind_ utility is quite often used in Unix-like operating systems. However, OS X has some troubles
|
To do this the _valgrind_ utility is quite often used in Unix-like operating systems. However, OS X has some troubles
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,22 @@
|
||||||
|
|
||||||
Google Style: https://google.github.io/styleguide/cppguide.html
|
Google Style: https://google.github.io/styleguide/cppguide.html
|
||||||
|
|
||||||
|
* **Статический анализ кода.** Иногда (или не совсем иногда) встречается такое, что
|
||||||
|
корректно компилирующаяся C-программа работает совершенно неправильно или завершается
|
||||||
|
с ошибкой попытки доступа не к своей области памяти. Чтобы предотвратить подобные
|
||||||
|
ошибки на этапе написания программы, используют специальные утилиты, которые анализируют
|
||||||
|
ваш исходный код на предмет потенциальных ошибок. Наша система автотестов использует
|
||||||
|
для этого ```cppcheck```.
|
||||||
|
|
||||||
|
Вы можете протестировать ваш исходный код: \
|
||||||
|
```cppcheck --enable=all --std=c11 --check-level=exhaustive --disable=information --suppress=missingIncludeSystem --suppress=missingInclude --suppress=checkersReport src/soursefile_name.c```
|
||||||
|
Также можно проверить сразу все файлы с исходным кодом в директории: \
|
||||||
|
```cppcheck --enable=all --std=c11 --check-level=exhaustive --disable=information --suppress=missingIncludeSystem --suppress=missingInclude --suppress=checkersReport src```
|
||||||
|
|
||||||
|
Необходимая версия cppcheck: \
|
||||||
|
**Mac** 2.13 \
|
||||||
|
**Linux** 2.13
|
||||||
|
|
||||||
|
|
||||||
* **Тест на корректную работу с памятью.** При написании C-программ очень важно следить за утечками памяти. Для этого в Unix-подобных операционных системах довольно часто используют утилиту _valgrind_. Однако на OS X имеются проблемы с поддержкой _valgrind_, поэтому вместо нее можно использовать утилиту _leaks_. Вдаваться в механизм работы этих утилит
|
* **Тест на корректную работу с памятью.** При написании C-программ очень важно следить за утечками памяти. Для этого в Unix-подобных операционных системах довольно часто используют утилиту _valgrind_. Однако на OS X имеются проблемы с поддержкой _valgrind_, поэтому вместо нее можно использовать утилиту _leaks_. Вдаваться в механизм работы этих утилит
|
||||||
мы сейчас не будем — если интересно, можешь почитать в гугле.
|
мы сейчас не будем — если интересно, можешь почитать в гугле.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue