mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 16:19:37 +00:00
60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
---
|
|
sidebar_label: Команды качества (test, fmt)
|
|
---
|
|
|
|
# Команды качества
|
|
|
|
## `dcr test`
|
|
|
|
Запускает тесты.
|
|
|
|
```bash
|
|
dcr test # debug профиль
|
|
dcr test --release # release профиль
|
|
dcr test --debug # явно debug
|
|
```
|
|
|
|
Перед первым запуском нужно инициализировать тесты:
|
|
|
|
```bash
|
|
dcr test --init
|
|
```
|
|
|
|
Это создаёт `tests/dcr_test.h` (фреймворк) и `tests/test.c` (шаблон).
|
|
|
|
Что делает `dcr test`:
|
|
|
|
1. Builds the project
|
|
2. Collects `tests/*.c` files (`.c` only, not `.cpp`)
|
|
3. Compiles and links each test file
|
|
4. Runs each test binary
|
|
5. Prints summary: TOTAL, PASS, SKIP, FAIL
|
|
6. Возвращает ненулевой код при наличии FAIL
|
|
|
|
## `dcr fmt`
|
|
|
|
Форматирует исходный код C/C++ через `clang-format`.
|
|
|
|
```bash
|
|
dcr fmt
|
|
```
|
|
|
|
Processes: `src/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}` and `tests/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}`.
|
|
|
|
Используется файл `.clang-format` в корне проекта (если есть), иначе дефолтный стиль DCR.
|
|
|
|
## `dcr lint`
|
|
|
|
Runs `clang-tidy` on C/C++ source files for static analysis.
|
|
|
|
```bash
|
|
dcr lint # show diagnostics
|
|
dcr lint --fix # apply fixes automatically
|
|
dcr lint --help # detailed help
|
|
```
|
|
|
|
Processes: `src/**/*.{c,cpp,cxx,cc}` and `tests/**/*.{c,cpp,cxx,cc}`.
|
|
|
|
Without `--fix`, clang-tidy reports warnings and errors without modifying files.
|
|
With `--fix`, clang-tidy applies automatic suggestions in place.
|