| 46 | void ThrowCheckEqual(const int val) { THROW_CHECK_EQ(val, 1) << "Error!"; } |
| 47 | |
| 48 | TEST(ExceptionLogging, Nominal) { |
| 49 | EXPECT_NO_THROW(ThrowCheck(true)); |
| 50 | EXPECT_THROW(ThrowCheck(false), std::invalid_argument); |
| 51 | EXPECT_NO_THROW(ThrowCheckEqual(1)); |
| 52 | EXPECT_THROW(ThrowCheckEqual(0), std::invalid_argument); |
| 53 | EXPECT_THROW(THROW_CHECK_NOTNULL(nullptr), std::invalid_argument); |
| 54 | EXPECT_THROW({ LOG(FATAL_THROW) << "Error!"; }, std::invalid_argument); |
| 55 | EXPECT_THROW( |
| 56 | { LOG_FATAL_THROW(std::logic_error) << "Error!"; }, std::logic_error); |
| 57 | } |
| 58 | |
| 59 | // Ensure that the condition is evaluated exactly once |
| 60 | // for both the positive and negative cases. |
nothing calls this directly
no test coverage detected