Our great sponsors
-
templight
Templight is a Clang-based tool to profile the time and memory consumption of template instantiations and to perform interactive debugging sessions to gain introspection into the template instantiation process.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Keep tests and code separate, and use tdd: https://github.com/yellowdragonlabs/TDD
I usually have dozens/hundreds of tests that run faster than you can compile #include .
All tests are executed automatically every time I save. It's very nice to watch the output while coding, with almost no latency.
IMHO the best approach is to avoid the problem by applying TDD. Then there is very little need to debug anything. But otherwise, there is https://github.com/mikael-s-persson/templight for compile-time debugging which is pretty cool and having something like `expect(auto... args) static_asert(args...); assert(args...);` may help with being able to debug at run-time and get the coverage (though, the code has has to compile aka pass first).
There are other ways to do this. I made a proof of concept of using linker sections to allow you to sprinkle tests within the implementation inline once... https://github.com/cozzyd/examc (this is obviously not production-ready, just serves as a proof of concept).
Basically the idea is that the test code gets written to a different linker section that your test runner can iterate through, when tests are enabled.
You can now specify a directory, see README. Any other arguments are just passed to the compiler.
Here's a sample to play with: https://github.com/yellowdragonlabs/samples/blob/master/tdd_...