41using ::testing::InitGoogleTest;
42using ::testing::TestEventListeners;
43using ::testing::TestWithParam;
44using ::testing::UnitTest;
46using ::testing::Values;
52 SUCCEED() <<
"This is a success.";
67 FAIL() <<
"Unexpected failure: Disabled test should not be run";
70TEST(MixedResultTest, Succeeds) {
75TEST(MixedResultTest, Fails) {
80TEST(MixedResultTest, DISABLED_test) {
81 FAIL() <<
"Unexpected failure: Disabled test should not be run";
84TEST(XmlQuotingTest, OutputsCData) {
85 FAIL() <<
"XML output: "
86 "<?xml encoding=\"utf-8\"><top><![CDATA[cdata text]]></top>";
91TEST(InvalidCharactersTest, InvalidCharactersInMessage) {
92 FAIL() <<
"Invalid characters in brackets [\x1\x2]";
102 RecordProperty(
"key_1",
"1");
106 RecordProperty(
"key_int", 1);
110 RecordProperty(
"key_1",
"1");
111 RecordProperty(
"key_2",
"2");
112 RecordProperty(
"key_3",
"3");
116 RecordProperty(
"key_1",
"1");
117 RecordProperty(
"key_1",
"2");
120TEST(NoFixtureTest, RecordProperty) {
121 RecordProperty(
"key",
"1");
129 const std::string&
value) {
133TEST(NoFixtureTest, ExternalUtilityThatCallsRecordIntValuedProperty) {
137TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) {
148#if GTEST_HAS_TYPED_TEST
152typedef testing::Types<int, long> TypedTestTypes;
157#if GTEST_HAS_TYPED_TEST_P
160template <
typename T>
class TypeParameterizedTestCase :
public Test {};
162TYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {}
164typedef testing::Types<int, long> TypeParameterizedTestCaseTypes;
166 TypeParameterizedTestCase,
167 TypeParameterizedTestCaseTypes);
171 InitGoogleTest(&argc,
argv);
173 if (argc > 1 && strcmp(
argv[1],
"--shut_down_xml") == 0) {
174 TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
175 delete listeners.Release(listeners.default_xml_generator());
static void SetUpTestCase()
static void TearDownTestCase()
static void RecordProperty(const std::string &key, const std::string &value)
#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator,...)
#define TEST_P(test_case_name, test_name)
#define TEST_F(test_fixture, test_name)
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
#define TEST(test_case_name, test_name)
REGISTER_TYPED_TEST_CASE_P(TypeParamTest, TestA, TestB)
TYPED_TEST(TypedTest, TestA)
TYPED_TEST_CASE(TypedTest, MyTypes)
TYPED_TEST_CASE_P(TypeParamTest)
TYPED_TEST_P(TypeParamTest, TestA)
INSTANTIATE_TYPED_TEST_CASE_P(My, TypeParamTest, MyTypes)
void ExternalUtilityThatCallsRecordProperty(const std::string &key, int value)