doctest stands out with its ability to write tests in a new and easier way, unlocking the potential for more thorough, up-to-date, and uniform testing.
ReSharper C++: Better Ways to Test C++ with doctest
by Viktor Kirilov
From the article:
What truly sets doctest apart is the ability to use it alongside your production code. This is made possible because of 5 main properties:
- lightning speed of compilation - see the benchmarks
- ability to remove everything testing-related from binaries for final production builds by defining a global preprocessor identifier
- easy integration with the main() function of applications - supporting 3 scenarios: only tests, only the program, and both
- ability to write tests across multiple shared objects and have them registered in a single place for uniform reporting
- transparency - no warnings or other artifacts
Going a step further – doctest can even be used as a general-purpose assert library within the production code itself - outside of a testing context!
Here is a direct question/answer thread of a user interested in mixing production code and tests.
Add a Comment