doctest is a lightweight C++ unit testing framework and assertion library. It provides a single-header implementation that eliminates complex build dependencies, allowing developers to write and execute test cases directly within their source code.
The framework is distinguished by its focus on compile-time performance and binary overhead. It uses conditional compilation guards to strip all testing logic and metadata from production binaries. Additionally, it features hierarchical subcases that re-execute parent setup code to isolate different execution paths within a single test case.
Its capability surface includes a thread-safe test runner with support for parameterized tests, test suites, and custom reporters. It provides specialized tools for validating expressions, comparing floating point values, and verifying exception behavior. The system also integrates with build tools such as CMake and Bazel.
The entire framework is provided as a single-header library to simplify integration.