Tests perform checks in Release build
Rationale
If tests are built in Release mode (with -DCMAKE_BUILD_TYPE=Release
), the tests don't check anything. This is happening because tests use assert macro which is disabled if NDEBUG
macro is defined. Cmake implicitly defines NDEBUG
when builds in Release mode (with -DCMAKE_BUILD_TYPE=Release
). Tests don't fail, they silently ignore any errors, which is a very confusing behaviour.
See the details in the issue.
Changes
- A new file
test/check.hpp
is added. It contains a newASSERT
macro, that doesn't depend on any other macro. - All usages of
<cassert>
are replaced with"check.hpp"
; all usages ofassert
macro are replaced withASSERT
macro.