What's the right way to check that assert has happened? · Issue #171 · unittest-cpp/unittest-cpp · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

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

Open
@PauliusLiekis

Description

@PauliusLiekis

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TMZ Celebrity News – Breaking Stories, Videos & Gossip

      Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

      Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

      🎥 Watch TMZ Live

      TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.