Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

What's the right way to check that assert has happened? #171

Copy link
Copy link
@PauliusLiekis

Description

@PauliusLiekis
Issue body actions

We defined our assert as:

#define FATMAP_ASSERT(x) { if (!(x)) { throw UnitTest::AssertException(std::string("Assert failed: (") + #x + ") at " + __FUNCTION__); } }

This allows us to use CHECK_ASSERT in the UnitTests.

But turns out that if you do FATMAP_ASSERT(false) anywhere outside of CHECK_ASSERT or CHECK statement, then it will fail silently even in Debug mode. It seems to be caused by this code:

https://github.com/unittest-cpp/unittest-cpp/blob/master/UnitTest++/TestMacros.h#L78

Is this intentional? If so what's the right way of checking for asserts and still not allowing other asserts to fail?

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.