Skip to content

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

  1. A new file test/check.hpp is added. It contains a new ASSERT macro, that doesn't depend on any other macro.
  2. All usages of <cassert> are replaced with "check.hpp"; all usages of assert macro are replaced with ASSERT macro.

Merge request reports