Let's say we have many unit test functions only for debug build. We don't want to compile these functions at all in release build. Is there a way other than wrapping unit test functions with #ifdef _DEBUG every time?
#ifdef _DEBUG
void testfunc_xxx() {
...
}
#endif
For example, we could have a macro
#ifdef _DEBUG
#define UNITTESTFUNC(name) void name()
#else
#define UNITTESTFUNC(name) template<typename T> void name()
#endif
UNITTESTFUNC(testfunc_xxx) {
...
}
But it depends on delayed template parsing. Is there a better way to do it? Thanks!
Aucun commentaire:
Enregistrer un commentaire