@@ -194,33 +194,34 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
194194 typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \
195195 GTEST_NAME_GENERATOR_ (CaseName)
196196
197- #define TYPED_TEST (CaseName, TestName ) \
198- static_assert (sizeof (GTEST_STRINGIFY_(TestName)) > 1, \
199- "test-name must not be empty"); \
200- template <typename gtest_TypeParam_> \
201- class GTEST_TEST_CLASS_NAME_ (CaseName, TestName) \
202- : public CaseName<gtest_TypeParam_> { \
203- private: \
204- typedef CaseName<gtest_TypeParam_> TestFixture; \
205- typedef gtest_TypeParam_ TypeParam; \
206- void TestBody () override ; \
207- }; \
208- static bool gtest_##CaseName##_##TestName##_registered_ \
209- GTEST_ATTRIBUTE_UNUSED_ = ::testing::internal::TypeParameterizedTest< \
210- CaseName, \
211- ::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \
212- TestName)>, \
213- GTEST_TYPE_PARAMS_ ( \
214- CaseName)>::Register(" " , \
215- ::testing::internal::CodeLocation ( \
216- __FILE__, __LINE__), \
217- GTEST_STRINGIFY_(CaseName), \
218- GTEST_STRINGIFY_(TestName), 0, \
219- ::testing::internal::GenerateNames< \
220- GTEST_NAME_GENERATOR_(CaseName), \
221- GTEST_TYPE_PARAMS_(CaseName)>()); \
222- template <typename gtest_TypeParam_> \
223- void GTEST_TEST_CLASS_NAME_ (CaseName, \
197+ #define TYPED_TEST (CaseName, TestName ) \
198+ static_assert (sizeof (GTEST_STRINGIFY_(TestName)) > 1, \
199+ "test-name must not be empty"); \
200+ template <typename gtest_TypeParam_> \
201+ class GTEST_TEST_CLASS_NAME_ (CaseName, TestName) \
202+ : public CaseName<gtest_TypeParam_> { \
203+ private: \
204+ typedef CaseName<gtest_TypeParam_> TestFixture; \
205+ typedef gtest_TypeParam_ TypeParam; \
206+ void TestBody () override ; \
207+ }; \
208+ GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \
209+ gtest_##CaseName##_##TestName##_registered_ = \
210+ ::testing::internal::TypeParameterizedTest< \
211+ CaseName, \
212+ ::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_( \
213+ CaseName, TestName)>, \
214+ GTEST_TYPE_PARAMS_ ( \
215+ CaseName)>::Register(" " , \
216+ ::testing::internal::CodeLocation ( \
217+ __FILE__, __LINE__), \
218+ GTEST_STRINGIFY_(CaseName), \
219+ GTEST_STRINGIFY_(TestName), 0, \
220+ ::testing::internal::GenerateNames< \
221+ GTEST_NAME_GENERATOR_(CaseName), \
222+ GTEST_TYPE_PARAMS_(CaseName)>()); \
223+ template <typename gtest_TypeParam_> \
224+ void GTEST_TEST_CLASS_NAME_ (CaseName, \
224225 TestName)<gtest_TypeParam_>::TestBody()
225226
226227// Legacy API is deprecated but still available
@@ -267,31 +268,32 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
267268 TYPED_TEST_SUITE_P
268269#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
269270
270- #define TYPED_TEST_P (SuiteName, TestName ) \
271- namespace GTEST_SUITE_NAMESPACE_ ( SuiteName) { \
272- template <typename gtest_TypeParam_> \
273- class TestName : public SuiteName <gtest_TypeParam_> { \
274- private: \
275- typedef SuiteName<gtest_TypeParam_> TestFixture; \
276- typedef gtest_TypeParam_ TypeParam; \
277- void TestBody () override ; \
278- }; \
279- static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
280- GTEST_TYPED_TEST_SUITE_P_STATE_ (SuiteName).AddTestName ( \
281- __FILE__, __LINE__, GTEST_STRINGIFY_ (SuiteName), \
282- GTEST_STRINGIFY_ (TestName)); \
283- } \
284- template <typename gtest_TypeParam_> \
285- void GTEST_SUITE_NAMESPACE_ ( \
271+ #define TYPED_TEST_P (SuiteName, TestName ) \
272+ namespace GTEST_SUITE_NAMESPACE_ ( SuiteName) { \
273+ template <typename gtest_TypeParam_> \
274+ class TestName : public SuiteName <gtest_TypeParam_> { \
275+ private: \
276+ typedef SuiteName<gtest_TypeParam_> TestFixture; \
277+ typedef gtest_TypeParam_ TypeParam; \
278+ void TestBody () override ; \
279+ }; \
280+ GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \
281+ gtest_##TestName##_defined_ = \
282+ GTEST_TYPED_TEST_SUITE_P_STATE_ (SuiteName).AddTestName ( \
283+ __FILE__, __LINE__, GTEST_STRINGIFY_ (SuiteName), \
284+ GTEST_STRINGIFY_ (TestName)); \
285+ } \
286+ template <typename gtest_TypeParam_> \
287+ void GTEST_SUITE_NAMESPACE_ ( \
286288 SuiteName)::TestName<gtest_TypeParam_>::TestBody()
287289
288290// Note: this won't work correctly if the trailing arguments are macros.
289291#define REGISTER_TYPED_TEST_SUITE_P (SuiteName, ...) \
290292 namespace GTEST_SUITE_NAMESPACE_ ( SuiteName) { \
291293 typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \
292294 } \
293- static const char * const GTEST_REGISTERED_TEST_NAMES_ ( \
294- SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \
295+ GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static const char * const \
296+ GTEST_REGISTERED_TEST_NAMES_ ( SuiteName) = \
295297 GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \
296298 GTEST_STRINGIFY_ (SuiteName), __FILE__, __LINE__, #__VA_ARGS__)
297299
@@ -303,22 +305,24 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
303305 REGISTER_TYPED_TEST_SUITE_P
304306#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
305307
306- #define INSTANTIATE_TYPED_TEST_SUITE_P (Prefix, SuiteName, Types, ...) \
307- static_assert (sizeof (GTEST_STRINGIFY_(Prefix)) > 1, \
308- "test-suit-prefix must not be empty"); \
309- static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \
310- ::testing::internal::TypeParameterizedTestSuite< \
311- SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
312- ::testing::internal::GenerateTypeList<Types>::type>:: \
313- Register (GTEST_STRINGIFY_(Prefix), \
314- ::testing::internal::CodeLocation(__FILE__, __LINE__), \
315- >EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \
316- GTEST_STRINGIFY_(SuiteName), \
317- GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
318- ::testing::internal::GenerateNames< \
319- ::testing::internal::NameGeneratorSelector< \
320- __VA_ARGS__>::type, \
321- ::testing::internal::GenerateTypeList<Types>::type>())
308+ #define INSTANTIATE_TYPED_TEST_SUITE_P (Prefix, SuiteName, Types, ...) \
309+ static_assert (sizeof (GTEST_STRINGIFY_(Prefix)) > 1, \
310+ "test-suit-prefix must not be empty"); \
311+ GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \
312+ gtest_##Prefix##_##SuiteName = \
313+ ::testing::internal::TypeParameterizedTestSuite< \
314+ SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
315+ ::testing::internal::GenerateTypeList<Types>::type>:: \
316+ Register ( \
317+ GTEST_STRINGIFY_ (Prefix), \
318+ ::testing::internal::CodeLocation(__FILE__, __LINE__), \
319+ >EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \
320+ GTEST_STRINGIFY_(SuiteName), \
321+ GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
322+ ::testing::internal::GenerateNames< \
323+ ::testing::internal::NameGeneratorSelector< \
324+ __VA_ARGS__>::type, \
325+ ::testing::internal::GenerateTypeList<Types>::type>())
322326
323327// Legacy API is deprecated but still available
324328#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
0 commit comments