41 void OnTestPartResult(
const testing::TestPartResult& result)
override {
42 if (result.type() == testing::TestPartResult::kFatalFailure) {
43 throw testing::AssertionException(result);
52void Fail(
const char* msg) {
53 printf(
"FAILURE: %s\n", msg);
58static void AssertFalse() {
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.");
102int 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 ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
int kTestForContinuingTest
int main(int argc, char **argv)
void Fail(const char *msg)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
void Append(TestEventListener *listener)
static UnitTest * GetInstance()
TestEventListeners & listeners()