42 if (result.type() == testing::TestPartResult::kFatalFailure) {
43 throw testing::AssertionException(result);
52 void Fail(
const char* msg) {
53 printf(
"FAILURE: %s\n", msg);
69 Fail(
"A successful assertion wrongfully threw.");
76 Fail(
"A failed non-fatal assertion wrongfully threw.");
82 }
catch(
const testing::AssertionException& e) {
83 if (strstr(e.what(),
"Expected failure") !=
nullptr)
throw;
86 "A failed assertion did throw an exception of the right type, "
87 "but the message is incorrect. Instead of containing \"Expected "
88 "failure\", it is:\n");
91 Fail(
"A failed assertion threw the wrong type of exception.");
93 Fail(
"A failed assertion should've thrown but didn't.");
102 int main(
int argc,
char** argv) {
108 printf(
"RUN_ALL_TESTS returned %d\n", result);
109 Fail(
"Expected failure instead.");
113 Fail(
"Should have continued with other tests, but did not.");
#define TEST(test_suite_name, test_name)
#define ASSERT_EQ(val1, val2)
void OnTestPartResult(const testing::TestPartResult &result) override
void Append(TestEventListener *listener)
TestEventListeners & listeners()
static void AssertFalse()
int kTestForContinuingTest
#define EXPECT_EQ(val1, val2)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
static UnitTest * GetInstance()
void Fail(const char *msg)