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