How to programatically disable assertions in C++?

811 views Asked by At

I must debug unit tests (we're using UnitTestPP) in C++ (specifically using VS 2015) and I want to disable assertions for specific sections of the code for which we're willingly making the tested code throw exceptions, which in turn makes some assertions fail, so that I'm not always clicking "ignore" each time the "assertion failed" popup appears.

I don't want to disable assertions completely since they still could be useful in signaling problematic cases in the code.

I know about the #define NDEBUG, but it doesn't work. I think this is because the unit tests are in another project/DLL.

Also, the failing assert is a ATLASSERT, I don't know if this changes something.

0

There are 0 answers