Mixing Tests and Production Code With Doctest

doctest is a fully open source light and feature-rich C++98 / C++11 single-header testing framework for unit tests and TDD. It is inspired by the unittest {} functionality of the D programming language and Python’s docstrings. Tests can be considered a form of documentation and should be able to reside near the production code which they test. This is not possible (or at least practical) with any other testing framework for C++.

doctest brings the ability of compiled languages such as D / Rust / Nim to have tests written directly in the production code by providing a fast, transparent and flexible test runner with a clean interface which can be removed entirely from the binary along with all tests for release builds of the software that are shipped to customers. The framework can be used like any other even if you don’t want/need to mix production code and tests – the list of features doesn’t stop growing. By watching this talk you will get familiar with the framework and see how it’s different from all the others.

Video producer: http://cppcon.org/

Further reading: doctest – the lightest C++ testing framework for unit tests