using ::testing::TestWithParam;
using ::testing::UnitTest;
using ::testing::Test;
-using ::testing::Types;
using ::testing::Values;
class SuccessfulTest : public Test {
}
class PropertyRecordingTest : public Test {
+ public:
+ static void SetUpTestCase() { RecordProperty("SetUpTestCase", "yes"); }
+ static void TearDownTestCase() { RecordProperty("TearDownTestCase", "aye"); }
};
TEST_F(PropertyRecordingTest, OneProperty) {
RecordProperty("key", "1");
}
-void ExternalUtilityThatCallsRecordProperty(const char* key, int value) {
+void ExternalUtilityThatCallsRecordProperty(const std::string& key, int value) {
testing::Test::RecordProperty(key, value);
}
-void ExternalUtilityThatCallsRecordProperty(const char* key,
- const char* value) {
+void ExternalUtilityThatCallsRecordProperty(const std::string& key,
+ const std::string& value) {
testing::Test::RecordProperty(key, value);
}
TEST_P(ValueParamTest, AnotherTestThatHasValueParamAttribute) {}
INSTANTIATE_TEST_CASE_P(Single, ValueParamTest, Values(33, 42));
+#if GTEST_HAS_TYPED_TEST
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for typed tests.
template <typename T> class TypedTest : public Test {};
-typedef Types<int, long> TypedTestTypes;
+typedef testing::Types<int, long> TypedTestTypes;
TYPED_TEST_CASE(TypedTest, TypedTestTypes);
TYPED_TEST(TypedTest, HasTypeParamAttribute) {}
+#endif
+#if GTEST_HAS_TYPED_TEST_P
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for type-parameterized tests.
template <typename T> class TypeParameterizedTestCase : public Test {};
TYPED_TEST_CASE_P(TypeParameterizedTestCase);
TYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {}
REGISTER_TYPED_TEST_CASE_P(TypeParameterizedTestCase, HasTypeParamAttribute);
-typedef Types<int, long> TypeParameterizedTestCaseTypes;
+typedef testing::Types<int, long> TypeParameterizedTestCaseTypes;
INSTANTIATE_TYPED_TEST_CASE_P(Single,
TypeParameterizedTestCase,
TypeParameterizedTestCaseTypes);
+#endif
int main(int argc, char** argv) {
InitGoogleTest(&argc, argv);
TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
delete listeners.Release(listeners.default_xml_generator());
}
+ testing::Test::RecordProperty("ad_hoc_property", "42");
return RUN_ALL_TESTS();
}