Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
PauliusLiekis opened this issue Jan 29, 2019 · 0 comments
Open

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

PauliusLiekis opened this issue Jan 29, 2019 · 0 comments

Comments

@PauliusLiekis
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant