/
dcr_labs
/
dcr
Обзор
Документация
Войти
/
dcr_labs
/
dcr
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
docs/testing/test-framework.mdx
68 строк
947 B
Dexoron
docs: rewrite documentation.
01 июн 2026, 20:04
01 июн 2026, 20:04
c42575e
Код
Авторство
О чём код?
--- sidebar_label: Test framework (EXPECT, TEST, ...) --- # Test Framework DCR has a built-in minimal test framework for C. ## Macros ### `EXPECT(expr)` Asserts that an expression is true. ```c EXPECT(1 + 1 == 2); EXPECT(ptr != NULL); ``` ### `SKIP(reason)` Skips a test with a message. ```c SKIP("not implemented on Windows"); ``` ### `TEST(name)` Defines a test. ```c TEST(addition) { EXPECT(1 + 1 == 2); EXPECT(2 + 2 == 4); } ``` ### `TEST_CASE(name)` Registers a test case. ```c TEST_CASE(math) { EXPECT(1 + 1 == 2); } ``` ## Initialization ```bash dcr test --init ``` Creates: - `tests/dcr_test.h` — framework header (do not edit) - `tests/test.c` — template with example test ## Structure ``` tests/ ├── dcr_test.h # framework (do not edit) ├── test.c # main tests └── ... # additional .c test files ``` Only `.c` files are compiled (`.cpp` is not supported).