|
kaycxx-test
C++ unit test framework
|
C++ unit test framework with hierarchical suites, lifecycle hooks, skipping, test filtering, and CTest discovery.
Tests are declared with one top-level suite, nested describe blocks, and it test cases. The linked test library provides main() and runs every registered suite.
The example uses kaycxx-assert for assertions. Tests can use any other exception-based assertion library or custom assertion functions because assertions are ordinary functions that report failures by throwing exceptions. An exception that leaves a test body is reported as a failed test.
CMake users consume the installed package with:
No separate main.cpp is needed for the test executable.
Non-CMake users can use pkg-config:
Running the test executable produces a hierarchical report. The test framework adds colors automatically when the output is connected to a supported terminal.
When both tests pass:
If addition incorrectly returns 5 instead of -5 for the negative numbers:
suite, describe, it, registration order, dynamic test generation, and callback lifetimes.test target, and per-test CTest discovery.kaycxx-test is always built as a static library because it supplies the test executable's main() function.
If no prefix is specified, CMake installs to /usr/local by default on Unix systems.
Run all tests:
Generate API documentation with Doxygen:
The generated HTML documentation is written to build/debug/apidoc/html/index.html.