mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-31 06:03:29 +08:00
- agents: cpp-build-resolver, cpp-reviewer - commands: cpp-build, cpp-review, cpp-test - rules: cpp/ (coding-style, hooks, patterns, security, testing) - tests: 9 new hook test files with comprehensive coverage Cherry-picked from PR #436.
45 lines
843 B
Markdown
45 lines
843 B
Markdown
---
|
|
paths:
|
|
- "**/*.cpp"
|
|
- "**/*.hpp"
|
|
- "**/*.cc"
|
|
- "**/*.hh"
|
|
- "**/*.cxx"
|
|
- "**/*.h"
|
|
- "**/CMakeLists.txt"
|
|
---
|
|
# C++ Testing
|
|
|
|
> This file extends [common/testing.md](../common/testing.md) with C++ specific content.
|
|
|
|
## Framework
|
|
|
|
Use **GoogleTest** (gtest/gmock) with **CMake/CTest**.
|
|
|
|
## Running Tests
|
|
|
|
```bash
|
|
cmake --build build && ctest --test-dir build --output-on-failure
|
|
```
|
|
|
|
## Coverage
|
|
|
|
```bash
|
|
cmake -DCMAKE_CXX_FLAGS="--coverage" -DCMAKE_EXE_LINKER_FLAGS="--coverage" ..
|
|
cmake --build .
|
|
ctest --output-on-failure
|
|
lcov --capture --directory . --output-file coverage.info
|
|
```
|
|
|
|
## Sanitizers
|
|
|
|
Always run tests with sanitizers in CI:
|
|
|
|
```bash
|
|
cmake -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined" ..
|
|
```
|
|
|
|
## Reference
|
|
|
|
See skill: `cpp-testing` for detailed C++ testing patterns, TDD workflow, and GoogleTest/GMock usage.
|