45 using ::testing::Test;
46 using ::testing::TestEventListeners;
47 using ::testing::TestWithParam;
48 using ::testing::UnitTest;
54 SUCCEED() <<
"This is a success.";
69 FAIL() <<
"Unexpected failure: Disabled test should not be run";
80 GTEST_SKIP() <<
"It is good practice to tell why you skip a test.";
85 GTEST_SKIP() <<
"It is good practice to tell why you skip a test.";
88 TEST(MixedResultTest, Succeeds) {
93 TEST(MixedResultTest, Fails) {
98 TEST(MixedResultTest, DISABLED_test) {
99 FAIL() <<
"Unexpected failure: Disabled test should not be run";
102 TEST(XmlQuotingTest, OutputsCData) {
103 FAIL() <<
"XML output: "
104 "<?xml encoding=\"utf-8\"><top><![CDATA[cdata text]]></top>";
109 TEST(InvalidCharactersTest, InvalidCharactersInMessage) {
110 FAIL() <<
"Invalid characters in brackets [\x1\x2]";
116 RecordProperty(
"SetUpTestSuite (with whitespace)",
"yes and yes");
117 RecordProperty(
"SetUpTestSuite",
"yes");
120 RecordProperty(
"TearDownTestSuite (with whitespace)",
"aye and aye");
121 RecordProperty(
"TearDownTestSuite",
"aye");
126 RecordProperty(
"key_1",
"1");
130 RecordProperty(
"key_int", 1);
134 RecordProperty(
"key_1",
"1");
135 RecordProperty(
"key_2",
"2");
136 RecordProperty(
"key_3",
"3");
140 RecordProperty(
"key_1",
"1");
141 RecordProperty(
"key_1",
"2");
144 TEST(NoFixtureTest, RecordProperty) {
145 RecordProperty(
"key",
"1");
153 const std::string&
value) {
157 TEST(NoFixtureTest, ExternalUtilityThatCallsRecordIntValuedProperty) {
161 TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) {
197 template <
typename T>
204 TypeParameterizedTestSuiteTypes);
206 int main(
int argc,
char** argv) {
209 if (argc > 1 && strcmp(argv[1],
"--shut_down_xml") == 0) {
210 TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
211 delete listeners.Release(listeners.default_xml_generator());
#define TYPED_TEST_P(SuiteName, TestName)
internal::ValueArray< T...> Values(T...v)
#define TEST_F(test_fixture, test_name)
static void TearDownTestSuite()
testing::Types< int, bool > TypeParameterizedTestSuiteTypes
#define TEST(test_suite_name, test_name)
#define ASSERT_EQ(val1, val2)
testing::Types< int, bool > TypedTestTypes
#define TYPED_TEST_SUITE(CaseName, Types,...)
static void SetUpTestSuite()
static void SetUpTestSuite()
#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types,...)
static void TearDownTestSuite()
#define EXPECT_EQ(val1, val2)
#define TEST_P(test_suite_name, test_name)
#define TYPED_TEST(CaseName, TestName)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
void ExternalUtilityThatCallsRecordProperty(const std::string &key, int value)
#define TYPED_TEST_SUITE_P(SuiteName)
#define REGISTER_TYPED_TEST_SUITE_P(SuiteName,...)
static void RecordProperty(const std::string &key, const std::string &value)
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name,...)