The Google Test framework provides a rich set of both fatal and non-fatal assertion macros, which resemble function calls, to verify the tested code. When these assertions fail, the framework displays the source file, line number, and relevant error message (including custom error messages) to help developers quickly identify the failed code. We have already seen some simple examples on how to use the ASSERT_TRUE macro; in this recipe, we will look at other available macros.
Asserting with Google Test
How to do it...
Use the following macros to verify the tested code:
- Use ASSERT_TRUE(condition) or EXPECT_TRUE(condition) to check whether the condition is true and ASSERT_FASE(condition) or EXPECT_FALSE(condition) to check whether the condition is false, as shown in...