How are death tests supposed to work? #3809
Unanswered
krzikalla
asked this question in
Community Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Actually I know how to use them. But I wonder, if their interaction with NDEBUG is fine.
Simple example:
The problem with the above code is, that you don't know, if the program will crash. A triggered assertion means, that the program is in an inconsistent state and that anything (crash as well as nothing) can happen afterwards. So neither
EXPECT_DEATH
norEXPECT_DEBUG_DEATH
will work reliable, when NDEBUG is defined.Actually I am looking for a macro, which executes the statement only, if NDEBUG is not present. But I haven't found something in google test. Then what is the idea behind
EXPECT_DEBUG_DEATH
?Beta Was this translation helpful? Give feedback.
All reactions