42using ::testing::TestEventListeners;
43using ::testing::TestWithParam;
44using ::testing::UnitTest;
52 SUCCEED() <<
"This is a success.";
67 FAIL() <<
"Unexpected failure: Disabled test should not be run";
78 GTEST_SKIP() <<
"It is good practice to tell why you skip a test.";
83 GTEST_SKIP() <<
"It is good practice to tell why you skip a test.";
86TEST(MixedResultTest, Succeeds) {
91TEST(MixedResultTest, Fails) {
96TEST(MixedResultTest, DISABLED_test) {
97 FAIL() <<
"Unexpected failure: Disabled test should not be run";
100TEST(XmlQuotingTest, OutputsCData) {
101 FAIL() <<
"XML output: "
102 "<?xml encoding=\"utf-8\"><top><![CDATA[cdata text]]></top>";
107TEST(InvalidCharactersTest, InvalidCharactersInMessage) {
108 FAIL() <<
"Invalid characters in brackets [\x1\x2]";
115 RecordProperty(
"TearDownTestSuite",
"aye");
120 RecordProperty(
"key_1",
"1");
124 RecordProperty(
"key_int", 1);
128 RecordProperty(
"key_1",
"1");
129 RecordProperty(
"key_2",
"2");
130 RecordProperty(
"key_3",
"3");
134 RecordProperty(
"key_1",
"1");
135 RecordProperty(
"key_1",
"2");
138TEST(NoFixtureTest, RecordProperty) {
139 RecordProperty(
"key",
"1");
147 const std::string&
value) {
151TEST(NoFixtureTest, ExternalUtilityThatCallsRecordIntValuedProperty) {
155TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) {
184int main(
int argc,
char** argv) {
187 if (argc > 1 && strcmp(argv[1],
"--shut_down_xml") == 0) {
188 TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
189 delete listeners.Release(listeners.default_xml_generator());
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
REGISTER_TYPED_TEST_SUITE_P(TypeParameterizedTestSuite, HasTypeParamAttribute)
testing::Types< int, long > TypedTestTypes
INSTANTIATE_TEST_SUITE_P(Single, ValueParamTest, Values(33, 42))
TYPED_TEST_SUITE_P(TypeParameterizedTestSuite)
TEST(MixedResultTest, Succeeds)
int main(int argc, char **argv)
TYPED_TEST_SUITE(TypedTest, TypedTestTypes)
TEST_P(ValueParamTest, HasValueParamAttribute)
TYPED_TEST_P(TypeParameterizedTestSuite, HasTypeParamAttribute)
TYPED_TEST(TypedTest, HasTypeParamAttribute)
void ExternalUtilityThatCallsRecordProperty(const std::string &key, int value)
testing::Types< int, long > TypeParameterizedTestSuiteTypes
TEST_F(SuccessfulTest, Succeeds)
INSTANTIATE_TYPED_TEST_SUITE_P(Single, TypeParameterizedTestSuite, TypeParameterizedTestSuiteTypes)
internal::ValueArray< T... > Values(T... v)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
static void RecordProperty(const std::string &key, const std::string &value)
static void TearDownTestSuite()
static void SetUpTestSuite()