#include "gtest/gtest.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdexcept>
Go to the source code of this file.
◆ Fail()
void Fail |
( |
const char * | msg | ) |
|
◆ main()
int main |
( |
int | argc, |
|
|
char ** | argv ) |
Definition at line 105 of file gtest_assert_by_exception_test.cc.
105 {
108
110 if (result == 0) {
111 printf(
"RUN_ALL_TESTS returned %d\n", result);
112 Fail(
"Expected failure instead.");
113 }
114
116 Fail(
"Should have continued with other tests, but did not.");
117 }
118 return 0;
119}
void Append(TestEventListener *listener)
static UnitTest * GetInstance()
TestEventListeners & listeners()
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
int kTestForContinuingTest
void Fail(const char *msg)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
◆ TEST() [1/2]
Definition at line 65 of file gtest_assert_by_exception_test.cc.
65 {
66
67 try {
69 } catch(...) {
70 Fail(
"A successful assertion wrongfully threw.");
71 }
72
73
74 try {
76 } catch(...) {
77 Fail(
"A failed non-fatal assertion wrongfully threw.");
78 }
79
80
81 try {
82 AssertFalse();
83 } catch(const testing::AssertionException& e) {
84 if (strstr(e.what(), "Expected failure") != NULL)
85 throw;
86
88 "A failed assertion did throw an exception of the right type, "
89 "but the message is incorrect. Instead of containing \"Expected "
90 "failure\", it is:\n");
92 } catch(...) {
93 Fail(
"A failed assertion threw the wrong type of exception.");
94 }
95 Fail(
"A failed assertion should've thrown but didn't.");
96}
#define EXPECT_EQ(val1, val2)
◆ TEST() [2/2]
◆ kTestForContinuingTest
int kTestForContinuingTest = 0 |