|
|
|
|
|
by cozzyd
1171 days ago
|
|
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.
This is easy on gcc because it generates automatic constants for the beginning and end of different linker sections. There may be away to do this with clang as well, but I never use clang. |
|